Copy edits
This commit is contained in:
parent
87a2c2aed5
commit
b65c5a638f
1 changed files with 2 additions and 2 deletions
|
|
@ -71,7 +71,7 @@ type SaveUserParams struct {
|
|||
}
|
||||
```
|
||||
|
||||
As you can see, the ID field is a `uuid.UUID`, not `*uuid.UUID`, so it's not possible to leave empty when calling `SaveUser` for _new_ users. Using sqlc overrides we can of course instruct it to generate Go code with `*uuid.UUID` types, but passing `nil` would mean our `INSERT` passes `NULL` to a non-nullable primary key field, which raises a not-null constraint.
|
||||
As you can see, the ID field is a `uuid.UUID`, not `*uuid.UUID`, so it's not possible to leave empty when calling `SaveUser` for _new_ users. Using sqlc overrides we can of course instruct it to generate Go code with `*uuid.UUID` types, but passing `nil` would mean our `INSERT` passes `NULL` to a non-nullable primary key field, which raises null key constraint violation.
|
||||
|
||||
|
||||
## The solution
|
||||
|
|
@ -105,4 +105,4 @@ INSERT INTO users (
|
|||
RETURNING *;
|
||||
```
|
||||
|
||||
This turned out to be a very simple solution for my current problems. If there's a better or more idiomatic way to achieve the same result, please let me know in the comments!
|
||||
This turned out to be a very simple solution for my current problem. If there's a better or more idiomatic way to achieve the same result, please let me know in the comments!
|
||||
|
|
|
|||
Loading…
Reference in a new issue