forked from sqlc-dev/sqlc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolumn_def.go
More file actions
48 lines (44 loc) · 865 Bytes
/
column_def.go
File metadata and controls
48 lines (44 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package ast
type ColumnDef struct {
Colname string
TypeName *TypeName
IsNotNull bool
IsUnsigned bool
IsArray bool
ArrayDims int
Vals *List
Length *int
PrimaryKey bool
// From pg.ColumnDef
Inhcount int
IsLocal bool
IsFromType bool
IsFromParent bool
Storage byte
RawDefault Node
CookedDefault Node
Identity byte
CollClause *CollateClause
CollOid Oid
Constraints *List
Fdwoptions *List
Location int
Comment string
}
func (n *ColumnDef) Pos() int {
return n.Location
}
func (n *ColumnDef) Format(buf *TrackedBuffer) {
if n == nil {
return
}
buf.WriteString(n.Colname)
buf.WriteString(" ")
buf.astFormat(n.TypeName)
if n.PrimaryKey {
buf.WriteString(" PRIMARY KEY")
} else if n.IsNotNull {
buf.WriteString(" NOT NULL")
}
buf.astFormat(n.Constraints)
}