Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compose ¶
func Compose(wrappers ...morph.FunctionWrapper) morph.FunctionWrapper
Compose constructs a new morph.FunctionWrapper that applies each wrapper in order. The result is a single function wrapper that gives the same result as calling a morph.WrappedFunction.Apply method with multiple wrappers.
func SetArg ¶
func SetArg(name string, value string) morph.FunctionWrapper
SetArg returns a function that constructs a morph.FunctionWrapper for the provided Function that...
The wrapper sets the named argument to a given value at call time. Name can either be the name of a field in f.Arguments, or a number representing the index of a field in f.Arguments.
For example, for a morph.Function f that represents the Go function `Divide(a float64, b float64) float64` (returns a divided by b), then SetArg("b", "2") returns a FunctionWrapper that can construct the function `func(a float64) float64` (returns a divided by two).
func SimpleRewriteResults ¶
func SimpleRewriteResults(mapper string, types string) morph.FunctionWrapper
SimpleRewriteResults constructs a morph.FunctionWrapper that rewrites a function's results.
Mapper is a code expression that lists the new results, for example "$0 * 2, $1 == nil", constructed from the original results of types float64 and error.
The types, for example "float64, bool", represent the new return types after applying the mapper.
This function has a limited syntax; in particular it cannot support rewriting a result tuple into multiple fields. Use a [ResultRewriter] for more advanced use.
Types ¶
type FieldNotFound ¶
type FieldNotFound struct {
Name string
}
func (FieldNotFound) Error ¶
func (err FieldNotFound) Error() string