Documentation ¶
Index ¶
- func Inspect(typ reflect.Type) (reflect.Type, bool)
- type CanceledError
- type Deferred
- type Promise
- func All[T any](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(delay time.Duration) *Promise[any]
- func New[T any](executor func(resolve func(T), reject func(error))) *Promise[T]
- func Race[T any](promises ...*Promise[T]) *Promise[T]
- func Reject[T any](err error) *Promise[T]
- func Resolve[T any](value T) *Promise[T]
- 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 WithContext[T any](executor func(resolve func(T), reject func(error)), ctx context.Context) *Promise[T]
- func (p *Promise[T]) Await() (T, error)
- func (p *Promise[T]) AwaitAny() (any, error)
- func (p *Promise[T]) Catch(rej func(err error) error) *Promise[any]
- func (p *Promise[T]) Context() context.Context
- 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 WithContext ¶ added in v0.28.0
func (*Promise[T]) UnderlyingType ¶
Click to show internal directories.
Click to hide internal directories.