With something like https://github.com/georgysavva/scany (or this https://pkg.go.dev/github.com/jackc/pgx/v5#RowToStructByName). More info here - https://github.com/jackc/pgx/issues/760