async

package
v0.0.0-...-14c7dbf Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After[V any](v Value[V], f func()) (stop func() bool)

func After2

func After2[K, V any](v Value2[K, V], f func()) (stop func() bool)

func Await

func Await[V any](ctx context.Context, v Value[V]) (V, error)

func Await2

func Await2[K, V any](ctx context.Context, v Value2[K, V]) (K, V, error)

Types

type Value

type Value[V any] interface {
	Value() V
	Done() <-chan struct{}
}

func All

func All[V any](vs ...Value[V]) Value[[]V]

func AllSeq

func AllSeq[V any](vs iter.Seq[Value[V]]) Value[[]V]

func Compute

func Compute[V any](f func() V) Value[V]

func ComputeContext

func ComputeContext[V any](ctx context.Context, f func(ctx context.Context) V) Value[V]

func Const

func Const[V any](v V) Value[V]

func Delay

func Delay[V any](v V, t time.Duration) Value[V]

func FlatMap

func FlatMap[VIn, VOut any](valIn Value[VIn], f func(VIn) Value[VOut]) Value[VOut]

func Flatten

func Flatten[V any](val Value[Value[V]]) Value[V]

func Map

func Map[VIn, VOut any](valIn Value[VIn], f func(VIn) VOut) Value[VOut]

func MapLower

func MapLower[KIn, VIn, VOut any](valIn Value2[KIn, VIn], f func(KIn, VIn) VOut) Value[VOut]

func Never

func Never[V any]() Value[V]

func NewValue

func NewValue[V any]() (v Value[V], resolve func(V))

func Race

func Race[V any](vals ...Value[V]) Value[V]

func RaceSeq

func RaceSeq[V any](vals iter.Seq[Value[V]]) Value[V]

type Value2

type Value2[K, V any] interface {
	Values() (K, V)
	Done() <-chan struct{}
}

func All2Seq

func All2Seq[K, V any](vs iter.Seq[Value2[K, V]]) Value2[[]K, []V]

func Compute2

func Compute2[K, V any](f func() (K, V)) Value2[K, V]

func Compute2Context

func Compute2Context[K, V any](ctx context.Context, f func(ctx context.Context) (K, V)) Value2[K, V]

func ComputeContextErr

func ComputeContextErr[V any](ctx context.Context, f func(ctx context.Context) (V, error)) Value2[V, error]

func Const2

func Const2[K, V any](k K, v V) Value2[K, V]

func Delay2

func Delay2[K, V any](k K, v V, t time.Duration) Value2[K, V]

func FlatMap2

func FlatMap2[KIn, VIn, KOut, VOut any](valIn Value2[KIn, VIn], f func(KIn, VIn) Value2[KOut, VOut]) Value2[KOut, VOut]

func Flatten2

func Flatten2[K, V any](val Value[Value2[K, V]]) Value2[K, V]

func LiftFailure

func LiftFailure[V any](v Value[error]) Value2[V, error]

func LiftSuccess

func LiftSuccess[V any](v Value[V]) Value2[V, error]

func Map2

func Map2[KIn, VIn, KOut, VOut any](valIn Value2[KIn, VIn], f func(KIn, VIn) (KOut, VOut)) Value2[KOut, VOut]

func MapLift

func MapLift[VIn, KOut, VOut any](valIn Value[VIn], f func(VIn) (KOut, VOut)) Value2[KOut, VOut]

func Never2

func Never2[K, V any]() Value2[K, V]

func NewValue2

func NewValue2[K, V any]() (v Value2[K, V], resolve func(K, V))

func Race2

func Race2[K, V any](vals ...Value2[K, V]) Value2[K, V]

func Race2Seq

func Race2Seq[K, V any](vals iter.Seq[Value2[K, V]]) Value2[K, V]

func TryAll

func TryAll[V any](vs ...Value2[V, error]) Value2[[]V, error]

func TryAllSeq

func TryAllSeq[V any](vs iter.Seq[Value2[V, error]]) Value2[[]V, error]

func TryMap

func TryMap[VIn, VOut any](v Value2[VIn, error], f func(VIn) VOut) Value2[VOut, error]

func TryMapErr

func TryMapErr[VIn, VOut any](v Value2[VIn, error], f func(VIn) (VOut, error)) Value2[VOut, error]

Jump to

Keyboard shortcuts

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