Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Return2Evaluator ¶
type Return2Evaluator[R, S any] struct { // contains filtered or unexported fields }
RunEvaluator handles functions with 2 return values
func Return2 ¶
func Return2[R, S any](ret1 R, ret2 S, err error) Return2Evaluator[R, S]
Return2 collects the error and other return values for evaluation in the OrExit or OrPanic methods
func (Return2Evaluator[R, S]) OrExit ¶
func (e Return2Evaluator[R, S]) OrExit() (R, S)
OrExit exits the application without an error message if there is an error, returning the values of the function if there is no error
func (Return2Evaluator[R, S]) OrExitMsg ¶
func (e Return2Evaluator[R, S]) OrExitMsg(msg string) (R, S)
OrExitMsg exits the application with an error message if there is an error, returning the values of the function if there is no error You may use the %v placeholder to include the error in the message
func (Return2Evaluator[R, S]) OrPanic ¶
func (e Return2Evaluator[R, S]) OrPanic() (R, S)
OrPanic panics without an error message if there is an error, returning the values of the function if there is no error
func (Return2Evaluator[R, S]) OrPanicMsg ¶
func (e Return2Evaluator[R, S]) OrPanicMsg(msg string) (R, S)
OrPanicMsg exits the application with an error message if there is an error, returning the values of the function if there is no error You may use the %v placeholder to include the error in the message
type ReturnEvaluator ¶
type ReturnEvaluator[R any] struct { // contains filtered or unexported fields }
RunEvaluator handles functions with 1 return value
func Return ¶
func Return[R any](ret R, err error) ReturnEvaluator[R]
Return collects the error and other return value for evaluation in the OrExit or OrPanic methods
func (ReturnEvaluator[R]) OrExit ¶
func (e ReturnEvaluator[R]) OrExit() R
OrExit exits the application without an error message if there is an error, returning the value of the function if there is no error
func (ReturnEvaluator[R]) OrExitMsg ¶
func (e ReturnEvaluator[R]) OrExitMsg(msg string) R
OrExitMsg exits the application with an error message if there is an error, returning the value of the function if there is no error You may use the %v placeholder to include the error in the message
func (ReturnEvaluator[R]) OrPanic ¶
func (e ReturnEvaluator[R]) OrPanic() R
OrPanic panics without an error message if there is an error, returning the value of the function if there is no error
func (ReturnEvaluator[R]) OrPanicMsg ¶
func (e ReturnEvaluator[R]) OrPanicMsg(msg string) R
OrPanicMsg exits the application with an error message if there is an error, returning the value of the function if there is no error You may use the %v placeholder to include the error in the message
type RunEvaluator ¶
type RunEvaluator struct {
// contains filtered or unexported fields
}
RunEvaluator handles functions with no return value
func Run ¶
func Run(err error) RunEvaluator
Run collects the error for evaluation in the OrExit or OrPanic methods
func (RunEvaluator) OrExit ¶
func (e RunEvaluator) OrExit()
OrExit exits the application without an error message if there is an error
func (RunEvaluator) OrExitMsg ¶
func (e RunEvaluator) OrExitMsg(msg string)
OrExitMsg exits the application with an error message if there is an error You may use the %v placeholder to include the error in the message
func (RunEvaluator) OrPanic ¶
func (e RunEvaluator) OrPanic()
OrPanic panics without an error message if there is an error
func (RunEvaluator) OrPanicMsg ¶
func (e RunEvaluator) OrPanicMsg(msg string)
OrPanicMsg exits the application with an error message if there is an error You may use the %v placeholder to include the error in the message