Documentation
¶
Overview ¶
Package invocation provides a mechanism for defining and invoking functions in a yamlpath expression.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownFunc = errors.New("unknown function") ErrBadFunc = errors.New("bad function") ErrBadArgument = errors.New("bad argument") )
ErrUnknownFunc is an error that is returned when a function is not found in the function table.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry is a function entry in the function table.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is an invocation table that maps function names to function definitions.
func (*Table) Add ¶
Add adds a function to the table. By default, functions have an arity of zero -- meaning no arguments may be provided to them. To set the arity of the function, use the Entry.SetArity method on the returned Entry.
func (*Table) AddFunc ¶
AddFunc is a convenience method for adding a normal Go function to the function table. This will implicitly convert the function to a [funcEntry] and set the arity of the function based on the number of arguments and return values of the function. The function must have at least one return value, and at most two return values with the second return value being an [error] type.
func (*Table) FunctionNames ¶
FunctionNames returns an iterator over the function names in the table. Names are not guaranteed to be unique if a parent table is used and the derived table shadows a function in the parent table.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package arity is a micro-package for providing the Arity type, which is used to identify whether the number of arguments being provided to an invocation is valid.
|
Package arity is a micro-package for providing the Arity type, which is used to identify whether the number of arguments being provided to an invocation is valid. |