Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FunctionDataFromContext ¶
func UnpackArgs ¶
UnpackArgs unpacks the positional and keyword arguments into the supplied parameter variables. pairs is an alternating list of names and pointers to variables.
If the parameter name ends with "?", it is optional. If the parameter name ends with "=", it must be supplied in kwargs. If the parameter name starts with "**", the destination will accept all kwargs as a dict. If the parameter name starts with "*", the destination will aceppt all args as a list.
Example:
func SomeFunc(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error) { var ( x int y string args []int ) if err := UnpackArgs(args, kwargs, "x", &x, "y=", &y, "*args", &args); err != nil { return err } ... }
(this function is heavily inspired by https://pkg.go.dev/go.starlark.net/starlark#UnpackArgs, it essentially does the same thing, but on autokitteh level and not starlark)
TODO: varargs.
Types ¶
type FuncOpt ¶
type FuncOpt func(*funcOpts) error
func WithFlag ¶
func WithFlag(flag sdktypes.FunctionFlag) FuncOpt
func WithFlags ¶
func WithFlags(flags ...sdktypes.FunctionFlag) FuncOpt
func WithFuncDesc ¶
func WithFuncDoc ¶
type Module ¶
type Optfn ¶
type Optfn func(*moduleOpts) error
func ExportFunction ¶
func ExportFunction(name string, fn sdkexecutor.Function, fopts ...FuncOpt) Optfn
func ExportValue ¶
func WithConfigAsData ¶
func WithConfigAsData() Optfn