Replies: 1 comment 1 reply
-
I think in this case the simplest approach would be for Note that both in application code and in pgx you have to be aware of the difference between SQL |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Lets imagine that I have table with name documents which has jsonb field with name fields.
When jsonb field value in table is not null, then all ok, jsonb value unmarshals into Fields struct, but when jsonb is null I have error because Document.Fields is not pointer. Is it exists way how possible instead of change Fields value into pointer, just get zero value of Fields struct in case if value in db tableis null instead of get error (cannot scan NULL into Fields).
type Document struct {
Name string
Fields Fields
}
type Fields struct {
RegisterNumber *string
json:"register_number"
Year *uint64
json:"year"
}
Beta Was this translation helpful? Give feedback.
All reactions