batch

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

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() (any, 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 any
	Err   error
}

Jump to

Keyboard shortcuts

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