forked from manhcuongbk56/cypher-go-dsl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constant_condition.go
63 lines (49 loc) · 1.32 KB
/
constant_condition.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
package cypher
type ConstantCondition struct {
ConditionContainer
value BooleanLiteral
key string
notNil bool
err error
}
var TRUE_CONDITION = ConstantConditionCreate(TRUE)
var FALSE_CONDITION = ConstantConditionCreate(FALSE)
func ConstantConditionCreate(value BooleanLiteral) ConstantCondition {
if value.GetError() != nil {
return ConstantConditionError(value.GetError())
}
constantCondition := ConstantCondition{
value: value,
notNil: true,
}
constantCondition.key = getAddress(&constantCondition)
constantCondition.ConditionContainer = ConditionWrap(constantCondition)
return constantCondition
}
func ConstantConditionError(err error) ConstantCondition {
return ConstantCondition{err: err}
}
func (c ConstantCondition) GetError() error {
return c.err
}
func (c ConstantCondition) accept(visitor *CypherRenderer) {
visitor.enter(c)
c.value.accept(visitor)
visitor.leave(c)
}
func (c ConstantCondition) enter(renderer *CypherRenderer) {
}
func (c ConstantCondition) leave(renderer *CypherRenderer) {
}
func (c ConstantCondition) getKey() string {
return c.key
}
func (c ConstantCondition) isNotNil() bool {
return c.notNil
}
func (c ConstantCondition) GetExpressionType() ExpressionType {
return "ConstantCondition"
}
func (c ConstantCondition) getConditionType() string {
return "ConstantCondition"
}