2024-02-11 21:14:30 +00:00
|
|
|
package parsers
|
|
|
|
|
|
|
|
type SelectStmt struct {
|
2024-02-17 20:26:30 +00:00
|
|
|
SelectItems []SelectItem
|
|
|
|
Table Table
|
|
|
|
Filters interface{}
|
2024-02-27 19:10:03 +00:00
|
|
|
Distinct bool
|
2024-02-17 20:26:30 +00:00
|
|
|
Count int
|
|
|
|
Parameters map[string]interface{}
|
|
|
|
OrderExpressions []OrderExpression
|
2024-02-11 21:14:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Table struct {
|
|
|
|
Value string
|
|
|
|
}
|
|
|
|
|
2024-02-18 19:29:42 +00:00
|
|
|
type SelectItemType int
|
|
|
|
|
|
|
|
const (
|
|
|
|
SelectItemTypeField SelectItemType = iota
|
|
|
|
SelectItemTypeObject
|
|
|
|
SelectItemTypeArray
|
|
|
|
SelectItemTypeConstant
|
2024-02-18 20:37:09 +00:00
|
|
|
SelectItemTypeFunctionCall
|
2024-02-18 19:29:42 +00:00
|
|
|
)
|
|
|
|
|
2024-02-13 19:22:55 +00:00
|
|
|
type SelectItem struct {
|
|
|
|
Alias string
|
|
|
|
Path []string
|
|
|
|
SelectItems []SelectItem
|
|
|
|
Type SelectItemType
|
2024-02-18 19:29:42 +00:00
|
|
|
Value interface{}
|
2024-02-13 19:22:55 +00:00
|
|
|
IsTopLevel bool
|
2024-02-11 21:14:30 +00:00
|
|
|
}
|
|
|
|
|
2024-02-18 19:29:42 +00:00
|
|
|
type LogicalExpressionType int
|
|
|
|
|
|
|
|
const (
|
|
|
|
LogicalExpressionTypeOr LogicalExpressionType = iota
|
|
|
|
LogicalExpressionTypeAnd
|
|
|
|
)
|
|
|
|
|
2024-02-11 21:14:30 +00:00
|
|
|
type LogicalExpression struct {
|
|
|
|
Expressions []interface{}
|
|
|
|
Operation LogicalExpressionType
|
|
|
|
}
|
|
|
|
|
|
|
|
type ComparisonExpression struct {
|
|
|
|
Left interface{}
|
|
|
|
Right interface{}
|
|
|
|
Operation string
|
|
|
|
}
|
|
|
|
|
2024-02-18 19:29:42 +00:00
|
|
|
type ConstantType int
|
|
|
|
|
|
|
|
const (
|
|
|
|
ConstantTypeString ConstantType = iota
|
|
|
|
ConstantTypeInteger
|
|
|
|
ConstantTypeFloat
|
|
|
|
ConstantTypeBoolean
|
|
|
|
ConstantTypeParameterConstant
|
|
|
|
)
|
|
|
|
|
2024-02-11 21:14:30 +00:00
|
|
|
type Constant struct {
|
|
|
|
Type ConstantType
|
|
|
|
Value interface{}
|
|
|
|
}
|
2024-02-17 20:26:30 +00:00
|
|
|
|
2024-02-18 19:29:42 +00:00
|
|
|
type OrderDirection int
|
|
|
|
|
|
|
|
const (
|
|
|
|
OrderDirectionAsc OrderDirection = iota
|
|
|
|
OrderDirectionDesc
|
|
|
|
)
|
|
|
|
|
2024-02-17 20:26:30 +00:00
|
|
|
type OrderExpression struct {
|
|
|
|
SelectItem SelectItem
|
|
|
|
Direction OrderDirection
|
|
|
|
}
|
2024-02-18 20:37:09 +00:00
|
|
|
|
|
|
|
type FunctionCallType string
|
|
|
|
|
|
|
|
const (
|
|
|
|
FunctionCallStringEquals FunctionCallType = "StringEquals"
|
2024-02-21 18:16:52 +00:00
|
|
|
FunctionCallConcat FunctionCallType = "Concat"
|
2024-02-21 18:25:14 +00:00
|
|
|
FunctionCallContains FunctionCallType = "Contains"
|
2024-02-21 18:46:08 +00:00
|
|
|
FunctionCallEndsWith FunctionCallType = "EndsWith"
|
|
|
|
FunctionCallStartsWith FunctionCallType = "StartsWith"
|
2024-02-22 20:12:52 +00:00
|
|
|
FunctionCallIndexOf FunctionCallType = "IndexOf"
|
2024-02-22 22:11:14 +00:00
|
|
|
FunctionCallToString FunctionCallType = "ToString"
|
2024-02-24 18:00:47 +00:00
|
|
|
FunctionCallUpper FunctionCallType = "Upper"
|
|
|
|
FunctionCallLower FunctionCallType = "Lower"
|
2024-02-24 19:24:20 +00:00
|
|
|
FunctionCallLeft FunctionCallType = "Left"
|
|
|
|
FunctionCallLength FunctionCallType = "Length"
|
|
|
|
FunctionCallLTrim FunctionCallType = "LTrim"
|
|
|
|
FunctionCallReplace FunctionCallType = "Replace"
|
|
|
|
FunctionCallReplicate FunctionCallType = "Replicate"
|
|
|
|
FunctionCallReverse FunctionCallType = "Reverse"
|
|
|
|
FunctionCallRight FunctionCallType = "Right"
|
|
|
|
FunctionCallRTrim FunctionCallType = "RTrim"
|
|
|
|
FunctionCallSubstring FunctionCallType = "Substring"
|
|
|
|
FunctionCallTrim FunctionCallType = "Trim"
|
2024-02-24 20:29:33 +00:00
|
|
|
|
|
|
|
FunctionCallIsDefined FunctionCallType = "IsDefined"
|
|
|
|
FunctionCallIsArray FunctionCallType = "IsArray"
|
|
|
|
FunctionCallIsBool FunctionCallType = "IsBool"
|
|
|
|
FunctionCallIsFiniteNumber FunctionCallType = "IsFiniteNumber"
|
|
|
|
FunctionCallIsInteger FunctionCallType = "IsInteger"
|
|
|
|
FunctionCallIsNull FunctionCallType = "IsNull"
|
|
|
|
FunctionCallIsNumber FunctionCallType = "IsNumber"
|
|
|
|
FunctionCallIsObject FunctionCallType = "IsObject"
|
|
|
|
FunctionCallIsPrimitive FunctionCallType = "IsPrimitive"
|
|
|
|
FunctionCallIsString FunctionCallType = "IsString"
|
|
|
|
|
2024-02-24 22:25:51 +00:00
|
|
|
FunctionCallArrayConcat FunctionCallType = "ArrayConcat"
|
|
|
|
FunctionCallArrayLength FunctionCallType = "ArrayLength"
|
|
|
|
FunctionCallArraySlice FunctionCallType = "ArraySlice"
|
|
|
|
FunctionCallSetIntersect FunctionCallType = "SetIntersect"
|
|
|
|
FunctionCallSetUnion FunctionCallType = "SetUnion"
|
|
|
|
|
2024-02-24 20:29:33 +00:00
|
|
|
FunctionCallIn FunctionCallType = "In"
|
2024-02-18 20:37:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type FunctionCall struct {
|
|
|
|
Arguments []interface{}
|
|
|
|
Type FunctionCallType
|
|
|
|
}
|