Documentation ¶
Index ¶
- Variables
- type AggAvg
- type AggAvgData
- type AggCount
- type AggCountData
- type AggCountDistinct
- type AggCountDistinctData
- type AggFloatData
- type AggGroup
- type AggMax
- type AggMin
- type AggProcessing
- type AggSum
- type E
- type ExpressionBuilder
- func (e *ExpressionBuilder) AllowAggregates()
- func (e *ExpressionBuilder) Dup() *ExpressionBuilder
- func (e *ExpressionBuilder) ExprToE(tree sqlparser.Expr) (E, error)
- func (e *ExpressionBuilder) MakeAgg(fe *sqlparser.FuncExpr, ag func(E) AggProcessing) (E, error)
- func (e *ExpressionBuilder) MakeBool(tree sqlparser.BoolExpr) (E, error)
- func (e *ExpressionBuilder) MakeCompare(tree *sqlparser.ComparisonExpr) (E, error)
- func (e *ExpressionBuilder) MakeFunc(fe *sqlparser.FuncExpr) (E, error)
- func (e *ExpressionBuilder) MakeSlice(t []sqlparser.ValExpr) (E, error)
- func (e *ExpressionBuilder) MakeVal(tree sqlparser.ValExpr) (E, error)
- func (e *ExpressionBuilder) NewAggGroup() *AggGroup
- func (e *ExpressionBuilder) Setup(t base.SrcTables, Obj map[string]interface{}, sqFunc SubqueryRunner) *ExpressionBuilder
- func (e *ExpressionBuilder) SubqueryToList(t *sqlparser.Subquery) (E, error)
- type SubqueryRunner
Constants ¶
This section is empty.
Variables ¶
var DefaultBuilder = &ExpressionBuilder{ Expr: func(map[string]interface{}) (interface{}, error) { return true, nil }, }
DefaultBuilder returns true & OK because it is the default WHERE & HAVING
var FuncMap = map[string]interface{}{ "char_length": func(s string) int { return utf8.RuneCount([]byte(s)) }, "lower": strings.ToLower, "upper": strings.ToUpper, "octet_length": func(s string) int { return len([]byte(s)) }, "position": stringFuncFind, "find": stringFuncFind, "textpos": stringFuncFind, "index": stringFuncFind, "substr": stringFuncSubstr, "substring": stringFuncSubstr, "abs": math.Abs, "pow": math.Pow, "minOf": math.Min, "maxOf": math.Max, "floor": math.Floor, "ceil": math.Ceil, }
Functions ¶
This section is empty.
Types ¶
type AggAvgData ¶
type AggCountData ¶
type AggCountData struct {
// contains filtered or unexported fields
}
type AggCountDistinct ¶
type AggCountDistinct struct{ E }
func (*AggCountDistinct) Incr ¶
func (a *AggCountDistinct) Incr(row map[string]interface{}, vp interface{}) error
func (*AggCountDistinct) Initial ¶
func (a *AggCountDistinct) Initial() interface{}
func (*AggCountDistinct) Value ¶
func (a *AggCountDistinct) Value(vp interface{}) (res interface{})
type AggCountDistinctData ¶
type AggCountDistinctData struct {
// contains filtered or unexported fields
}
type AggFloatData ¶
type AggFloatData struct {
// contains filtered or unexported fields
}
type AggGroup ¶
type AggGroup struct { *ExpressionBuilder TokenRow map[string]interface{} // contains filtered or unexported fields }
func (*AggGroup) ConsumeRow ¶
ConsumeRow eats a row and runs aggregate incrementers on it
func (*AggGroup) RenderExpression ¶
RenderExpression will get a result. Even works with non-aggregate expressions
type AggProcessing ¶
type ExpressionBuilder ¶
type ExpressionBuilder struct { base.SrcTables AggProcessing *[]AggProcessing Expr E // Expression storage relating to this builder Obj map[string]interface{} SubqueryRunner }
ExpressionBuilder builds expressions with regular functions
func (*ExpressionBuilder) AllowAggregates ¶
func (e *ExpressionBuilder) AllowAggregates()
AllowAggregates Indicate if this builder should enable aggregate processing.
func (*ExpressionBuilder) Dup ¶
func (e *ExpressionBuilder) Dup() *ExpressionBuilder
Dup -licate an expressionbuilder that's correct (but you want agg)
func (*ExpressionBuilder) ExprToE ¶
func (e *ExpressionBuilder) ExprToE(tree sqlparser.Expr) (E, error)
ExprToE converts a parsed expression into a runnable one.
func (*ExpressionBuilder) MakeAgg ¶
func (e *ExpressionBuilder) MakeAgg(fe *sqlparser.FuncExpr, ag func(E) AggProcessing) (E, error)
Plan: SELECT & HAVING expressionbuilders should set e.AggProcessing = []expr.AggProcessing{} to allow aggregates. for everything GROUPBY touches, run: for new groupby: DEEP_COPY e.AggProcessing
for _, apCopy := range groupByThingy.AggProcessingCopies { err := apCopy.Incr(row) ...
Then delete the row (if not first). When input stops, per group: replace the e.AggProcessing and run expression
func (*ExpressionBuilder) MakeBool ¶
func (e *ExpressionBuilder) MakeBool(tree sqlparser.BoolExpr) (E, error)
func (*ExpressionBuilder) MakeCompare ¶
func (e *ExpressionBuilder) MakeCompare(tree *sqlparser.ComparisonExpr) (E, error)
MakeCompare compares all types
func (*ExpressionBuilder) MakeFunc ¶
func (e *ExpressionBuilder) MakeFunc(fe *sqlparser.FuncExpr) (E, error)
func (*ExpressionBuilder) MakeSlice ¶
func (e *ExpressionBuilder) MakeSlice(t []sqlparser.ValExpr) (E, error)
func (*ExpressionBuilder) MakeVal ¶
func (e *ExpressionBuilder) MakeVal(tree sqlparser.ValExpr) (E, error)
MakeVal renders an SQL value into a function-consumable thing
func (*ExpressionBuilder) NewAggGroup ¶
func (e *ExpressionBuilder) NewAggGroup() *AggGroup
NewAggGroup sets-up GroupBy to easily manage aggregate expressions
func (*ExpressionBuilder) Setup ¶
func (e *ExpressionBuilder) Setup( t base.SrcTables, Obj map[string]interface{}, sqFunc SubqueryRunner) *ExpressionBuilder
func (*ExpressionBuilder) SubqueryToList ¶
func (e *ExpressionBuilder) SubqueryToList(t *sqlparser.Subquery) (E, error)
type SubqueryRunner ¶
type SubqueryRunner func(selStmt sqlparser.SelectStatement, src base.Obj, ctx context.Context) (chOut chan base.GetChanError, colCh chan []string)