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
Hey guys,
I can't find something like this in documentation, so I want to ask if it is possible to override the field name in struct using sqlc.embed?
For example, I have a table that contains two foreign keys to same table. When I wrote the query:
SELECT sqlc.embed(g), sqlc.embed(home_team), sqlc.embed(away_team)
FROM game g
LEFT JOIN team home_team ON g.home_team_id = home_team.id
LEFT JOIN team away_team ON g.away_team_id = away_team.id
..............
model looks like this:
type GamesWithTeamsByParamsRow struct {
Game Game
Team Team
Team_2 Team
}
Is it possible look like this:
type GamesWithTeamsByParamsRow struct {
Game Game
HomeTeam Team
AwayTeam Team
}
I tried using AS home_team and AS away_team, but it doesn't work.
If this feature doesn't exist, may I suggest adding a new argument to sqlc.embed that will tell to generator how to call that field.
What database engines need to be changed?
PostgreSQL, MySQL, SQLite
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?
Hey guys,
I can't find something like this in documentation, so I want to ask if it is possible to override the field name in struct using sqlc.embed?
For example, I have a table that contains two foreign keys to same table. When I wrote the query:
model looks like this:
Is it possible look like this:
I tried using AS home_team and AS away_team, but it doesn't work.
If this feature doesn't exist, may I suggest adding a new argument to sqlc.embed that will tell to generator how to call that field.
What database engines need to be changed?
PostgreSQL, MySQL, SQLite
What programming language backends need to be changed?
Go
The text was updated successfully, but these errors were encountered: