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
Then when we select the column, it will be successfully mapped to the struct.
Scenario
But what if I have a postgres function that looks like this:
create or replacefunctionuser_get(_user_id bigint)
returns table (
id bigint,
name text,
info jsonb
) as $$
begin
return query
select id, name, additional_info
from users where id = _user_id;
end;
$$ language plpgsql;
And the query looks like this:
-- name: GetUser :oneselect id::bigint, name::text, info::jsonb from user_get(@user_id::bigint);
Is it possible to map the info column that is returned from the function to UserInfo struct either by specifying the type in the query itself or in sqlc.yaml config file?
What database engines need to be changed?
PostgreSQL
What programming language backends need to be changed?
Go
The text was updated successfully, but these errors were encountered:
What do you want to change?
Ability to override selected columns from postgres function to Go structs.
Current implementation
Let's say we have the following table:
And let's say
additional_info
is mapped to this Go struct:To override the type
additional_info
, we would do the following:Then when we select the column, it will be successfully mapped to the struct.
Scenario
But what if I have a postgres function that looks like this:
And the query looks like this:
The generated Go code will be:
Issue
Is it possible to map the
info
column that is returned from the function toUserInfo
struct either by specifying the type in the query itself or insqlc.yaml
config file?What database engines need to be changed?
PostgreSQL
What programming language backends need to be changed?
Go
The text was updated successfully, but these errors were encountered: