Documentation ¶
Index ¶
- func Inspect(typ reflect.Type) (reflect.Type, bool)
- type CanceledError
- type Deferred
- type Promise
- func All[T any](ctx context.Context, promises ...*Promise[T]) *Promise[[]T]
- func Catch[T any](p *Promise[T], reject func(err error) error) *Promise[T]
- func Coerce[T any](promise Reflect) *Promise[T]
- func Delay[T any](ctx context.Context, delay time.Duration) *Promise[T]
- func Empty() *Promise[struct{}]
- func Erase[A any](p *Promise[A]) *Promise[struct{}]
- func IndirectReturn[A, B any](p *Promise[A], val *B) *Promise[B]
- func New[T any](ctx context.Context, ...) *Promise[T]
- func Race[T any](ctx context.Context, promises ...*Promise[T]) *Promise[T]
- func Reject[T any](err error) *Promise[T]
- func RejectEmpty(err error) *Promise[struct{}]
- func Resolve[T any](value T) *Promise[T]
- func Return[A, B any](p *Promise[A], val B) *Promise[B]
- func Slice[A any](p *Promise[A]) *Promise[[]A]
- func Then[A, B any](p *Promise[A], resolve func(A) B) *Promise[B]
- func Unwrap[T any](promise *Promise[*Promise[T]]) *Promise[T]
- func (p *Promise[T]) Await() (T, error)
- func (p *Promise[T]) AwaitAny() (any, error)
- func (p *Promise[T]) Cancel()
- func (p *Promise[T]) Catch(rej func(err error) error) *Promise[any]
- func (p *Promise[T]) Context() context.Context
- func (p *Promise[T]) OnCancel(fun func()) *Promise[T]
- func (p *Promise[T]) Then(res func(data any) any) *Promise[any]
- func (p *Promise[T]) UnderlyingType() reflect.Type
- type Reflect
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CanceledError ¶ added in v0.26.0
type CanceledError struct {
// contains filtered or unexported fields
}
func (CanceledError) Cause ¶ added in v0.28.0
func (e CanceledError) Cause() error
func (CanceledError) Error ¶ added in v0.26.0
func (e CanceledError) Error() string
func (CanceledError) Unwrap ¶ added in v0.26.0
func (e CanceledError) Unwrap() error
type Deferred ¶
type Deferred[T any] struct { // contains filtered or unexported fields }
Deferred represents a computation that fulfills a Promise.
func DeferWithContext ¶ added in v0.28.0
DeferWithContext creates a Deferred computation in a context.
type Promise ¶
type Promise[T any] struct { // contains filtered or unexported fields }
Promise represents the eventual completion (or failure) of an asynchronous operation and its resulting value
func All ¶
All resolves when all promises have resolved, or rejects immediately upon any of the promises rejecting
func IndirectReturn ¶ added in v0.30.91
func RejectEmpty ¶ added in v0.30.98
func (*Promise[T]) UnderlyingType ¶
Click to show internal directories.
Click to hide internal directories.