Documentation
¶
Index ¶
- Variables
- func Batch[T any](ctx context.Context, batchSize int, promises ...*Promise[T]) chan *Promise[[]T]
- func BatchWithPool[T any](ctx context.Context, pool Pool, batchSize int, promises ...*Promise[T]) chan *Promise[[]T]
- type Pool
- type Promise
- func All[T any](ctx context.Context, promises ...*Promise[T]) *Promise[[]T]
- func AllResolved[T any](ctx context.Context, promises ...*Promise[T]) *Promise[[]T]
- func AllResolvedWithPool[T any](ctx context.Context, pool Pool, 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 First[T any](ctx context.Context, promises ...*Promise[T]) *Promise[T]
- func FirstWithPool[T any](ctx context.Context, pool Pool, promises ...*Promise[T]) *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 NewWithPoolWaiting[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 ¶
View Source
var (
DefaultPool = newDefaultPool()
)
Functions ¶
Types ¶
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 AllResolved ¶ added in v0.0.2
AllResolved resolves with all resolved promises, ignoring all rejected promises
func AllResolvedWithPool ¶ added in v0.0.2
func AllWithPool ¶
func CatchWithPool ¶
func FirstWithPool ¶
func NewWithPool ¶
func NewWithPoolWaiting ¶ added in v0.0.4
func RaceWithPool ¶
func ThenWithPool ¶
Click to show internal directories.
Click to hide internal directories.