MCPcopy
hub / github.com/sqlc-dev/sqlc / OutputColumns

Method OutputColumns

internal/compiler/output_columns.go:15–39  ·  view source on GitHub ↗

OutputColumns determines which columns a statement will output

(stmt ast.Node)

Source from the content-addressed store, hash-verified

13
14// OutputColumns determines which columns a statement will output
15func (c *Compiler) OutputColumns(stmt ast.Node) ([]*catalog.Column, error) {
16 qc, err := c.buildQueryCatalog(c.catalog, stmt, nil)
17 if err != nil {
18 return nil, err
19 }
20 cols, err := c.outputColumns(qc, stmt)
21 if err != nil {
22 return nil, err
23 }
24
25 catCols := make([]*catalog.Column, 0, len(cols))
26 for _, col := range cols {
27 catCols = append(catCols, &catalog.Column{
28 Name: col.Name,
29 Type: ast.TypeName{Name: col.DataType},
30 IsNotNull: col.NotNull,
31 IsUnsigned: col.Unsigned,
32 IsArray: col.IsArray,
33 ArrayDims: col.ArrayDims,
34 Comment: col.Comment,
35 Length: col.Length,
36 })
37 }
38 return catCols, nil
39}
40
41func hasStarRef(cf *ast.ColumnRef) bool {
42 for _, item := range cf.Fields.Items {

Callers

nothing calls this directly

Calls 2

buildQueryCatalogMethod · 0.95
outputColumnsMethod · 0.95

Tested by

no test coverage detected