taskerlite

package
v0.304.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericTask

type GenericTask interface {
	Task | *Runnable |
		func(context.Context) error |
		func(context.Context) |
		func() error |
		func()
}

type Runnable

type Runnable interface{ Run(context.Context) error }

type Task

type Task func(context.Context) error

Task is the basic unit of tasker package, which represents an executable work.

Task at its core is nothing more than a synchronous function. Working with synchronous functions removes the complexity of thinking about how to run your application. Your components become more stateless and focus on the domain rather than the lifecycle management. This less stateful approach can help to make testing your Task also easier.

func Concurrence

func Concurrence[TFN GenericTask](tfns ...TFN) Task

Concurrence is a construct that allows you to execute a list of Task concurrently. If any of the Task fails with an error, all Task will receive cancellation signal.

func Sequence

func Sequence[TFN GenericTask](tfns ...TFN) Task

Sequence is a construct that allows you to execute a list of Task sequentially. If any of the Task fails with an error, it breaks the sequential execution and the error is returned.

func ToTask

func ToTask[TFN GenericTask](tfn TFN) Task

func ToTasks

func ToTasks[TFN GenericTask](tfns []TFN) []Task

func (Task) Run

func (fn Task) Run(ctx context.Context) error

Run method supplies Runnable interface for Task.

Jump to

Keyboard shortcuts

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