-
Notifications
You must be signed in to change notification settings - Fork 5
/
delete.go
65 lines (54 loc) · 1.06 KB
/
delete.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
64
65
package cypher
type Delete struct {
deleteItems ExpressionList
detach bool
key string
notNil bool
err error
}
func DeleteCreate(deleteItems ExpressionList, detach bool) Delete {
if deleteItems.GetError() != nil {
return DeleteError(deleteItems.GetError())
}
d := Delete{
deleteItems: deleteItems,
detach: detach,
notNil: true,
}
d.key = getAddress(&d)
return d
}
func DeleteError(err error) Delete {
return Delete{
err: err,
}
}
func (d Delete) isDetach() bool {
return d.detach
}
func (d Delete) GetError() error {
return d.err
}
func (d Delete) accept(visitor *CypherRenderer) {
visitor.enter(d)
d.deleteItems.accept(visitor)
visitor.leave(d)
}
func (d Delete) enter(renderer *CypherRenderer) {
if d.detach {
renderer.append("DETACH ")
}
renderer.append("DELETE ")
}
func (d Delete) leave(renderer *CypherRenderer) {
renderer.append(" ")
}
func (d Delete) getKey() string {
return d.key
}
func (d Delete) isNotNil() bool {
return d.notNil
}
func (d Delete) isUpdatingClause() bool {
return true
}