-
Notifications
You must be signed in to change notification settings - Fork 5
/
entry_expression.go
56 lines (47 loc) · 1.04 KB
/
entry_expression.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
package cypher
type EntryExpression struct {
ExpressionContainer
Key string
Value Expression
key string
notNil bool
err error
}
func EntryExpressionCreate(key string, value Expression) EntryExpression {
if value != nil && value.GetError() != nil {
return EntryExpression{
err: value.GetError(),
}
}
e := EntryExpression{
Value: value,
Key: key,
notNil: true,
}
e.key = getAddress(&e)
e.ExpressionContainer = ExpressionWrap(e)
return e
}
func (e EntryExpression) GetError() error {
return e.err
}
func (e EntryExpression) isNotNil() bool {
return e.notNil
}
func (e EntryExpression) getKey() string {
return e.key
}
func (e EntryExpression) GetExpressionType() ExpressionType {
return EXPRESSION
}
func (e EntryExpression) accept(visitor *CypherRenderer) {
visitor.enter(e)
e.Value.accept(visitor)
visitor.leave(e)
}
func (e EntryExpression) enter(renderer *CypherRenderer) {
renderer.append(EscapeIfNecessary(e.Key))
renderer.append(": ")
}
func (e EntryExpression) leave(renderer *CypherRenderer) {
}