We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have this snippet of code that works correctly when scanning varchar[] into []string in postgresql
type OrderDB struct { ID string `db:"id"` Users []string `db:"users"` } rows, err := tx.QueryxContext(ctx, query, args...) if err != nil { return nil, tracerr.Wrap(err) } defer rows.Close() var orderDB OrderDB for rows.Next() { err = rows.Scan( &orderDB.ID, pq.Array(&orderDB.Users), ) if err != nil { return nil, tracerr.Wrap(err) } }
But i want to use StructScan instead, what should i do? I know that we can make an alias for []string and implement the Scan method like
type StringArrayDB []string func (u *StringArrayDB) Scan(v interface{}) error { return pq.GenericArray{A: u}.Scan(v) }
but i still got error like pq: parsing array element index 0: pq: scanning to string is not implemented; only sql.Scanner,
pq: parsing array element index 0: pq: scanning to string is not implemented; only sql.Scanner,
what should i do? and i think this should be handled in structscan?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have this snippet of code that works correctly when scanning varchar[] into []string in postgresql
But i want to use StructScan instead, what should i do?
I know that we can make an alias for []string and implement the Scan method like
but i still got error like
pq: parsing array element index 0: pq: scanning to string is not implemented; only sql.Scanner,
what should i do? and i think this should be handled in structscan?
The text was updated successfully, but these errors were encountered: