processor

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: MIT Imports: 3 Imported by: 0

README

processor

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrDone

func OrDone[T any](ctx context.Context, works <-chan T) <-chan T

func SpeedLimit

func SpeedLimit(ctx context.Context, works <-chan Work, speedLimit time.Duration) <-chan Work

Types

type Processor

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

func NewProcessor

func NewProcessor(ctx context.Context) *Processor

func (*Processor) DoWithParallel

func (p *Processor) DoWithParallel(works <-chan Work, numWorkers int) Results

func (*Processor) DoWithRate

func (p *Processor) DoWithRate(works <-chan Work, rate time.Duration) Results

func (*Processor) DoWithRepeat

func (p *Processor) DoWithRepeat(work Work, rate time.Duration, until time.Time) Results

type Result

type Result struct {
	Val any
	Err error
}

func NewResult

func NewResult[R any](val R, err error) Result

type Results

type Results <-chan Result

func CollectResults

func CollectResults(ctx context.Context, rs ...Results) Results

func (Results) HandleResults

func (rs Results) HandleResults(f func(result Result))

type Work

type Work struct {
	Do func(ctx context.Context) Result
}

Jump to

Keyboard shortcuts

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