-
Hi, i've some problem performing a query. What i want to achieve is fairy simple, i need to Select an user based on its ID and join this result with a couple of other tables that are in a one-to-many relation with said user. the Go structs for the user and the other tables are like this: type User struct { type Job struct { type Achievement Struct { the Query im performing is this: since i'm sure to get at max 1 User i'm using a QueryRow, and it works fine, the problem is when i call the .Scan method passing the Scan method error while trying to marshal into the achievement struct, after some debug i notice that the values returned from the query for achievements and job is not what i expected ( an Array of Interface) []interface{} but a String with the data like this: Can you help me understand this ? why i get back a string, i'm confused and after an entire afternoon of researches i don't know what to do. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'm not sure what's going on with your code, but maybe the example in the docs could be helpful: https://pkg.go.dev/github.com/jackc/pgx/[email protected]/pgtype#hdr-Child_Records |
Beta Was this translation helpful? Give feedback.
I'm not sure what's going on with your code, but maybe the example in the docs could be helpful: https://pkg.go.dev/github.com/jackc/pgx/[email protected]/pgtype#hdr-Child_Records