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
Copy file name to clipboardExpand all lines: docs/howto/embedding.md
+21-1Lines changed: 21 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -58,4 +58,24 @@ type ScoreAndTestsRow struct {
58
58
Student Student
59
59
TestScore TestScore
60
60
}
61
-
```
61
+
```
62
+
63
+
sqlc can generate structs with fields based on the alias inside the macro `sqlc.embed()` by adding the `emit_embed_alias` key to the configuration file as it shows on [configuration reference](../reference/config.md).
64
+
65
+
```sql
66
+
-- name: ListUserLink :many
67
+
SELECT
68
+
sqlc.embed(owner),
69
+
sqlc.embed(consumer)
70
+
FROM
71
+
user_links
72
+
INNER JOIN users AS owner ONowner.id=user_links.owner_id
73
+
INNER JOIN users AS consumer ONconsumer.id=user_links.consumer_id;
0 commit comments