Documentation
¶
Index ¶
- type Pool
- type Promise
- func All[T any](ctx context.Context, promises ...*Promise[T]) *Promise[[]T]
- func AllWithPool[T any](ctx context.Context, pool Pool, promises ...*Promise[T]) *Promise[[]T]
- func Catch[T any](p *Promise[T], ctx context.Context, reject func(err error) error) *Promise[T]
- func CatchWithPool[T any](p *Promise[T], ctx context.Context, reject func(err error) error, pool Pool) *Promise[T]
- func New[T any](executor func(resolve func(T), reject func(error))) *Promise[T]
- func NewWithPool[T any](executor func(resolve func(T), reject func(error)), pool Pool) *Promise[T]
- func Race[T any](ctx context.Context, promises ...*Promise[T]) *Promise[T]
- func RaceWithPool[T any](ctx context.Context, pool Pool, promises ...*Promise[T]) *Promise[T]
- func Then[A, B any](p *Promise[A], ctx context.Context, resolve func(A) (B, error)) *Promise[B]
- func ThenWithPool[A, B any](p *Promise[A], ctx context.Context, resolve func(A) (B, error), pool Pool) *Promise[B]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool interface {
Go(f func())
}
func FromAntsPool ¶
func FromAntsPool(p *ants.Pool) Pool
func FromConcPool ¶
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 AllWithPool ¶
func CatchWithPool ¶
func NewWithPool ¶
func RaceWithPool ¶
func ThenWithPool ¶
Click to show internal directories.
Click to hide internal directories.