Title: sqlc.embed that overrides struct field name · Issue #3745 · sqlc-dev/sqlc · GitHub
Open Graph Title: sqlc.embed that overrides struct field name · Issue #3745 · sqlc-dev/sqlc
X Title: sqlc.embed that overrides struct field name · Issue #3745 · sqlc-dev/sqlc
Description: 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...
Open Graph Description: 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 hav...
X Description: 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...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/3745
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sqlc.embed that overrides struct field name","articleBody":"### What do you want to change?\r\n\r\nHey guys, \r\nI 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?\r\n\r\nFor example, I have a table that contains two foreign keys to same table. When I wrote the query:\r\n```\r\nSELECT sqlc.embed(g), sqlc.embed(home_team), sqlc.embed(away_team)\r\nFROM game g\r\nLEFT JOIN team home_team ON g.home_team_id = home_team.id\r\nLEFT JOIN team away_team ON g.away_team_id = away_team.id\r\n..............\r\n```\r\n\r\nmodel looks like this:\r\n```\r\ntype GamesWithTeamsByParamsRow struct {\r\n\tGame Game\r\n\tTeam Team\r\n\tTeam_2 Team\r\n}\r\n```\r\n\r\nIs it possible look like this:\r\n```\r\ntype GamesWithTeamsByParamsRow struct {\r\n\tGame Game\r\n\tHomeTeam Team\r\n\tAwayTeam Team\r\n}\r\n```\r\n\r\nI tried using AS home_team and AS away_team, but it doesn't work.\r\n\r\nIf 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.\r\n\r\n### What database engines need to be changed?\r\n\r\nPostgreSQL, MySQL, SQLite\r\n\r\n### What programming language backends need to be changed?\r\n\r\nGo","author":{"url":"https://github.com/marko995","@type":"Person","name":"marko995"},"datePublished":"2024-12-13T12:59:58Z","url":"https://github.com/sqlc-dev/sqlc/issues/3745"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:70751609-358f-e49f-c25b-3720cae3beed |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 88AA:669A1:5BFB95:79ADD8:6B01A19B |
| html-safe-nonce | 8c734a29183b3e9869453444101ecf9626ac8a9926a932b0d71c94773a0abfa7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OEFBOjY2OUExOjVCRkI5NTo3OUFERDg6NkIwMUExOUIiLCJ2aXNpdG9yX2lkIjoiMzEzMTg5MTcwMDIyNjY5NTU3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 12d5e1a69aa14bf500c972d0ccbb76b56159605e4e517cb0b6117df674e4babc |
| hovercard-subject-tag | issue:2738345976 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sqlc-dev/sqlc/3745/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2cdcd5a54581175fafbc7a0a7318684ea06108a1ccc60de880dfc4175f33f483/sqlc-dev/sqlc/issues/3745 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2cdcd5a54581175fafbc7a0a7318684ea06108a1ccc60de880dfc4175f33f483/sqlc-dev/sqlc/issues/3745 |
| og:image:alt | 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 hav... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | marko995 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/sqlc-dev/sqlc git https://github.com/sqlc-dev/sqlc.git |
| octolytics-dimension-user_id | 136738596 |
| octolytics-dimension-user_login | sqlc-dev |
| octolytics-dimension-repository_id | 193160679 |
| octolytics-dimension-repository_nwo | sqlc-dev/sqlc |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 193160679 |
| octolytics-dimension-repository_network_root_nwo | sqlc-dev/sqlc |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width