-
Notifications
You must be signed in to change notification settings - Fork 22
/
types.go
158 lines (137 loc) · 3.39 KB
/
types.go
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// Copyright 2010 The go-pgsql Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package pgsql
const (
_BOOLOID = 16
_BYTEAOID = 17
_CHAROID = 18
_NAMEOID = 19
_INT8OID = 20
_INT2OID = 21
_INT2VECTOROID = 22
_INT4OID = 23
_REGPROCOID = 24
_TEXTOID = 25
_OIDOID = 26
_TIDOID = 27
_XIDOID = 28
_CIDOID = 29
_OIDVECTOROID = 30
_XMLOID = 142
_POINTOID = 600
_LSEGOID = 601
_PATHOID = 602
_BOXOID = 603
_POLYGONOID = 604
_LINEOID = 628
_FLOAT4OID = 700
_FLOAT8OID = 701
_ABSTIMEOID = 702
_RELTIMEOID = 703
_TINTERVALOID = 704
_UNKNOWNOID = 705
_CIRCLEOID = 718
_CASHOID = 790
_MACADDROID = 829
_INETOID = 869
_CIDROID = 650
_INT4ARRAYOID = 1007
_TEXTARRAYOID = 1009
_FLOAT4ARRAYOID = 1021
_ACLITEMOID = 1033
_CSTRINGARRAYOID = 1263
_BPCHAROID = 1042
_VARCHAROID = 1043
_DATEOID = 1082
_TIMEOID = 1083
_TIMESTAMPOID = 1114
_TIMESTAMPTZOID = 1184
_INTERVALOID = 1186
_TIMETZOID = 1266
_BITOID = 1560
_VARBITOID = 1562
_NUMERICOID = 1700
_REFCURSOROID = 1790
_REGPROCEDUREOID = 2202
_REGOPEROID = 2203
_REGOPERATOROID = 2204
_REGCLASSOID = 2205
_REGTYPEOID = 2206
_REGTYPEARRAYOID = 2211
_TSVECTOROID = 3614
_GTSVECTOROID = 3642
_TSQUERYOID = 3615
_REGCONFIGOID = 3734
_REGDICTIONARYOID = 3769
_RECORDOID = 2249
_RECORDARRAYOID = 2287
_CSTRINGOID = 2275
_ANYOID = 2276
_ANYARRAYOID = 2277
_VOIDOID = 2278
_TRIGGEROID = 2279
_LANGUAGE_HANDLEROID = 2280
_INTERNALOID = 2281
_OPAQUEOID = 2282
_ANYELEMENTOID = 2283
_ANYNONARRAYOID = 2776
_ANYENUMOID = 3500
)
// Type represents the PostgreSQL data type of fields and parameters.
type Type int32
const (
Custom Type = 0
Boolean Type = _BOOLOID
Char Type = _CHAROID
Date Type = _DATEOID
Real Type = _FLOAT4OID
Double Type = _FLOAT8OID
Smallint Type = _INT2OID
Integer Type = _INT4OID
Bigint Type = _INT8OID
Numeric Type = _NUMERICOID
Text Type = _TEXTOID
Time Type = _TIMEOID
TimeTZ Type = _TIMETZOID
Timestamp Type = _TIMESTAMPOID
TimestampTZ Type = _TIMESTAMPTZOID
Varchar Type = _VARCHAROID
)
func (t Type) String() string {
switch t {
case Boolean:
return "Boolean"
case Char:
return "Char"
case Custom:
return "Custom"
case Date:
return "Date"
case Real:
return "Real"
case Double:
return "Double"
case Smallint:
return "Smallint"
case Integer:
return "Integer"
case Bigint:
return "Bigint"
case Numeric:
return "Numeric"
case Text:
return "Text"
case Time:
return "Time"
case TimeTZ:
return "TimeTZ"
case Timestamp:
return "Timestamp"
case TimestampTZ:
return "TimestampTZ"
case Varchar:
return "Varchar"
}
return "Unknown"
}