coroutineGroup

package
v1.56.9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBatchInvalid    = errors.New("轮数不能为0")
	ErrCapacityInvalid = errors.New("每轮循环数不能为0")
)

Functions

This section is empty.

Types

type CoroutineGroup

type CoroutineGroup[T any] struct {
	Error error

	Results []*Result[T]

	OK bool
	// contains filtered or unexported fields
}

func New

func New[T any]() *CoroutineGroup[T]

func (*CoroutineGroup[T]) Run

func (my *CoroutineGroup[T]) Run(fn func(batch, capacity uint) *Result[T]) *CoroutineGroup[T]

func (*CoroutineGroup[T]) RunUntilError

func (my *CoroutineGroup[T]) RunUntilError(fn func(batch, capacity uint) *Result[T]) *CoroutineGroup[T]

func (*CoroutineGroup[T]) SetBatches

func (my *CoroutineGroup[T]) SetBatches(batches uint) *CoroutineGroup[T]

func (*CoroutineGroup[T]) SetCapacity

func (my *CoroutineGroup[T]) SetCapacity(capacity uint) *CoroutineGroup[T]

type Result

type Result[T any] struct {
	Data  T
	Error error
}

Jump to

Keyboard shortcuts

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