Documentation
¶
Index ¶
- Constants
- Variables
- func AsUnaryArgUnaryRetNodeDataFunction(f func(*OP) (*OP, error)) func(ND) (ND, error)
- func AsVariadicArgUnaryRetNodeDataFunction(f func(...*OP) (*OP, error)) func(...ND) (ND, error)
- func MapNodeDataFunction(name string, f NodeDataMapper) func(*N) (*N, error)
- func NodeAsEnviron(n *N) []string
- func NodeAsStructuredMap(n *N) map[string]any
- func ValidateOnlyVariadicOrAllUnaryRet(fs ...NFunction) error
- type ExprGenTemplate
- type GenTemplate
- type Key
- type LuaGenTemplate
- type N
- type ND
- type NDFanoutFunction
- type NDFunction
- type NDIter
- type NDMapFunction
- type NDMultiMapFunction
- type NDReduceFunction
- type NFanoutFunction
- type NFunction
- type NIter
- type NMapFunction
- type NMultiMapFunction
- type NReduceFunction
- type NodeDataMapper
- type NodeOpMapper
- type OP
- type RegexpGenTemplate
- type ShellGenTemplate
- type StringGenTemplate
- type TreeVisitor
- func (v TreeVisitor) Visit(n Node) (NFunction, error)
- func (v TreeVisitor) VisitBetweenExpr(n *BetweenExpr) (NFunction, error)
- func (v TreeVisitor) VisitBinaryOperationExpr(n *BinaryOperationExpr) (NFunction, error)
- func (v TreeVisitor) VisitCaseExpr(n *CaseExpr) (NFunction, error)
- func (TreeVisitor) VisitColumnName(n *ColumnName) *Key
- func (v TreeVisitor) VisitColumnNameExpr(n *ColumnNameExpr) (NFunction, error)
- func (v TreeVisitor) VisitExpr(n ExprNode) (NFunction, error)
- func (v TreeVisitor) VisitFieldList(n *FieldList) (NFunction, error)
- func (v TreeVisitor) VisitFuncCallExpr(n *FuncCallExpr) (NFunction, error)
- func (v TreeVisitor) VisitIsNullExpr(n *IsNullExpr) (NFunction, error)
- func (v TreeVisitor) VisitIsTruthExpr(n *IsTruthExpr) (NFunction, error)
- func (v TreeVisitor) VisitJoin(n *Join) (NFunction, error)
- func (v TreeVisitor) VisitParenthesesExpr(n *ParenthesesExpr) (NFunction, error)
- func (v TreeVisitor) VisitParrernLikeExpr(n *PatternLikeOrIlikeExpr) (NFunction, error)
- func (v TreeVisitor) VisitPatternInExpr(n *PatternInExpr) (NFunction, error)
- func (v TreeVisitor) VisitPatternRegexpExpr(n *PatternRegexpExpr) (NFunction, error)
- func (v TreeVisitor) VisitSelectField(n *SelectField) (NFunction, error)
- func (v TreeVisitor) VisitSelectStmt(n *SelectStmt) (NFunction, error)
- func (v TreeVisitor) VisitTableRefsClause(n *TableRefsClause) (NFunction, error)
- func (v TreeVisitor) VisitTableSource(n *TableSource) (NFunction, error)
- func (v TreeVisitor) VisitUnaryOperationExpr(n *UnaryOperationExpr) (NFunction, error)
- func (v TreeVisitor) VisitValueExpr(n ValueExpr) (NFunction, error)
- func (v TreeVisitor) VisitValueExprDriver(n *driver.ValueExpr) (ND, error)
- func (v TreeVisitor) VisitWhere(n ExprNode) (NFunction, error)
- type ValueContainer
Constants ¶
View Source
const ( FuncGrep = "grep" FuncTmpl = "tmpl" FuncSh = "sh" FuncLua = "lua" FuncExpr = "expr" FuncToInt = "to_int" FuncToFloat = "to_float" FuncToBool = "to_bool" FuncToString = "to_string" FuncToTime = "to_time" FuncToDuration = "to_duration" FuncLeast = "least" FuncGreatest = "greatest" FuncCoalesce = "coalesce" FuncIf = "if" FuncIfNull = "ifnull" FuncNullIf = "nullif" FuncAbs = "abs" FuncSqrt = "sqrt" FuncDegrees = "degrees" FuncRadians = "radians" FuncAcos = "acos" FuncAsin = "asin" FuncAtan = "atan" FuncCos = "cos" FuncSin = "sin" FuncTan = "tan" FuncCot = "cot" FuncLn = "ln" FuncLog2 = "log2" FuncLog10 = "log10" FuncExp = "exp" FuncCeil = "ceil" FuncFloor = "floor" FuncRound = "round" FuncAtan2 = "atan2" FuncPow = "pow" FuncE = "e" FuncPi = "pi" FuncRand = "rand" FuncLen = "len" FuncSize = "size" FuncRegexpInstr = "regexp_instr" FuncRegexpSubstr = "regexp_substr" FuncRegexpReplace = "regexp_replace" FuncRegexpLike = "regexp_like" FuncFormat = "format" FuncLower = "lower" FuncUpper = "upper" FuncSha2 = "sha2" FuncConcatWs = "concat_ws" FuncInstr = "instr" FuncSubstr = "substr" FuncSubstrIndex = "substr_index" FuncReplace = "replace" FuncTrim = "trim" FuncTimeFormat = "timeformat" FuncYear = "year" FuncMonth = "month" FuncDay = "day" FuncHour = "hour" FuncMinute = "minute" FuncSecond = "second" FuncDayOfWeek = "dayofweek" FuncDayOfYear = "dayofyear" FuncNewTime = "newtime" FuncSleep = "sleep" FuncNow = "now" FuncDir = "dir" FuncBasename = "basename" FuncExtension = "extension" FuncAbsPath = "abspath" FuncRelPath = "relpath" FuncInverse = "inverse" FuncEnvOr = "envor" FuncEnv = "env" )
View Source
const ( InputTableName = "input" TableKeySeparator = "___" NodeValueKey = "___value___" )
View Source
const (
FuncArgMaxLen = 100
)
Variables ¶
View Source
var ( ErrIgnore = errors.New("Ignore") ErrNotImplmented = errors.New("NotImplemented") ErrInvalidTree = errors.New("InvalidTree") ErrInvalidKey = errors.New("InvalidKey") ErrInvalidValue = errors.New("InvalidValue") ErrInvalidArgument = errors.New("InvalidArgument") ErrInvalidFunctionArity = errors.New("InvalidFunctionArity") ErrParseGenResult = errors.New("ParseGenResult") ErrGenTemplate = errors.New("GenTemplate") )
Functions ¶
func MapNodeDataFunction ¶
func MapNodeDataFunction(name string, f NodeDataMapper) func(*N) (*N, error)
func NodeAsEnviron ¶
func NodeAsStructuredMap ¶
Types ¶
type ExprGenTemplate ¶
type ExprGenTemplate struct {
// contains filtered or unexported fields
}
func NewExprGenTemplate ¶
func NewExprGenTemplate(expr string) *ExprGenTemplate
type GenTemplate ¶
type GenTemplate interface {
// Generate attributes for new nodes from an existing node.
// The function must return a string in one of the following formats:
//
// - An array of JSON objects
// - A single JSON object
// - An "equal pair" list
//
// The "equal pair" format is as follows:
//
// key1=value11,key2=value12,...
// key1=value21,key2=value22,...
// ...
//
// This is equivalent to the following JSON structure:
//
// [
// {"key1":"value11","key2":"value12",...},
// {"key1":"value21","key2":"value22",...},
// ...
// ]
//
// Each JSON object corresponds to a single node.
// Note that nodes are not required to have the same set of keys.
Generate(ctx context.Context, n *N) ([]byte, error)
}
type LuaGenTemplate ¶
type LuaGenTemplate struct {
// contains filtered or unexported fields
}
func NewLuaGenTemplate ¶
func NewLuaGenTemplate(script, entrypoint string) *LuaGenTemplate
type NDFanoutFunction ¶
type NDFanoutFunction = iterx.FanoutFunction[ND]
type NDFunction ¶
type NDMapFunction ¶
type NDMapFunction = iterx.MapFunction[ND]
type NDMultiMapFunction ¶
type NDMultiMapFunction = iterx.MultiMapFunction[ND]
type NDReduceFunction ¶
type NDReduceFunction = iterx.ReduceFunction[ND]
type NFanoutFunction ¶
type NFanoutFunction = iterx.FanoutFunction[*N]
type NMapFunction ¶
type NMapFunction = iterx.MapFunction[*N]
type NMultiMapFunction ¶
type NMultiMapFunction = iterx.MultiMapFunction[*N]
type NReduceFunction ¶
type NReduceFunction = iterx.ReduceFunction[*N]
type NodeDataMapper ¶
func NodeOpMapperAsData ¶
func NodeOpMapperAsData(f NodeOpMapper) NodeDataMapper
type NodeOpMapper ¶
func NodeDataMapperAsOP ¶
func NodeDataMapperAsOP(f NodeDataMapper) NodeOpMapper
type RegexpGenTemplate ¶
type RegexpGenTemplate struct {
// contains filtered or unexported fields
}
func NewRegexpGenTemplate ¶
func NewRegexpGenTemplate(expr, tmpl string) *RegexpGenTemplate
type ShellGenTemplate ¶
type ShellGenTemplate struct {
// contains filtered or unexported fields
}
func NewShellGenTemplate ¶
func NewShellGenTemplate(text string) *ShellGenTemplate
type StringGenTemplate ¶
type StringGenTemplate struct {
// contains filtered or unexported fields
}
### envor os.Getenv with default value, like 'envor "KEY" "default_value"'.
func NewStringGenTemplate ¶
func NewStringGenTemplate(text string) *StringGenTemplate
type TreeVisitor ¶
type TreeVisitor struct {
// contains filtered or unexported fields
}
func NewTreeVisitor ¶
func NewTreeVisitor(ctx context.Context) *TreeVisitor
func (TreeVisitor) Visit ¶
func (v TreeVisitor) Visit(n Node) (NFunction, error)
func (TreeVisitor) VisitBetweenExpr ¶
func (v TreeVisitor) VisitBetweenExpr(n *BetweenExpr) (NFunction, error)
func (TreeVisitor) VisitBinaryOperationExpr ¶
func (v TreeVisitor) VisitBinaryOperationExpr(n *BinaryOperationExpr) (NFunction, error)
func (TreeVisitor) VisitCaseExpr ¶
func (v TreeVisitor) VisitCaseExpr(n *CaseExpr) (NFunction, error)
func (TreeVisitor) VisitColumnName ¶
func (TreeVisitor) VisitColumnName(n *ColumnName) *Key
func (TreeVisitor) VisitColumnNameExpr ¶
func (v TreeVisitor) VisitColumnNameExpr(n *ColumnNameExpr) (NFunction, error)
func (TreeVisitor) VisitExpr ¶
func (v TreeVisitor) VisitExpr(n ExprNode) (NFunction, error)
func (TreeVisitor) VisitFieldList ¶
func (v TreeVisitor) VisitFieldList(n *FieldList) (NFunction, error)
func (TreeVisitor) VisitFuncCallExpr ¶
func (v TreeVisitor) VisitFuncCallExpr(n *FuncCallExpr) (NFunction, error)
Function calls except aggregations.
func (TreeVisitor) VisitIsNullExpr ¶
func (v TreeVisitor) VisitIsNullExpr(n *IsNullExpr) (NFunction, error)
IS NULL, IS NOT NULL
func (TreeVisitor) VisitIsTruthExpr ¶
func (v TreeVisitor) VisitIsTruthExpr(n *IsTruthExpr) (NFunction, error)
IS TRUE, IS FALSE
func (TreeVisitor) VisitJoin ¶
func (v TreeVisitor) VisitJoin(n *Join) (NFunction, error)
func (TreeVisitor) VisitParenthesesExpr ¶
func (v TreeVisitor) VisitParenthesesExpr(n *ParenthesesExpr) (NFunction, error)
(EXPR)
func (TreeVisitor) VisitParrernLikeExpr ¶
func (v TreeVisitor) VisitParrernLikeExpr(n *PatternLikeOrIlikeExpr) (NFunction, error)
LIKE
func (TreeVisitor) VisitPatternInExpr ¶
func (v TreeVisitor) VisitPatternInExpr(n *PatternInExpr) (NFunction, error)
BETWEEN ... AND ...
func (TreeVisitor) VisitPatternRegexpExpr ¶
func (v TreeVisitor) VisitPatternRegexpExpr(n *PatternRegexpExpr) (NFunction, error)
REGEXP
func (TreeVisitor) VisitSelectField ¶
func (v TreeVisitor) VisitSelectField(n *SelectField) (NFunction, error)
func (TreeVisitor) VisitSelectStmt ¶
func (v TreeVisitor) VisitSelectStmt(n *SelectStmt) (NFunction, error)
func (TreeVisitor) VisitTableRefsClause ¶
func (v TreeVisitor) VisitTableRefsClause(n *TableRefsClause) (NFunction, error)
func (TreeVisitor) VisitTableSource ¶
func (v TreeVisitor) VisitTableSource(n *TableSource) (NFunction, error)
func (TreeVisitor) VisitUnaryOperationExpr ¶
func (v TreeVisitor) VisitUnaryOperationExpr(n *UnaryOperationExpr) (NFunction, error)
func (TreeVisitor) VisitValueExpr ¶
func (v TreeVisitor) VisitValueExpr(n ValueExpr) (NFunction, error)
func (TreeVisitor) VisitValueExprDriver ¶
func (v TreeVisitor) VisitValueExprDriver(n *driver.ValueExpr) (ND, error)
func (TreeVisitor) VisitWhere ¶
func (v TreeVisitor) VisitWhere(n ExprNode) (NFunction, error)
type ValueContainer ¶
type ValueContainer struct {
*N
}
A single value as a Node.
func AsValueContainer ¶
func AsValueContainer(n *N) *ValueContainer
func (*ValueContainer) GetContainerValue ¶
func (c *ValueContainer) GetContainerValue() (ND, bool)
func (*ValueContainer) GetFirstValue ¶
func (c *ValueContainer) GetFirstValue() (string, ND, bool)
GetFirstValue unwraps the value. Returns the key, value and exists value or not.
func (*ValueContainer) SetContainerValue ¶
func (c *ValueContainer) SetContainerValue(v ND)
Click to show internal directories.
Click to hide internal directories.