-
Hi all, I have a question about the What do you think about it? Any other ideas or suggestions? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In general, you should only use pgtype directly when you need to. For example, if you have a You can also have your types implement pgtype interfaces like So in short, try to use native Go types or your application types and only use pgtype types directly when necessary. |
Beta Was this translation helpful? Give feedback.
In general, you should only use pgtype directly when you need to. For example, if you have a
NOT NULL integer
in PostgreSQL then scan it directly to a Goint32
. But if it is nullable then scan it into apgtype.Int4
.You can also have your types implement pgtype interfaces like
DateScanner
andDateValuer
. That allows you to directly use your application types.So in short, try to use native Go types or your application types and only use pgtype types directly when necessary.