promise

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterFn

type AfterFn func(ResultQ)

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 ResultQ

type ResultQ interface {
	Key() interface{}
	Context() context.Context
	Result() interface{}

	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