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

Method Format

internal/sql/ast/column_def.go:37–55  ·  view source on GitHub ↗
(buf *TrackedBuffer, d format.Dialect)

Source from the content-addressed store, hash-verified

35}
36
37func (n *ColumnDef) Format(buf *TrackedBuffer, d format.Dialect) {
38 if n == nil {
39 return
40 }
41 buf.WriteString(n.Colname)
42 buf.WriteString(" ")
43 buf.astFormat(n.TypeName, d)
44 // Use IsArray from ColumnDef since TypeName.ArrayBounds may not be set
45 // (for type resolution compatibility)
46 if n.IsArray && !items(n.TypeName.ArrayBounds) {
47 buf.WriteString("[]")
48 }
49 if n.PrimaryKey {
50 buf.WriteString(" PRIMARY KEY")
51 } else if n.IsNotNull {
52 buf.WriteString(" NOT NULL")
53 }
54 buf.astFormat(n.Constraints, d)
55}

Callers

nothing calls this directly

Calls 2

itemsFunction · 0.85
astFormatMethod · 0.80

Tested by

no test coverage detected