taskworker

package
v0.0.0-...-0aa8bca Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrornvalidObject = errors.New("InvalidObject")

Functions

This section is empty.

Types

type Result

type Result struct {
	Result interface{}
	Err    error
}

type SingleTaskWorker

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

func NewSingleTaskWorker

func NewSingleTaskWorker(ctx context.Context, maxConcurrency uint8, work SingleWork, total int) *SingleTaskWorker

func (*SingleTaskWorker) Do

func (t *SingleTaskWorker) Do(input interface{})

func (*SingleTaskWorker) Results

func (t *SingleTaskWorker) Results() []Result

type SingleWork

type SingleWork func(ctx context.Context, input interface{}) (interface{}, error)

type TaskWorker

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

func NewTaskWorker

func NewTaskWorker(maxConcurrency uint8) *TaskWorker

func (*TaskWorker) Register

func (t *TaskWorker) Register(work Work)

func (*TaskWorker) Run

func (t *TaskWorker) Run(ctx context.Context) []Result

type Work

type Work func(ctx context.Context) (interface{}, error)

Jump to

Keyboard shortcuts

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