worker

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Count = runtime.NumCPU()
)

Functions

func GitContent

func GitContent(_ int, err error) string

func GitHeader

func GitHeader(idx int, err error) string

func HandleErrors

func HandleErrors(errs []error, h *ErrorHandler) error

Types

type Action

type Action[T any] func(name string, val *T) error

type ErrorHandler

type ErrorHandler struct {
	Name string

	LogPath string

	Header  func(idx int, err error) string
	Content func(idx int, err error) string
}

type Task

type Task[T any] struct {
	Name   string
	Action Action[T]
	Value  *T
}

type Worker

type Worker[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](verb string, tasks []*Task[T]) *Worker[T]

func (*Worker[T]) Run

func (w *Worker[T]) Run(action Action[T]) []error

Jump to

Keyboard shortcuts

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