promise

package
v0.0.0-...-4fdff84 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fn

type Fn func(Q)

type Key

type Key interface {
	Key() interface{}
}

type Option

type Option interface {
	Apply(*qTask)
}

type OptionFn

type OptionFn func(*qTask)

func WithCache

func WithCache(c cache.Cacher, expireAfter time.Duration) OptionFn

func (OptionFn) Apply

func (fn OptionFn) Apply(t *qTask)

type Q

type Q interface {
	Key() interface{}
	Context() context.Context
	Resolve(interface{})
	Reject(error)

	Tasker
}

type Runner

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

func NewRunner

func NewRunner(ctx context.Context, defaultOpts ...Option) *Runner

func (*Runner) Len

func (tr *Runner) Len() int

func (*Runner) List

func (tr *Runner) List() []*qTask

func (*Runner) Run

func (tr *Runner) Run(key Key, fn Fn, opts ...Option) *qTask

func (*Runner) Stop

func (tr *Runner) Stop()

type Tasker

type Tasker interface {
	Run(Key, Fn, ...Option) *qTask
}

type Timeout

type Timeout time.Duration

func (Timeout) Apply

func (d Timeout) Apply(task *qTask)

Jump to

Keyboard shortcuts

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