package function
import "github.com/influxdata/flux/internal/function"
Index ¶
- func Invoke[T any](f func(args *Arguments) (T, error), argsObj values.Object) (T, error)
- func InvokeContext[T any](f func(ctx context.Context, args *Arguments) (T, error), ctx context.Context, argsObj values.Object) (T, error)
- type Arguments
- func (a *Arguments) Get(name string) (values.Value, bool)
- func (a *Arguments) GetArray(name string, t semantic.Nature) (values.Array, bool, error)
- func (a *Arguments) GetArrayAllowEmpty(name string, t semantic.Nature) (values.Array, bool, error)
- func (a *Arguments) GetBool(name string) (bool, bool, error)
- func (a *Arguments) GetDictionary(name string) (values.Dictionary, bool, error)
- func (a *Arguments) GetDuration(name string) (flux.Duration, bool, error)
- func (a *Arguments) GetFloat(name string) (float64, bool, error)
- func (a *Arguments) GetFunction(name string) (values.Function, bool, error)
- func (a *Arguments) GetInt(name string) (int64, bool, error)
- func (a *Arguments) GetObject(name string) (values.Object, bool, error)
- func (a *Arguments) GetRequired(name string) (values.Value, error)
- func (a *Arguments) GetRequiredArray(name string, t semantic.Nature) (values.Array, error)
- func (a *Arguments) GetRequiredArrayAllowEmpty(name string, t semantic.Nature) (values.Array, error)
- func (a *Arguments) GetRequiredBool(name string) (bool, error)
- func (a *Arguments) GetRequiredDictionary(name string) (values.Dictionary, error)
- func (a *Arguments) GetRequiredDuration(name string) (flux.Duration, error)
- func (a *Arguments) GetRequiredFloat(name string) (float64, error)
- func (a *Arguments) GetRequiredFunction(name string) (values.Function, error)
- func (a *Arguments) GetRequiredInt(name string) (int64, error)
- func (a *Arguments) GetRequiredObject(name string) (values.Object, error)
- func (a *Arguments) GetRequiredString(name string) (string, error)
- func (a *Arguments) GetRequiredTime(name string) (flux.Time, error)
- func (a *Arguments) GetRequiredUInt(name string) (uint64, error)
- func (a *Arguments) GetString(name string) (string, bool, error)
- func (a *Arguments) GetTime(name string) (flux.Time, bool, error)
- func (a *Arguments) GetUInt(name string) (uint64, bool, error)
- type Builder
- func ForPackage(name string) Builder
- func (b Builder) Register(name string, fn Definition)
- func (b Builder) RegisterContext(name string, fn DefinitionContext)
- func (b Builder) RegisterSource(name string, kind plan.ProcedureKind, fn SourceDefinition)
- func (b Builder) RegisterTransformation(name string, kind plan.ProcedureKind, fn TransformationDefinition)
- type Definition
- type DefinitionContext
- type Source
- type SourceDefinition
- type Transformation
- type TransformationDefinition
Functions ¶
func Invoke ¶
Invoke calls a function and returns the result.
This is the same as InvokeContext but with a background context.
func InvokeContext ¶
func InvokeContext[T any](f func(ctx context.Context, args *Arguments) (T, error), ctx context.Context, argsObj values.Object) (T, error)
InvokeContext calls a function and returns the result.
It passes the object as the arguments to the function and returns an error if any supplied arguments are not used.
Types ¶
type Arguments ¶
type Arguments struct {
// contains filtered or unexported fields
}
Arguments provides access to the arguments of a function call. This struct can only be created by using one of the Register functions to register a function or by directly calling Invoke.
func (*Arguments) Get ¶
func (*Arguments) GetArray ¶
func (*Arguments) GetArrayAllowEmpty ¶
func (*Arguments) GetBool ¶
func (*Arguments) GetDictionary ¶
func (*Arguments) GetDuration ¶
func (*Arguments) GetFloat ¶
func (*Arguments) GetFunction ¶
func (*Arguments) GetInt ¶
func (*Arguments) GetObject ¶
func (*Arguments) GetRequired ¶
func (*Arguments) GetRequiredArray ¶
func (*Arguments) GetRequiredArrayAllowEmpty ¶
func (a *Arguments) GetRequiredArrayAllowEmpty(name string, t semantic.Nature) (values.Array, error)
GetRequiredArrayAllowEmpty ensures a required array (with element type) is present, but unlike GetRequiredArray, does not fail if the array is empty.
func (*Arguments) GetRequiredBool ¶
func (*Arguments) GetRequiredDictionary ¶
func (a *Arguments) GetRequiredDictionary(name string) (values.Dictionary, error)
func (*Arguments) GetRequiredDuration ¶
func (*Arguments) GetRequiredFloat ¶
func (*Arguments) GetRequiredFunction ¶
func (*Arguments) GetRequiredInt ¶
func (*Arguments) GetRequiredObject ¶
func (*Arguments) GetRequiredString ¶
func (*Arguments) GetRequiredTime ¶
func (*Arguments) GetRequiredUInt ¶
func (*Arguments) GetString ¶
func (*Arguments) GetTime ¶
func (*Arguments) GetUInt ¶
type Builder ¶
type Builder struct { PackagePath string }
func ForPackage ¶
func (Builder) Register ¶
func (b Builder) Register(name string, fn Definition)
func (Builder) RegisterContext ¶
func (b Builder) RegisterContext(name string, fn DefinitionContext)
func (Builder) RegisterSource ¶
func (b Builder) RegisterSource(name string, kind plan.ProcedureKind, fn SourceDefinition)
func (Builder) RegisterTransformation ¶
func (b Builder) RegisterTransformation(name string, kind plan.ProcedureKind, fn TransformationDefinition)
type Definition ¶
type DefinitionContext ¶
type Source ¶
type Source interface { plan.ProcedureSpec CreateSource(id execute.DatasetID, a execute.Administration) (execute.Source, error) }
type SourceDefinition ¶
type Transformation ¶
type Transformation interface { plan.ProcedureSpec CreateTransformation(id execute.DatasetID, a execute.Administration) (execute.Transformation, execute.Dataset, error) }
type TransformationDefinition ¶
type TransformationDefinition func(args *Arguments) (Transformation, error)
Source Files ¶
- Version
- v0.196.1 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 1 day ago –
Tools for package owners.