Closed tomekit closed 1 week ago
It seems that after I've switched to:
var userId uuid.UUID
...
params := pgx.NamedArgs{
"user_id": userId,
}
it works fine even without the AfterConnect
register.
Not that I exactly understand why is that, but it seems my problem is now resolved.
Glad you got it working. For what it's worth, the problem with your original example is your were trying to encode a slice of UUID not a single UUID into the PostgreSQL UUID. You would need to use the ...
operator in your call to Exec
to expand params
.
Hi,
I am scanning field into
userId
:I then subsequently user userId in the select query:
This results in err:
and I am failing to understand why is that given that DB type is
uuid
and I am using native pgx type:pgtype.UUID
.It's likely I am not using it correctly given that I am quite new to pgx and Golang.
I am using:
github.com/jackc/pgx/v5 v5.7.1
Based on: https://github.com/jackc/pgx/wiki/UUID-Support I've registered UUID type in my config like this:
Any help appreciated!