forked from manhcuongbk56/cypher-go-dsl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multi_part_query.go
59 lines (49 loc) · 1.17 KB
/
multi_part_query.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
package cypher
type MultiPartQuery struct {
parts []MultiPartElement
remainder SinglePartQuery
key string
notNil bool
err error
}
func MultiPartQueryCreate(parts []MultiPartElement, remainder SinglePartQuery) MultiPartQuery {
for _, part := range parts {
if part.GetError() != nil {
return MultiPartQueryError(part.GetError())
}
}
if remainder.GetError() != nil {
return MultiPartQueryError(remainder.GetError())
}
m := MultiPartQuery{
parts: parts,
remainder: remainder,
}
m.key = getAddress(&m)
return m
}
func MultiPartQueryError(err error) MultiPartQuery {
return MultiPartQueryError(err)
}
func (m MultiPartQuery) GetError() error {
return m.err
}
func (m MultiPartQuery) accept(visitor *CypherRenderer) {
for _, part := range m.parts {
part.accept(visitor)
}
m.remainder.accept(visitor)
}
func (m MultiPartQuery) enter(renderer *CypherRenderer) {
}
func (m MultiPartQuery) leave(renderer *CypherRenderer) {
}
func (m MultiPartQuery) getKey() string {
return m.key
}
func (m MultiPartQuery) isNotNil() bool {
return m.notNil
}
func (m MultiPartQuery) doesReturnElements() bool {
return m.remainder.doesReturnElements()
}