function

package
v0.194.5 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Invoke added in v0.181.0

func Invoke[T any](f func(args *Arguments) (T, error), argsObj values.Object) (T, error)

Invoke calls a function and returns the result.

This is the same as InvokeContext but with a background context.

func InvokeContext added in v0.181.0

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 added in v0.181.0

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 added in v0.181.0

func (a *Arguments) Get(name string) (values.Value, bool)

func (*Arguments) GetArray added in v0.181.0

func (a *Arguments) GetArray(name string, t semantic.Nature) (values.Array, bool, error)

func (*Arguments) GetArrayAllowEmpty added in v0.181.0

func (a *Arguments) GetArrayAllowEmpty(name string, t semantic.Nature) (values.Array, bool, error)

func (*Arguments) GetBool added in v0.181.0

func (a *Arguments) GetBool(name string) (bool, bool, error)

func (*Arguments) GetDictionary added in v0.181.0

func (a *Arguments) GetDictionary(name string) (values.Dictionary, bool, error)

func (*Arguments) GetDuration added in v0.181.0

func (a *Arguments) GetDuration(name string) (flux.Duration, bool, error)

func (*Arguments) GetFloat added in v0.181.0

func (a *Arguments) GetFloat(name string) (float64, bool, error)

func (*Arguments) GetFunction added in v0.181.0

func (a *Arguments) GetFunction(name string) (values.Function, bool, error)

func (*Arguments) GetInt added in v0.181.0

func (a *Arguments) GetInt(name string) (int64, bool, error)

func (*Arguments) GetObject added in v0.181.0

func (a *Arguments) GetObject(name string) (values.Object, bool, error)

func (*Arguments) GetRequired added in v0.181.0

func (a *Arguments) GetRequired(name string) (values.Value, error)

func (*Arguments) GetRequiredArray added in v0.181.0

func (a *Arguments) GetRequiredArray(name string, t semantic.Nature) (values.Array, error)

func (*Arguments) GetRequiredArrayAllowEmpty added in v0.181.0

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 added in v0.181.0

func (a *Arguments) GetRequiredBool(name string) (bool, error)

func (*Arguments) GetRequiredDictionary added in v0.181.0

func (a *Arguments) GetRequiredDictionary(name string) (values.Dictionary, error)

func (*Arguments) GetRequiredDuration added in v0.181.0

func (a *Arguments) GetRequiredDuration(name string) (flux.Duration, error)

func (*Arguments) GetRequiredFloat added in v0.181.0

func (a *Arguments) GetRequiredFloat(name string) (float64, error)

func (*Arguments) GetRequiredFunction added in v0.181.0

func (a *Arguments) GetRequiredFunction(name string) (values.Function, error)

func (*Arguments) GetRequiredInt added in v0.181.0

func (a *Arguments) GetRequiredInt(name string) (int64, error)

func (*Arguments) GetRequiredObject added in v0.181.0

func (a *Arguments) GetRequiredObject(name string) (values.Object, error)

func (*Arguments) GetRequiredString added in v0.181.0

func (a *Arguments) GetRequiredString(name string) (string, error)

func (*Arguments) GetRequiredTime added in v0.181.0

func (a *Arguments) GetRequiredTime(name string) (flux.Time, error)

func (*Arguments) GetRequiredUInt added in v0.181.0

func (a *Arguments) GetRequiredUInt(name string) (uint64, error)

func (*Arguments) GetString added in v0.181.0

func (a *Arguments) GetString(name string) (string, bool, error)

func (*Arguments) GetTime added in v0.181.0

func (a *Arguments) GetTime(name string) (flux.Time, bool, error)

func (*Arguments) GetUInt added in v0.181.0

func (a *Arguments) GetUInt(name string) (uint64, bool, error)

type Builder

type Builder struct {
	PackagePath string
}

func ForPackage

func ForPackage(name string) Builder

func (Builder) Register

func (b Builder) Register(name string, fn Definition)

func (Builder) RegisterContext added in v0.167.0

func (b Builder) RegisterContext(name string, fn DefinitionContext)

func (Builder) RegisterSource added in v0.182.0

func (b Builder) RegisterSource(name string, kind plan.ProcedureKind, fn SourceDefinition)

func (Builder) RegisterTransformation added in v0.182.0

func (b Builder) RegisterTransformation(name string, kind plan.ProcedureKind, fn TransformationDefinition)

type Definition

type Definition func(args *Arguments) (values.Value, error)

type DefinitionContext added in v0.167.0

type DefinitionContext func(ctx context.Context, args *Arguments) (values.Value, error)

type Source added in v0.182.0

type Source interface {
	plan.ProcedureSpec
	CreateSource(id execute.DatasetID, a execute.Administration) (execute.Source, error)
}

type SourceDefinition added in v0.182.0

type SourceDefinition func(args *Arguments) (Source, error)

type Transformation added in v0.182.0

type Transformation interface {
	plan.ProcedureSpec
	CreateTransformation(id execute.DatasetID, a execute.Administration) (execute.Transformation, execute.Dataset, error)
}

type TransformationDefinition added in v0.182.0

type TransformationDefinition func(args *Arguments) (Transformation, error)

Jump to

Keyboard shortcuts

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