Version: v0.0.0-...-f50700c Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 3 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type ErrorGroup

type ErrorGroup struct {
	Errors []error

ErrorGroup collates errors

func (*ErrorGroup) Add

func (e *ErrorGroup) Add(err error)

Add adds an error to an existing error group

func (*ErrorGroup) Finalize

func (e *ErrorGroup) Finalize() error

Finalize returns an error corresponding to the ErrorGroup state. If there's no errors in the group, finalize returns nil. If there's only one error, Finalize returns that error. Otherwise, Finalize will make a new error consisting of the messages from the constituent errors.

type Future

type Future struct {
	// contains filtered or unexported fields

Future is a type that is essentially the inverse of a channel. With a channel, you have multiple senders and one receiver. With a future, you can have multiple receivers and one sender. Additionally, a future protects against double-sends. Since this is usually used for returning function results, we also capture and return error values as well. Use NewFuture to initialize.

func NewFuture

func NewFuture() *Future

NewFuture returns an initialized and ready Future.

func (*Future) Fired

func (self *Future) Fired() bool

Fired returns whether or not a value has been set. If Fired is true, Get won't block.

func (*Future) Get

func (self *Future) Get() (interface{}, error)

Get blocks until the Future has a value set.

func (*Future) Set

func (self *Future) Set(val interface{}, err error)

Set provides the value to present and future Get calls. If Set has already been called, this is a no-op.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL