Documentation ¶
Index ¶
- func Call(fn interface{}, params ...interface{}) interface{}
- func CallWithCtx(ctx interface{}, fn interface{}, params ...interface{}) interface{}
- func Retry(fn func() error, max int) error
- func Tap(value interface{}, callbacks ...func(interface{})) interface{}
- func ValueOf(src interface{}, dest interface{}) error
- func With(value interface{}, callbacks ...func(interface{}) interface{}) interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Call ¶
func Call(fn interface{}, params ...interface{}) interface{}
Call calls the given function with the given params.
Example:
Call(func(name string) string { return "Hello " + name }, "world")
func CallWithCtx ¶
func CallWithCtx(ctx interface{}, fn interface{}, params ...interface{}) interface{}
CallWithCtx calls the given function with the given context and params.
Example:
type Foo struct { Name string } result := CallWithCtx(&Foo{Name: "Hello"}, func(ts *Foo, name string) string { return ts.Name + name }, "world")
func Retry ¶
Retry retries the given function until it returns nil or max is reached.
Example:
err := Retry(func() error { return nil }, 3)
func Tap ¶
func Tap(value interface{}, callbacks ...func(interface{})) interface{}
Tap calls the given callback with the given value then returns the value.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.