# README
A set of tools I use in a number projects.
# Functions
Catch Recovers from panic and callbacks with error If error is not catchableError, it will panic again May be used as defer, coupled with MustReturn or Must, to override named return values
Usage:
func example() (val *http.Request, err error) { defer tool.Catch(func(caught error) { err = caught })
val = tool.MustReturn(funcThatReturnsValAndErr()) // <- this will be caught if err!=nil panic(errors.New("some error")) // <- this will not be caught return }.
Console Prints %+v of arguments, great to debug stuff.
ConvertSlice Return a new slice as `[]dstTypedValue.(type)` cast from the `srcSlice`.
Err Returns the last argument if it is an error, otherwise nil.
No description provided by the author
In Checks if element is in a slice.
Jsonify Returns Varchar implementation of the serialized value, returns empty on error.
MultiMute Ignores errors, returns slice of results.
Must Tolerates no errors.
MustReturn Tolerates no errors, returns value.
NonZero Returns first non-zero value or zero value if all values are zero.
Objectify Unmarshalls value to the target pointer value.
Ptr Return a pointer for any passed object.
RandInt Return a random number in specified range.
Recoverer Recovers job from panic, if maxPanics<0 then infinitely.
RetryFunc Re-runs function if error returned.
Return Ignores errors, returns value.
SetLogger Sets tool package logger, pass nil to disable logging.
Strtr Replaces all old string occurrences with new string in subject.
Try Probes the error and returns bool, optionally logs the message.
# Type aliases
No description provided by the author