awaitgroup

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitAtGroup

func WaitAtGroup(futures []Future) []interface{}

WaitAtGroup wait until all Futures are executes

Types

type CtxKey

type CtxKey struct{}

CtxKey is just the global key for the arguments

type Future

type Future interface {
	Await() interface{}
}

Future interface has the method signature for await

func ExecFuture

func ExecFuture(arg interface{}, f func() interface{}) Future

ExecFuture executes the async function and set the the argument

func ExecFutureGroup

func ExecFutureGroup(fg []FutureStack) []Future

ExecFutureGroup executes an group of Futures and returns assotiated future handler

type FutureStack

type FutureStack struct {
	AwaitFunc func(ctx context.Context) interface{}
	Argument  interface{}
}

FutureStack struct contains the AwaitFunc and argurments

note: this mght not the best way to handle the argument delivery see: https://go.dev/blog/context#TOC_3.2.

func (FutureStack) Await

func (f FutureStack) Await() interface{}

Await creates the context including arfgument, and blocks til any execution is done.

Jump to

Keyboard shortcuts

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