Skip to content

Commit bbc976e

Browse files
EliSauderCopilot
andcommitted
test(compiler): verify core sqlc.embed output
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b6f2cc9 commit bbc976e

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎internal/compiler/parse_core.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ func (c *Compiler) parseQueryCore(raw *ast.RawStmt, src string, pre *preprocess.
106106
}, nil
107107
}
108108

109-
// embedColumns folds the columns each sqlc.embed() star expanded to into
110-
// the one column codegen embeds the table's struct for. The table is the
111-
// columns' source, so an embed of an alias names the table behind it. The
112-
// struct scans every column of the table in order, so only an expansion
113-
// that is exactly those columns is folded; any other stays flat.
109+
// embedColumns restores sqlc.embed() grouping after the preprocessor rewrites
110+
// each macro to table.* and core analysis expands that star into columns. The
111+
// table is the columns' source, so an embed of an alias names the table behind
112+
// it. The struct scans every column of the table in order, so only an
113+
// expansion that is exactly those columns is folded; any other stays flat.
114114
func embedColumns(raw *ast.RawStmt, cols []*Column, stars []core.StarExpansion, embeds preprocess.EmbedSet, cat *core.Catalog) []*Column {
115115
sel, ok := raw.Stmt.(*ast.SelectStmt)
116116
if !ok || len(embeds) == 0 || sel.TargetList == nil {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"contexts": ["base"]}
1+
{"contexts": ["base", "core"]}

0 commit comments

Comments
 (0)