Error scanning into a var of type []sql.NullString #2255
-
I have a query that uses
Are slices of the More info:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@taylorsilva To work around this, you can use Hope this helps! 🙂 |
Beta Was this translation helpful? Give feedback.
@taylorsilva
The issue arises because pgx does not support scanning directly into slices of
sql.NullString
(or other database/sql nullable types). However, pgx does support scanning into Go slices of native types like[]string
.To work around this, you can use
[]string
instead (if you don't need to differentiate NULL values).Use
pgtype.TextArray
from pgx's pgtype package if you need more control over NULL values.Hope this helps! 🙂