-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmerge_statement.go
More file actions
101 lines (79 loc) · 3.16 KB
/
merge_statement.go
File metadata and controls
101 lines (79 loc) · 3.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package ast
// MergeStatement represents a MERGE statement
type MergeStatement struct {
MergeSpecification *MergeSpecification
}
func (s *MergeStatement) node() {}
func (s *MergeStatement) statement() {}
// MergeSpecification represents the specification of a MERGE statement
type MergeSpecification struct {
Target TableReference // The target table
TableAlias *Identifier // Alias for the USING clause table reference (e.g., AS src)
TableReference TableReference // The USING clause table reference
SearchCondition BooleanExpression // The ON clause condition (may be GraphMatchPredicate)
ActionClauses []*MergeActionClause
OutputClause *OutputClause
}
func (s *MergeSpecification) node() {}
// MergeActionClause represents a WHEN clause in a MERGE statement
type MergeActionClause struct {
Condition string // "Matched", "NotMatched", "NotMatchedBySource", "NotMatchedByTarget"
SearchCondition BooleanExpression
Action MergeAction
}
func (c *MergeActionClause) node() {}
// MergeAction is an interface for merge actions
type MergeAction interface {
Node
mergeAction()
}
// DeleteMergeAction represents DELETE in a MERGE WHEN clause
type DeleteMergeAction struct{}
func (a *DeleteMergeAction) node() {}
func (a *DeleteMergeAction) mergeAction() {}
// UpdateMergeAction represents UPDATE SET in a MERGE WHEN clause
type UpdateMergeAction struct {
SetClauses []SetClause
}
func (a *UpdateMergeAction) node() {}
func (a *UpdateMergeAction) mergeAction() {}
// InsertMergeAction represents INSERT in a MERGE WHEN clause
type InsertMergeAction struct {
Columns []*ColumnReferenceExpression
Values []ScalarExpression
}
func (a *InsertMergeAction) node() {}
func (a *InsertMergeAction) mergeAction() {}
// JoinParenthesisTableReference represents a parenthesized join table reference
type JoinParenthesisTableReference struct {
Join TableReference // The join inside the parenthesis
}
func (j *JoinParenthesisTableReference) node() {}
func (j *JoinParenthesisTableReference) tableReference() {}
// GraphMatchPredicate represents MATCH predicate in graph queries
type GraphMatchPredicate struct {
Expression GraphMatchExpression
}
func (g *GraphMatchPredicate) node() {}
func (g *GraphMatchPredicate) booleanExpression() {}
// GraphMatchExpression is an interface for graph match expressions
type GraphMatchExpression interface {
Node
graphMatchExpression()
}
// GraphMatchCompositeExpression represents a graph pattern like (Node1-(Edge)->Node2)
type GraphMatchCompositeExpression struct {
LeftNode *GraphMatchNodeExpression
Edge *Identifier
RightNode *GraphMatchNodeExpression
ArrowOnRight bool // true if arrow is -> (left to right), false if <- (right to left)
}
func (g *GraphMatchCompositeExpression) node() {}
func (g *GraphMatchCompositeExpression) graphMatchExpression() {}
// GraphMatchNodeExpression represents a node in a graph match pattern
type GraphMatchNodeExpression struct {
Node *Identifier
UsesLastNode bool
}
func (g *GraphMatchNodeExpression) node() {}
func (g *GraphMatchNodeExpression) graphMatchExpression() {}