Code cleanup; Split test files

This commit is contained in:
Pijus Kamandulis
2024-02-18 21:29:42 +02:00
parent 7339e06eee
commit 2702156cb3
12 changed files with 1113 additions and 961 deletions

View File

@@ -1,37 +1,5 @@
package parsers
type LogicalExpressionType int
const (
LogicalExpressionTypeOr LogicalExpressionType = iota
LogicalExpressionTypeAnd
)
type ConstantType int
const (
ConstantTypeString ConstantType = iota
ConstantTypeInteger
ConstantTypeFloat
ConstantTypeBoolean
ConstantTypeParameterConstant
)
type SelectItemType int
const (
SelectItemTypeField SelectItemType = iota
SelectItemTypeObject
SelectItemTypeArray
)
type OrderDirection int
const (
OrderDirectionAsc OrderDirection = iota
OrderDirectionDesc
)
type SelectStmt struct {
SelectItems []SelectItem
Table Table
@@ -45,14 +13,31 @@ type Table struct {
Value string
}
type SelectItemType int
const (
SelectItemTypeField SelectItemType = iota
SelectItemTypeObject
SelectItemTypeArray
SelectItemTypeConstant
)
type SelectItem struct {
Alias string
Path []string
SelectItems []SelectItem
Type SelectItemType
Value interface{}
IsTopLevel bool
}
type LogicalExpressionType int
const (
LogicalExpressionTypeOr LogicalExpressionType = iota
LogicalExpressionTypeAnd
)
type LogicalExpression struct {
Expressions []interface{}
Operation LogicalExpressionType
@@ -64,11 +49,28 @@ type ComparisonExpression struct {
Operation string
}
type ConstantType int
const (
ConstantTypeString ConstantType = iota
ConstantTypeInteger
ConstantTypeFloat
ConstantTypeBoolean
ConstantTypeParameterConstant
)
type Constant struct {
Type ConstantType
Value interface{}
}
type OrderDirection int
const (
OrderDirectionAsc OrderDirection = iota
OrderDirectionDesc
)
type OrderExpression struct {
SelectItem SelectItem
Direction OrderDirection