Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Default ¶
func Default(value interface{}, defaultValue interface{}) interface{}
Default Return the given value, or the given default value if the given value is nil.
Example:
Default(nil, 1) Default(1, 1)
func Retry ¶
Retry Retry an operation a given number of times
Example:
Retry(3, func() error { return nil })
func With ¶
func With(value interface{}, fn ...func(interface{}) interface{}) interface{}
With Return the given value, optionally passed through the given callback. If the `fn` is nil, the value is returned unmodified. If the `fn` is not nil, the value is passed through the callback, and the result is returned.
Example:
With(1, func(i interface{}) interface{} { return i.(int) + 2 }, func(i interface{}) interface{} { return i.(int) * 100 })
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.