concurrency

package
v0.0.0-...-c0686e8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map(
	ctx context.Context,
	m Mapper,
	inputs []interface{},
	numWorkers int,
) (outputs []interface{}, err error)

Map applies m.Map to inputs using numWorkers goroutines. Collects the outputs or stops early if error is encountered.

Types

type Mapper

type Mapper interface {
	Map(ctx context.Context, input interface{}) (output interface{}, err error)
}

Mapper maps inputs into outputs.

type MapperFunc

type MapperFunc func(ctx context.Context, input interface{}) (output interface{}, err error)

MapperFunc is an adaptor to allow the use of ordinary functions as Mappers.

func (MapperFunc) Map

func (f MapperFunc) Map(ctx context.Context, input interface{}) (output interface{}, err error)

Map calls f.

Jump to

Keyboard shortcuts

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