-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqb_config.go
95 lines (85 loc) · 2.11 KB
/
qb_config.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
package qb
import "fmt"
// list all join types
const (
JoinInner = "INNER"
JoinLeft = "LEFT"
JoinRight = "RIGHT"
JoinFull = "FULL"
JoinFullOuter = "FULL OUTER"
Where = " WHERE "
And = " AND "
Or = " OR "
)
// list all sql operators
const (
SqlOperatorBetween = "BETWEEN"
SqlOperatorNotBetween = "NOT BETWEEN"
SqlOperatorIs = "IS"
SqlOperatorAnd = "AND"
SqlOperatorOr = "OR"
)
// list all invalid types
const (
SqlSpecificValueNull = "NULL"
SqlSpecificValueNotNull = "NOT NULL"
)
// math operation
const (
plusSign = "+"
minusSign = "-"
)
const (
IfExistsUndeclared = iota
IfExists
IfNotExists
)
// column types
const (
TypeSerial = "SERIAL"
TypeBigSerial = "BIGSERIAL"
TypeSmallInt = "SMALLINT"
TypeInt = "INTEGER"
TypeBigInt = "BIGINT"
TypeBoolean = "BOOLEAN"
TypeText = "TEXT"
TypeVarCharacter = "VARCHAR"
TypeChar = "CHAR"
TypeDate = "DATE"
TypeTime = "TIME"
TypeDateTime = "TIMESTAMP"
TypeDateTimeTz = "TIMESTAMPTZ"
CurrentDate = "CURRENT_DATE"
CurrentTime = "CURRENT_TIME"
CurrentDateTime = "NOW()"
TypeDblPrecision = "DOUBLE PRECISION"
TypeNumeric = "NUMERIC"
TypeTsVector = "TSVECTOR"
TypeTsQuery = "TSQUERY"
TypeJson = "JSON"
TypeJsonb = "JSONB"
TypePoint = "POINT"
TypePolygon = "POLYGON"
)
// specific for PostgreSQL driver and SQL std
const (
DefaultSchema = "public"
SemiColon = ";"
AlterTable = "ALTER TABLE "
Add = " ADD "
Modify = " ALTER "
Drop = " DROP "
Rename = " RENAME "
IfExistsExp = " IF EXISTS "
IfNotExistsExp = " IF NOT EXISTS "
Concurrently = " CONCURRENTLY "
Constraint = " CONSTRAINT "
)
var (
errTableCallBeforeOp = fmt.Errorf("sql: there was no Table() call with table name set")
errTransactionModeWithoutTx = fmt.Errorf("sql: there was no *sql.Tx object set properly")
)
var (
// Cache Execute Stmt will be stored value for the query SQL has been called before
cacheExecuteStmt string = ""
)