cosmium/parsers/models.go

98 lines
1.9 KiB
Go
Raw Normal View History

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{}
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
)
type SelectItem struct {
Alias string
Path []string
SelectItems []SelectItem
Type SelectItemType
2024-02-18 19:29:42 +00:00
Value interface{}
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-18 22:08:51 +00:00
FunctionCallIsDefined FunctionCallType = "IsDefined"
2024-02-21 18:16:52 +00:00
FunctionCallConcat FunctionCallType = "Concat"
2024-02-21 18:25:14 +00:00
FunctionCallContains FunctionCallType = "Contains"
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 15:26:16 +00:00
FunctionCallIn FunctionCallType = "In"
2024-02-18 20:37:09 +00:00
)
type FunctionCall struct {
Arguments []interface{}
Type FunctionCallType
}