batch

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: GPL-3.0 Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

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

Batch similar to errgroup, but can control the maximum number of concurrent

func New

func New(ctx context.Context, opts ...Option) (*Batch, context.Context)

func (*Batch) Go

func (b *Batch) Go(key string, fn func() (interface{}, error))

func (*Batch) Result

func (b *Batch) Result() map[string]Result

func (*Batch) Wait

func (b *Batch) Wait() *Error

func (*Batch) WaitAndGetResult

func (b *Batch) WaitAndGetResult() (map[string]Result, *Error)

type Error

type Error struct {
	Key string
	Err error
}

type Option

type Option = func(b *Batch)

func WithConcurrencyNum

func WithConcurrencyNum(n int) Option

type Result

type Result struct {
	Value interface{}
	Err   error
}

Jump to

Keyboard shortcuts

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