Help us shape the future of Go! Take the 2026 Go Developer Survey

udf

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AggregatorRegex = regexp.MustCompile(`^<\?([LS][F_][T_])|(AG[GT])@.+`)
View Source
var ParamRegex = regexp.MustCompile(`@{([^(@{)^}]+)}`)

within UDF this does parameter extraction

Functions

func CanBeVariableName

func CanBeVariableName(s string) (bool, []string)

func FindAllUDFStrings

func FindAllUDFStrings(query string) ([][]string, error)

Extract out macros, failed with regex. TODO Sandy to find out better alternatives

Types

type AggregatorTypeOfUDF

type AggregatorTypeOfUDF int
const (
	NotAnAggregator   AggregatorTypeOfUDF = 0
	ListAggregator    AggregatorTypeOfUDF = 1
	SetAggregator     AggregatorTypeOfUDF = 2
	GenericAggregator AggregatorTypeOfUDF = 3
)

type ExprScriptInstance

type ExprScriptInstance struct {
	// contains filtered or unexported fields
}

func (*ExprScriptInstance) Body

func (exprInstance *ExprScriptInstance) Body() string

func (*ExprScriptInstance) Dialect

func (exprInstance *ExprScriptInstance) Dialect() string

func (*ExprScriptInstance) EvalFromString

func (exprInstance *ExprScriptInstance) EvalFromString(expressionString string) (interface{}, error)

func (*ExprScriptInstance) ScriptEval

func (exprInstance *ExprScriptInstance) ScriptEval(scriptEnvironment map[string]interface{}) (interface{}, error)

type JSScriptInstance

type JSScriptInstance struct {
	// contains filtered or unexported fields
}

func (*JSScriptInstance) Body

func (jsScriptInstance *JSScriptInstance) Body() string

func (*JSScriptInstance) Dialect

func (jsScriptInstance *JSScriptInstance) Dialect() string

func (*JSScriptInstance) EvalFromString

func (jsScriptInstance *JSScriptInstance) EvalFromString(expressionString string) (interface{}, error)

func (*JSScriptInstance) ScriptEval

func (jsScriptInstance *JSScriptInstance) ScriptEval(scriptEnvironment map[string]interface{}) (interface{}, error)

type ScriptInstance

type ScriptInstance interface {
	Dialect() string
	Body() string
	EvalFromString(expressionString string) (interface{}, error)
	ScriptEval(scriptEnvironment map[string]interface{}) (
		interface{},
		error,
	)
}

func GetScriptInstance

func GetScriptInstance(langString string, bodyString string) ScriptInstance

type ScriptUDF

type ScriptUDF struct {
	Id     string
	Script ScriptInstance

	UdfType TypeOfUDF
	// contains filtered or unexported fields
}

func MacroProcessor

func MacroProcessor(query string, funcNumStart int, langDialect string) (string, []ScriptUDF)

func (*ScriptUDF) AsFunction

func (s *ScriptUDF) AsFunction() sql.FunctionN

func (*ScriptUDF) Fn

func (s *ScriptUDF) Fn(args ...sql.Expression) (sql.Expression, error)

type Scriptable

type Scriptable struct {
	Meta *ScriptUDF
	// contains filtered or unexported fields
}

func (*Scriptable) Children

func (a *Scriptable) Children() []sql.Expression

func (*Scriptable) Eval

func (a *Scriptable) Eval(ctx *sql.Context, buffer sql.Row) (interface{}, error)

Eval implements AggregationExpression interface. (AggregationExpression[Expression]])

func (*Scriptable) EvalScript

func (a *Scriptable) EvalScript(ctx *sql.Context, row sql.Row, partial interface{}) (interface{}, error)

func (*Scriptable) IsNullable

func (a *Scriptable) IsNullable() bool

IsNullable implements AggregationExpression interface. (AggregationExpression[Expression]])

func (*Scriptable) Merge

func (a *Scriptable) Merge(ctx *sql.Context, buffer, partial sql.Row) error

Merge implements AggregationExpression interface. (AggregationExpression)

func (*Scriptable) NewBuffer

func (a *Scriptable) NewBuffer() sql.Row

NewBuffer implements AggregationExpression interface. (AggregationExpression)

func (*Scriptable) Resolved

func (a *Scriptable) Resolved() bool

Resolved implements AggregationExpression interface. (AggregationExpression[Expression[Resolvable]]])

func (*Scriptable) String

func (a *Scriptable) String() string

func (*Scriptable) Type

func (a *Scriptable) Type() sql.Type

Type implements AggregationExpression interface. (AggregationExpression[Expression]])

func (*Scriptable) Update

func (a *Scriptable) Update(ctx *sql.Context, buffer, row sql.Row) error

Update implements AggregationExpression interface. (AggregationExpression)

func (*Scriptable) WithChildren

func (a *Scriptable) WithChildren(children ...sql.Expression) (sql.Expression, error)

WithChildren implements the Expression interface.

type TypeOfUDF

type TypeOfUDF struct {
	IsAggregator   bool
	AggregatorType AggregatorTypeOfUDF
	Flatten        bool
	Transpose      bool
}

func AggregatorType

func AggregatorType(macroStart string) (interface{}, TypeOfUDF)

* Let's define the protocol : Here L__ -> List, no flatten, no transpose L_T -> List, no flatten, Transpose LFT -> List, Flatten, Transpose

S__ -> Set, no flatten, no transpose S_T -> Set, no flatten, Transpose SFT -> Set, Flatten, Transpose

--> AGG can not have flatten it is upto author AGG -> Aggregate, no flatten, no transpose AGT -> AGG, no flatten, Transpose

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL