async

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func() error

type Promise

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

func NewDeliveredPromise

func NewDeliveredPromise[T any](value T) Promise[T]

func NewFailedPromise

func NewFailedPromise[T any](err error) Promise[T]

func NewPromise

func NewPromise[T any]() Promise[T]

func (Promise[T]) Deliver

func (p Promise[T]) Deliver(value T)

func (Promise[T]) Fail

func (p Promise[T]) Fail(err error)

func (Promise[T]) Inject

func (p Promise[T]) Inject(target *T) error

func (Promise[T]) OnError

func (p Promise[T]) OnError(cb func(err error)) Promise[T]

func (Promise[T]) OnReady added in v0.11.0

func (p Promise[T]) OnReady(cb func()) Promise[T]

func (Promise[T]) OnSuccess

func (p Promise[T]) OnSuccess(cb func(value T)) Promise[T]

func (Promise[T]) Ready

func (p Promise[T]) Ready() bool

func (Promise[T]) Wait

func (p Promise[T]) Wait() (T, error)

type Worker

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

func NewWorker

func NewWorker(capacity int) *Worker

func (*Worker) ProcessAll

func (w *Worker) ProcessAll()

func (*Worker) ProcessCount

func (w *Worker) ProcessCount(count int) bool

func (*Worker) ProcessDuration

func (w *Worker) ProcessDuration(targetDuration time.Duration) bool

func (*Worker) Schedule

func (w *Worker) Schedule(fn Func) Promise[error]

func (*Worker) Shutdown

func (w *Worker) Shutdown()

Jump to

Keyboard shortcuts

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