-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcondbuild.go
More file actions
84 lines (70 loc) · 1.77 KB
/
condbuild.go
File metadata and controls
84 lines (70 loc) · 1.77 KB
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
// A quickly mysql access component.
// Copyright 2023 The daog Authors. All rights reserved.
package daog
// build an equals condition, e.g, name = ?
func newEqCond(column string, value any) SQLCond {
return newSimpleCond("=", column, value)
}
// build not equals condition, e.g, name != ?
func newNeCond(column string, value any) SQLCond {
return newSimpleCond("!=", column, value)
}
// build greater than condition, e.g, total > ?
func newGtCond(column string, value any) SQLCond {
return newSimpleCond(">", column, value)
}
// build greater than or equals condition, e.g, total >= ?
func newGteCond(column string, value any) SQLCond {
return newSimpleCond(">=", column, value)
}
func newLtCond(column string, value any) SQLCond {
return newSimpleCond("<", column, value)
}
func newLteCond(column string, value any) SQLCond {
return newSimpleCond("<=", column, value)
}
func newInCond(column string, values []any) SQLCond {
return &inCond{
column: column,
values: values,
}
}
func newNotInCond(column string, values []any) SQLCond {
return &inCond{
column: column,
values: values,
not: true,
}
}
func newLikeCond(column string, value string, likeStyle int) SQLCond {
return &likeCond{
column, value, likeStyle,
}
}
func newNullCond(column string, not bool) SQLCond {
return &nullCond{
column, not,
}
}
func newBetweenCond(column string, start any, end any) SQLCond {
return &betweenCond{
column, start, end,
}
}
func newSimpleCond(op string, column string, value any) SQLCond {
return &simpleCond{
op, column, value,
}
}
func newScalarCond(cond string) SQLCond {
return &scalarCond{
cond: cond,
}
}
func newBitwiseAndCond(column string, mask any, target any) SQLCond {
return &bitwiseAndCond{
column: column,
mask: mask,
target: target,
}
}