picker

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: GPL-3.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Picker added in v0.16.0

type Picker struct {
	// contains filtered or unexported fields
}

Picker provides synchronization, and Context cancelation for groups of goroutines working on subtasks of a common task. Inspired by errGroup

func WithContext added in v0.16.0

func WithContext(ctx context.Context) (*Picker, context.Context)

WithContext returns a new Picker and an associated Context derived from ctx. and cancel when first element return.

func WithTimeout added in v0.16.0

func WithTimeout(ctx context.Context, timeout time.Duration) (*Picker, context.Context)

WithTimeout returns a new Picker and an associated Context derived from ctx with timeout.

func (*Picker) Error added in v0.20.0

func (p *Picker) Error() error

Error return the first error (if all success return nil)

func (*Picker) Go added in v0.16.0

func (p *Picker) Go(f func() (any, error))

Go calls the given function in a new goroutine. The first call to return a nil error cancels the group; its result will be returned by Wait.

func (*Picker) Wait added in v0.16.0

func (p *Picker) Wait() any

Wait blocks until all function calls from the Go method have returned, then returns the first nil error result (if any) from them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL