Documentation ΒΆ
Index ΒΆ
- func AggrFunExpr(query *Query, current Map, expr sqlparser.AggrFunc) (any, error)
- func AggrFuncArgReader(query *Query, current Map, exprs sqlparser.Exprs) ([]any, error)
- func AndExpr(query *Query, current Map, expr *sqlparser.AndExpr) (bool, error)
- func ArrayFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func AsArray(data any) ([]any, error)
- func AsType[T any](value any) (*T, error)
- func AvgFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func BetweenExpr(query *Query, current Map, expr *sqlparser.BetweenExpr) (bool, error)
- func BinaryExpr(query *Query, current Map, expr *sqlparser.BinaryExpr) (*float64, error)
- func BuilFromAliasedTable(query *Query, as string, expr sqlparser.SimpleTableExpr) error
- func Build(query *Query, statement Statement) error
- func BuildColumnName(expr sqlparser.Expr) (string, string, error)
- func BuildCte(query *Query, expr *sqlparser.With) error
- func BuildFrom(query *Query, tableExpr *sqlparser.TableExpr) error
- func BuildGroup(query *Query, group *sqlparser.GroupBy) error
- func BuildJoin(query *Query, joinExpr *sqlparser.JoinTableExpr) error
- func BuildLimit(query *Query, limit *sqlparser.Limit) error
- func BuildLiteral(expr sqlparser.Expr) (sqlparser.ValType, string, error)
- func BuildOrder(query *Query, orderBy *sqlparser.OrderBy) error
- func BuildSelect(query *Query, slct *sqlparser.Select) error
- func BuildUnion(query *Query, expr *sqlparser.Union) error
- func CaseExpr(query *Query, current Map, expr *sqlparser.CaseExpr) (any, error)
- func ChangeTypeFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func Compare(slice []any, i int, j int, orderBy OrderByDefinition) (bool, error)
- func ComparisonExpr(query *Query, current Map, expr *sqlparser.ComparisonExpr) (bool, error)
- func ConcatFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func ConstantFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func CountFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func DateRangeFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func DecodeFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func DefaultKeyFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func Distinct(data any) (any, error)
- func DoubleQuotesToBackTick(str string) (string, error)
- func ElementAtFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func EncodeFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func ExecDistinct(query *Query, current []any) ([]any, error)
- func ExecGroupBy(query *Query, current []any) ([]any, error)
- func ExecHaving(query *Query, current Map) (bool, error)
- func ExecJoin(query *Query, left []any, right []any, joinExpr sqlparser.Expr, ...) ([]any, error)
- func ExecOrderBy(query *Query, current []any) ([]any, error)
- func ExecReader(data any, selector string) (any, error)
- func ExecSelect(query *Query, current []any) ([]any, error)
- func ExecWhere(query *Query, current Map) (bool, error)
- func ExistExpr(query *Query, current Map, expr *sqlparser.ExistsExpr) (bool, error)
- func Expr(query *Query, current Map, expr sqlparser.Expr, ...) (any, error)
- func FindArrayIndex(str string) ([][]int, error)
- func FirstFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func FixIdiomaticArray(input string) (string, error)
- func FunExpr(query *Query, current Map, expr *sqlparser.FuncExpr) (any, error)
- func FuncArgReader(query *Query, current Map, selectExprs sqlparser.SelectExprs) ([]any, error)
- func FuseFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func GetVarFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func Guard(n int, args []any) error
- func HashFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func IfFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func Import(functions map[string]func([]any) (any, error))
- func IsExpr(query *Query, current Map, expr *sqlparser.IsExpr) (bool, error)
- func IsImmediateFunction(name string) bool
- func LastFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func LiteralExpr(query *Query, current Map, expr *sqlparser.Literal) (any, error)
- func MaxFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func MinFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func Mix(data any) (any, error)
- func MixArray(data []any) []any
- func MixObject(data map[string]any) (map[string]any, error)
- func NotExpr(query *Query, current Map, expr *sqlparser.NotExpr) (bool, error)
- func OrExpr(query *Query, current Map, expr *sqlparser.OrExpr) (bool, error)
- func ParseArray(match string) (any, error)
- func ParseSelector(selector string) ([]any, error)
- func ProcessAlias(data []any, as string) []any
- func RaiseFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func RaiseWhenFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func ReadIndex(match string) (int, error)
- func Reader(data any, selectors []any) (any, error)
- func ReaderExecutor(data any, selectors []any) (any, error)
- func RegexComparison(left any, pattern string) (bool, error)
- func RegisterExternalFunction(name string, function func([]any) (any, error))
- func RegisterFunction(name string, function Function)
- func RegisterImmediateFunction(name string, function Function)
- func RegisterTopLevelFunction(name string, function func(any) (any, error))
- func SelectDimension(data any, dimensions []*IndexSelector) (any, error)
- func SelectMany(data []any, dimensions []*IndexSelector) (any, error)
- func SelectObject(data map[string]any, key string) any
- func SetVarFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func Sort(slice []any, orderBy OrderByDefinition) (err error)
- func SubStrExpr(query *Query, current Map, expr *sqlparser.SubstrExpr) (string, error)
- func SubqueryExpr(query *Query, current Map, expr *sqlparser.Subquery) (any, error)
- func SumFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func TimestampFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func ToFloat64(any any) (float64, error)
- func ToInt(any any) (int, error)
- func UnaryExpr(query *Query, current Map, expr *sqlparser.UnaryExpr) (any, error)
- func Unwind(data []any, depth int) []any
- func UnwindFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
- func ValueOf(query *Query, current Map, any any) (any, error)
- func ValueTupleExpr(query *Query, current Map, expr *sqlparser.ValTuple) ([]any, error)
- type ColumnName
- type CteEvaluation
- type ExpressionReaderOptions
- type Function
- type FunctionOptions
- type Fuse
- type GroupDefinition
- type HavingDefinition
- type IndexSelector
- type IndexType
- type KeepDimension
- type KeySelector
- type KeyType
- type Map
- type NeutalString
- type Ommit
- type Options
- type OrderByDefinition
- type PipeSelector
- type Query
- type QueryOption
- func CompletedCallback(callback func()) QueryOption
- func IdomaticArrays() QueryOption
- func PostgresEscapingDialect() QueryOption
- func UnReportedErrors(handler func(error)) QueryOption
- func WithConstants(constants map[string]any) QueryOption
- func WithVars(vars map[string]any) QueryOption
- func Wrapped() QueryOption
- type SQLError
- type SelectDefinition
- type Statement
- type TopLevelFunction
- type TopLevelFunctionSelector
- type WhereDefinition
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func AggrFunExpr ΒΆ
func AggrFuncArgReader ΒΆ
func ArrayFunc ΒΆ added in v1.2.5
func ArrayFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Array Function
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | * | any | array item | --------------------------------------------------
func AvgFunc ΒΆ
Calculates the average of a given numeric array
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | []any | must contain numbers only | --------------------------------------------------
func BetweenExpr ΒΆ
func BinaryExpr ΒΆ
func BuilFromAliasedTable ΒΆ
func BuilFromAliasedTable(query *Query, as string, expr sqlparser.SimpleTableExpr) error
func ChangeTypeFunc ΒΆ
func ChangeTypeFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Converts one type to another and returns an error if conversion is not possible
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | any | value to be converted | | 1 | string | type to convert value to | --------------------------------------------------
func ComparisonExpr ΒΆ
func ConcatFunc ΒΆ
func ConcatFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Concatenates a list of given values
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | All | any | can be anything | --------------------------------------------------
func ConstantFunc ΒΆ added in v1.1.4
func ConstantFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Constant
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | string | name | --------------------------------------------------
func CountFunc ΒΆ
func CountFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Finds the total number of items in a given numeric array
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | []any | must contain numbers only | --------------------------------------------------
func DateRangeFunc ΒΆ added in v1.1.2
func DateRangeFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Date Range
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | any | from | | 1 | any | to | --------------------------------------------------
func DecodeFunc ΒΆ added in v1.2.4
func DecodeFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Decode Function
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | any | data to be decoded | | 1 | string | base | --------------------------------------------------
func DefaultKeyFunc ΒΆ
func DefaultKeyFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Gets the value of the only key available in an object and returns an error if multiple keys are found
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | Map | -- | --------------------------------------------------
func DoubleQuotesToBackTick ΒΆ
func ElementAtFunc ΒΆ
func ElementAtFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Gets the given index of an array and returns nil if the array is empty
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | []any | can be any array | | 1 | int | given index | --------------------------------------------------
func EncodeFunc ΒΆ added in v1.2.4
func EncodeFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Encode Function
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | any | data to be encoded | | 1 | string | base | --------------------------------------------------
func ExistExpr ΒΆ
KNOWN ISSUE: The existing Exist function is inefficient as it does not break when it finds the first value
func FindArrayIndex ΒΆ added in v1.2.6
func FirstFunc ΒΆ
func FirstFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Gets the first item of an array and returns nil if the array is empty
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | []any | can be any array | --------------------------------------------------
func FixIdiomaticArray ΒΆ added in v1.2.6
func FuncArgReader ΒΆ
func FuseFunc ΒΆ
Fuse
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | any | result to be fused | --------------------------------------------------
func GetVarFunc ΒΆ added in v1.1.5
func GetVarFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Get Variable
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | string | name | --------------------------------------------------
func HashFunc ΒΆ added in v1.2.4
Hash Function
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | any | data to be hashed | | 1 | string | hash function | --------------------------------------------------
func IfFunc ΒΆ
If condition
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | bool | condition | | 1 | any | result when true | | 2 | any | result when false | --------------------------------------------------
func IsImmediateFunction ΒΆ
func LastFunc ΒΆ
Gets the last item of an array and returns nil if the array is empty
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | []any | can be any array | --------------------------------------------------
func LiteralExpr ΒΆ
func MaxFunc ΒΆ
Finds the maximum number in a given numeric array
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | []any | must contain numbers only | --------------------------------------------------
func MinFunc ΒΆ
Finds the minimum number in a given numeric array
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | []any | must contain numbers only | --------------------------------------------------
func ParseArray ΒΆ
func ParseSelector ΒΆ
func ProcessAlias ΒΆ
func RaiseFunc ΒΆ added in v1.1.5
func RaiseFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Raise
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | any | error | --------------------------------------------------
func RaiseWhenFunc ΒΆ added in v1.1.5
func RaiseWhenFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Raise When
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | bool | condition | | 0 | any | error | --------------------------------------------------
func RegisterFunction ΒΆ
func SelectDimension ΒΆ
func SelectDimension(data any, dimensions []*IndexSelector) (any, error)
func SelectMany ΒΆ
func SelectMany(data []any, dimensions []*IndexSelector) (any, error)
func SetVarFunc ΒΆ added in v1.1.5
func SetVarFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Set Variable
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | string | name | | 0 | any | value | --------------------------------------------------
func Sort ΒΆ
func Sort(slice []any, orderBy OrderByDefinition) (err error)
func SubStrExpr ΒΆ
func SubqueryExpr ΒΆ
func SumFunc ΒΆ
Calculates the sum of a given numeric array
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | []any | must contain numbers only | --------------------------------------------------
func TimestampFunc ΒΆ added in v1.2.4
func TimestampFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Timestamp Function
func UnwindFunc ΒΆ
func UnwindFunc(query *Query, current Map, functionOptions *FunctionOptions, args []any) (any, error)
Flattens an array by one dimension
-------------------------------------------------- | index | type | description | |-------|------------|---------------------------| | 0 | []any | can be any array | --------------------------------------------------
Types ΒΆ
type ColumnName ΒΆ
type ColumnName string
type CteEvaluation ΒΆ
type ExpressionReaderOptions ΒΆ
type ExpressionReaderOptions struct { }
type FunctionOptions ΒΆ
type FunctionOptions struct { }
type GroupDefinition ΒΆ
type HavingDefinition ΒΆ
type IndexSelector ΒΆ
type IndexSelector struct {
// contains filtered or unexported fields
}
All type definitions
func NewIndex ΒΆ
func NewIndex[T int | [2]int](value T) *IndexSelector
func ReadRange ΒΆ
func ReadRange(match string) (*IndexSelector, error)
func (*IndexSelector) GetIndex ΒΆ
func (indexSelector *IndexSelector) GetIndex() int
func (*IndexSelector) GetRange ΒΆ
func (indexSelector *IndexSelector) GetRange() []int
func (*IndexSelector) GetType ΒΆ
func (indexSelector *IndexSelector) GetType() IndexType
type Map ΒΆ
func SelectExpr ΒΆ
type NeutalString ΒΆ
type NeutalString string
type OrderByDefinition ΒΆ
type PipeSelector ΒΆ
type PipeSelector struct {
// contains filtered or unexported fields
}
All type definitions
func NewPipe ΒΆ
func NewPipe(key string, keyType string) *PipeSelector
func ParsePipe ΒΆ
func ParsePipe(match string) ([]*PipeSelector, error)
func (*PipeSelector) GetKey ΒΆ
func (pipeSelector *PipeSelector) GetKey() string
func (*PipeSelector) GetType ΒΆ
func (pipeSelector *PipeSelector) GetType() KeyType
type QueryOption ΒΆ
type QueryOption func(query *Query)
func CompletedCallback ΒΆ
func CompletedCallback(callback func()) QueryOption
func IdomaticArrays ΒΆ added in v1.2.6
func IdomaticArrays() QueryOption
func PostgresEscapingDialect ΒΆ
func PostgresEscapingDialect() QueryOption
func UnReportedErrors ΒΆ added in v1.1.0
func UnReportedErrors(handler func(error)) QueryOption
func WithConstants ΒΆ added in v1.1.4
func WithConstants(constants map[string]any) QueryOption
func WithVars ΒΆ added in v1.1.5
func WithVars(vars map[string]any) QueryOption
func Wrapped ΒΆ
func Wrapped() QueryOption
type SQLError ΒΆ
type SQLError string
const ( INVALID_CAST SQLError = SQLError("invalid cast") UNDEFINED_OPERATOR SQLError = SQLError("undefined operator") INVALID_FUNCTION SQLError = SQLError("invalid function name") INVALID_TYPE SQLError = SQLError("invalid type") UNSUPPORTED_CASE SQLError = SQLError("unsupported operation") KEY_NOT_FOUND SQLError = SQLError("key not found") EXPECTATION_FAILED SQLError = SQLError("expectation failed") )
type SelectDefinition ΒΆ
type SelectDefinition = sqlparser.SelectExprs
type TopLevelFunction ΒΆ
All type definitions