From 3a58ee998a74de3d3be0255d1a4bc393fed43ae0 Mon Sep 17 00:00:00 2001 From: aitva Date: Sun, 14 Feb 2021 19:43:31 +0100 Subject: [PATCH] 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; --- internal/sql/ast/set_operation.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/internal/sql/ast/set_operation.go b/internal/sql/ast/set_operation.go index 3c65bd6d96..b0db93c6c9 100644 --- a/internal/sql/ast/set_operation.go +++ b/internal/sql/ast/set_operation.go @@ -1,7 +1,31 @@ package ast +import "strconv" + +const ( + None SetOperation = iota + Union + Intersect + Except +) + type SetOperation uint func (n *SetOperation) Pos() int { return 0 } + +func (n SetOperation) String() string { + switch n { + case None: + return "None" + case Union: + return "Union" + case Intersect: + return "Intersect" + case Except: + return "Except" + default: + return "Unknown(" + strconv.FormatUint(uint64(n), 10) + ")" + } +}