functions

package
v0.0.0-...-408bc5d Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuiltinFunctions

func GetBuiltinFunctions() []types.FunctionInterface

func Materialize

func Materialize(ctx context.Context,
	scope types.Scope, stored_query types.StoredQuery) []types.Row

Types

type Aggregator

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

All aggregate functions need to embed the Aggregator. Aggregators store their state in the scope context so they can retrieve it next time they are evaluated.

func NewAggregator

func NewAggregator() Aggregator

Sets a new aggregator if possible

func (Aggregator) GetContext

func (self Aggregator) GetContext(scope types.Scope) (res types.Any, res_pres bool)

func (Aggregator) SetContext

func (self Aggregator) SetContext(scope types.Scope, value types.Any)

type FormatArgs

type FormatArgs struct {
	Format string    `vfilter:"required,field=format,doc=Format string to use"`
	Args   types.Any `vfilter:"optional,field=args,doc=An array of elements to apply into the format string."`
}

type FormatFunction

type FormatFunction struct{}

func (FormatFunction) Call

func (self FormatFunction) Call(ctx context.Context,
	scope types.Scope,
	args *ordereddict.Dict) types.Any

func (FormatFunction) Info

func (self FormatFunction) Info(scope types.Scope, type_map *types.TypeMap) *types.FunctionInfo

type GenericFunction

type GenericFunction struct {
	FunctionName string
	Doc          string
	Function     GenericFunctionInterface
	Metadata     *ordereddict.Dict
	ArgType      types.Any
}
scope.AppendPlugins(GenericListPlugin{
  PluginName: "my_plugin",
  Function: func(args types.Row) []types.Row {
       ....
  }
})

func (GenericFunction) Call

func (self GenericFunction) Call(
	ctx context.Context,
	scope types.Scope,
	args *ordereddict.Dict) types.Any

func (GenericFunction) Copy

func (GenericFunction) Info

func (self GenericFunction) Info(scope types.Scope, type_map *types.TypeMap) *types.FunctionInfo

type GenericFunctionInterface

type GenericFunctionInterface func(ctx context.Context, scope types.Scope, args *ordereddict.Dict) types.Any

Generic synchronous plugins just return all their rows at once.

type LenFunction

type LenFunction struct{}

func (LenFunction) Call

func (self LenFunction) Call(ctx context.Context,
	scope types.Scope,
	args *ordereddict.Dict) types.Any

func (LenFunction) Info

func (self LenFunction) Info(scope types.Scope, type_map *types.TypeMap) *types.FunctionInfo

type LenFunctionArgs

type LenFunctionArgs struct {
	List types.Any `vfilter:"required,field=list,doc=A list of items"`
}

Jump to

Keyboard shortcuts

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