You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi I'm learning pgx and i have a database that has
|| db | columns ||
| account | id, name, role_id, created_at, updated at |
| role | id, name |
| permission | id, name|
models
type Account struct {
Id int
Email string
Password String
Role Role
IsActive boolean
Created_at
Updated_at
}
type Role struct {
Id int
Name string
Permissions []Permission
}
type Permission {
Id int
Name string
}
how can i do something similar on a 1:1,i was tring using jsonb_object_mapper
I'm not sure if this is supported, but since array_agg is i thought about asking
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hi I'm learning pgx and i have a database that has
|| db | columns ||
| account | id, name, role_id, created_at, updated at |
| role | id, name |
| permission | id, name|
models
i was reading the thread https://pkg.go.dev/github.com/jackc/pgx/[email protected]/pgtype#hdr-Child_Records

and i was able to map 1:M role to permissions using the array_agg and the pgx.RowToStructByPos
how can i do something similar on a 1:1,i was tring using jsonb_object_mapper


I'm not sure if this is supported, but since array_agg is i thought about asking
Beta Was this translation helpful? Give feedback.
All reactions