forked from manhcuongbk56/cypher-go-dsl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
merge_action.go
57 lines (47 loc) · 970 Bytes
/
merge_action.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
package cypher
type MergeAction struct {
mergeType MERGE_TYPE
set Set
key string
notNil bool
err error
}
func MergeActionCreate(mergeType MERGE_TYPE, set Set) MergeAction {
m := MergeAction{
mergeType: mergeType,
set: set,
notNil: true,
}
m.key = getAddress(&m)
return m
}
func (m MergeAction) GetError() error {
return m.err
}
func (m MergeAction) accept(visitor *CypherRenderer) {
visitor.enter(m)
m.set.accept(visitor)
visitor.leave(m)
}
func (m MergeAction) enter(renderer *CypherRenderer) {
switch m.mergeType {
case ON_CREATE:
renderer.append("ON CREATE")
case ON_MATCH:
renderer.append("ON MATCH")
}
renderer.append(" ")
}
func (m MergeAction) leave(renderer *CypherRenderer) {
}
func (m MergeAction) getKey() string {
return m.key
}
func (m MergeAction) isNotNil() bool {
return m.notNil
}
type MERGE_TYPE string
const (
ON_CREATE MERGE_TYPE = "onCreate"
ON_MATCH = "onMatch"
)