-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathnested_expression.go
More file actions
58 lines (48 loc) · 1.16 KB
/
nested_expression.go
File metadata and controls
58 lines (48 loc) · 1.16 KB
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
package cypher
type NestedExpression struct {
ExpressionContainer
delegate Expression
key string
notNil bool
err error
}
func NestedExpressionCreate(delegate Expression) NestedExpression {
if delegate != nil && delegate.GetError() != nil {
return NestedExpressionError(delegate.GetError())
}
nested := NestedExpression{
delegate: delegate,
notNil: true,
}
nested.key = getAddress(&nested)
nested.ExpressionContainer = ExpressionWrap(nested)
return nested
}
func NestedExpressionError(err error) NestedExpression {
return NestedExpression{
err: err,
}
}
func (n NestedExpression) GetError() error {
return n.err
}
func (n NestedExpression) accept(visitor *CypherRenderer) {
visitor.enter(n)
NameOrExpression(n.delegate).accept(visitor)
visitor.leave(n)
}
func (n NestedExpression) enter(renderer *CypherRenderer) {
renderer.append("(")
}
func (n NestedExpression) leave(renderer *CypherRenderer) {
renderer.append(")")
}
func (n NestedExpression) getKey() string {
return n.key
}
func (n NestedExpression) isNotNil() bool {
return n.notNil
}
func (n NestedExpression) GetExpressionType() ExpressionType {
return "NestedExpression"
}