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

Function toColumn

internal/compiler/to_column.go:17–33  ·  view source on GitHub ↗
(n *ast.TypeName)

Source from the content-addressed store, hash-verified

15}
16
17func toColumn(n *ast.TypeName) *Column {
18 if n == nil {
19 panic("can't build column for nil type name")
20 }
21 typ, err := ParseTypeName(n)
22 if err != nil {
23 panic("toColumn: " + err.Error())
24 }
25 arrayDims := arrayDims(n)
26 return &Column{
27 Type: typ,
28 DataType: strings.TrimPrefix(astutils.Join(n.Names, "."), "."),
29 NotNull: true, // XXX: How do we know if this should be null?
30 IsArray: arrayDims > 0,
31 ArrayDims: arrayDims,
32 }
33}

Callers 2

outputColumnsMethod · 0.85
resolveCatalogRefsMethod · 0.85

Calls 4

JoinFunction · 0.92
ParseTypeNameFunction · 0.85
arrayDimsFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected