jobs

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AskFunc

type AskFunc func(ctx context.Context, text string) (string, error)

type Batch

type Batch[V any] struct {
	Key   string
	Value V
	Size  int
}

func (Batch[V]) Run

func (b Batch[V]) Run(ctx Context, fn func(ctx Context, value V, limit int) (*V, error)) (errs error)

type Context

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

func NewContext

func NewContext(ctx context.Context, log *slog.Logger) Context

func (Context) ApplyAskFn

func (ctx Context) ApplyAskFn(fn func(ctx context.Context, askFn AskFunc) context.Context) Context

func (Context) Deadline

func (ctx Context) Deadline() (time.Time, bool)

func (Context) Debug

func (ctx Context) Debug(msg string, args ...any)

func (Context) Done

func (ctx Context) Done() <-chan struct{}

func (Context) Err

func (ctx Context) Err() error

func (Context) Error

func (ctx Context) Error(errs *error, err error, msg string) bool

func (Context) Info

func (ctx Context) Info(msg string, args ...any)

func (Context) Value

func (ctx Context) Value(key any) any

func (Context) Warn

func (ctx Context) Warn(msg string, args ...any)

func (Context) With

func (ctx Context) With(key string, value any) Context

func (Context) WithAskFn

func (ctx Context) WithAskFn(askFn AskFunc) Context

type Interface

type Interface interface {
	ID() string
	Run(ctx Context, now time.Time, userID string) error
}

type Registry

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

func (*Registry) Register

func (r *Registry) Register(job Interface)

func (*Registry) Run

func (r *Registry) Run(ctx Context, now time.Time, userID string, jobIDs []string) []Result

type Result

type Result struct {
	JobID string
	Error error
}

Jump to

Keyboard shortcuts

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