Skip to content

Commit 2048e0f

Browse files
aitvakyleconroy
authored andcommitted
sql/ast: add enum values for SetOperation
This commit adds enum values for SetOperation. The values are extracted from the parser sources in pg_query_go: typedef enum SetOperation { SETOP_NONE = 0, SETOP_UNION, SETOP_INTERSECT, SETOP_EXCEPT } SetOperation;
1 parent 13b4e92 commit 2048e0f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

internal/sql/ast/set_operation.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
11
package ast
22

3+
import "strconv"
4+
5+
const (
6+
None SetOperation = iota
7+
Union
8+
Intersect
9+
Except
10+
)
11+
312
type SetOperation uint
413

514
func (n *SetOperation) Pos() int {
615
return 0
716
}
17+
18+
func (n SetOperation) String() string {
19+
switch n {
20+
case None:
21+
return "None"
22+
case Union:
23+
return "Union"
24+
case Intersect:
25+
return "Intersect"
26+
case Except:
27+
return "Except"
28+
default:
29+
return "Unknown(" + strconv.FormatUint(uint64(n), 10) + ")"
30+
}
31+
}

0 commit comments

Comments
 (0)