-
I feel like this is such an easy question, but after much searching including looking at the unit tests and trying I'm still needing help. I have a postgres field of My code is something like the following: var output []string
err := sql.QueryRow(`select '{"foo", "NULL", " NULL "}'::name[];`).Scan(&output)
if err != nil {
return err
} which errors with: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That should work using the native pgx v5 interface. However, since you are using Something like (untested, but I think it should work): map := pgtype.NewMap() // this can be reused, but it is not concurrency safe
var output []string
err := sql.QueryRow(`select '{"foo", "NULL", " NULL "}'::name[];`).Scan(map.SQLScanner(&output))
if err != nil {
return err
} |
Beta Was this translation helpful? Give feedback.
That should work using the native pgx v5 interface. However, since you are using
database/sql
/stdlib
you will need to usepgtype.Map.SQLScanner()
.Something like (untested, but I think it should work):