-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcondtion_operator.go
38 lines (31 loc) · 1.14 KB
/
condtion_operator.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
package StitchingSQLGo
import (
"errors"
)
type conditionOperator string
const (
EQ conditionOperator = "=" // Equal (=) Operator
NEQ conditionOperator = "!=" // Not Equal (!= or <>) Operator
GT conditionOperator = ">" // Greater Than (>) Operator
LT conditionOperator = "<" // Less Than (<) Operator
GTEQ conditionOperator = ">=" // Greater Than or Equal To (>=) Operator
LTEQ conditionOperator = "<=" // Less Than or Equal To (<=) Operator
NGT conditionOperator = "!>" // Not Greater Than (!>) Operator
NLT conditionOperator = "!<" // Not Less Than (!<) Operator
IS conditionOperator = "is" // IS Operator
ISNot conditionOperator = "is not" // IS NOT Operator
//In conditionOperator = "in" // In Operator
//NotInt conditionOperator = "not int" // NOT IN Operator
)
var ErrorNotConditionOperator = errors.New("not a condition operator")
func (o conditionOperator) conditionOperator(s *SqlBuilder) error {
if s == nil {
return ErrorNilSQL
}
if err := validate.Var(o, "condition_operator"); err != nil {
return err
}
s.WriteByte(' ')
s.WriteString(string(o))
return nil
}