-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqb_model.go
75 lines (66 loc) · 1.55 KB
/
qb_model.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
package qb
import "database/sql"
type qbColType string
type QbConn struct {
db *sql.DB `json:"-"`
}
type QbDB struct {
Builder *qbBuilder `json:"-"`
Conn *QbConn `json:"-"`
Txn *QbTxn `json:"-"`
}
type QbTxn struct {
Tx *sql.Tx `json:"-"`
Builder *qbBuilder `json:"-"`
}
// QbTable is the type for operations on table schema
type QbTable struct {
ifExists uint `json:"-"`
columns []*qbColumn `json:"-"`
tableName string `json:"-"`
comment *string `json:"-"`
}
type QbOps struct {
args map[string]interface{} `json:"-"`
}
type qbBuilder struct {
whereBindings []map[string]any
startBindingsAt int
where string
table string
from string
join []string
orderBy []map[string]string
orderByRaw *string
groupBy string
having string
columns []string
union []string
isUnionAll bool
offset int64
limit int64
page int64 // support pagination
size int64 // support pagination
lockForUpdate *string
whereExists string
}
type qbColumn struct {
IsNotNull bool
IsPrimaryKey bool
IsIndex bool
IsIdxConcurrent bool
IsUnique bool
IsDrop bool
IsModify bool
IfExists uint
Includes []string
Name string
RenameTo *string
ColumnType qbColType
Default *string
ForeignKey *string
IdxName string
Comment *string
Collation *string
Operator string
}