Documentation
¶
Index ¶
- Variables
- func Call(f interface{}, args ...interface{}) ([]interface{}, error)
- func CallAndExtractError(f interface{}, args ...interface{}) ([]interface{}, error)
- func CallOptional(f interface{}, args ...interface{}) ([]interface{}, error)
- func CallOptionalAndExtractError(f interface{}, args ...interface{}) ([]interface{}, error)
- func ExtractError(f interface{}, outs []interface{}) ([]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
var ErrUnmatched = errors.New("could not find a match for argument")
Functions ¶
func Call ¶
func Call(f interface{}, args ...interface{}) ([]interface{}, error)
Call given function f with arguments args. Arguments will be supplied to f based on their types. If any given argument does not match - no error is returned. If any argument expected by f is not matched, an error wrapping ErrUnmatched is returned and f is not called. See tests for examples.
func CallAndExtractError ¶
func CallAndExtractError(f interface{}, args ...interface{}) ([]interface{}, error)
func CallOptional ¶
func CallOptional(f interface{}, args ...interface{}) ([]interface{}, error)
CallOptional behaves the same way as Call, but if any value is unfulfilled, its zero value will be set instead of erroring out.
func CallOptionalAndExtractError ¶
func CallOptionalAndExtractError(f interface{}, args ...interface{}) ([]interface{}, error)
func ExtractError ¶
func ExtractError(f interface{}, outs []interface{}) ([]interface{}, error)
ExtractError splits the input arguments into non-error and error parts. An error is considered only if it is the last item in the given arguments. f is the function which its return values are supplied in outs. This is necessary as an nil error does not carry a type in outs.
Types ¶
This section is empty.