-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperators.go
58 lines (47 loc) · 1.26 KB
/
operators.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
package query
// Eq equates a f to v
func Eq(f string, v interface{}) string {
return f + "=" + stringifyQuote(v)
}
// NEq add != in-between f and v
func NEq(f string, v interface{}) string {
return f + "!=" + stringifyQuote(v)
}
// G add > in-between f & v
func G(f string, v interface{}) string {
return f + ">" + stringifyQuote(v)
}
// L adds < in-between f & v
func L(f string, v interface{}) string {
return f + "<" + stringifyQuote(v)
}
// GEq adds >= in-between f & v
func GEq(f string, v interface{}) string {
return f + ">=" + stringifyQuote(v)
}
// LEq adds <= in-between f & v
func LEq(f string, v interface{}) string {
return f + "<=" + stringifyQuote(v)
}
// SubQry equates f to a subquery
func SubQry(f string, v interface{ String() string }) string {
return f + "=(" + v.String() + ")"
}
// Or prepends OR to v
// this is only intended use with WhereWithMap
func Or(v string) string {
return "OR " + v
}
// IsNull adds " IS NULL" to v and returns the resutl
func IsNull(v string) string {
return v + " IS NULL"
}
// IsNotNull adds " IS NOT NULL" to v and returns the resutl
func IsNotNull(v string) string {
return v + " IS NOT NULL"
}
// And prepends AND to v
// this is only intended use with WhereWithMap
func And(v string) string {
return "AND " + v
}