Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New is a wrapper around Factory with no options provided returning a new future
Example ¶
// define the response globally to be set in the callable
var rsp *http.Response
future := New(func() (err error) {
rsp, err = http.Get("http://example.com")
return err
})
// do some stuff here
if err := future(); err != nil {
// handle error
}
defer rsp.Body.Close()
// use the response
Types ¶
type Callback ¶
type Callback func(err error)
Callback is a future callback (can be used to notify the status of the operation)
type Factory ¶
Factory is a future factory
func NewFactory ¶
NewFactory creates new future factory with provided options
Click to show internal directories.
Click to hide internal directories.