jackc pgx scan array
Asked Answered
R

0

6

I want to scan in an array of strings using the pgx library without using pq ideally. Is there a way of doing this:

sourceKeys := make([]string, 0, 1)
err := rows.Scan(
    pq.Array(&sourceKeys),
)

without using the pq library?

Ruthenic answered 1/4, 2022 at 0:1 Comment(1)
You can do it without lib/pq but you'll have to implement the sql.Scanner yourself. The implementation will have to be able to correctly parse a raw postgres text array. Or you can use the jackc/pgtype package which is intended to be used with pgx (same author and mentioned in pgx's readme).Aircraft

© 2022 - 2024 — McMap. All rights reserved.