Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flunc ¶
A Flunc is a function that is able to run in a given context. It may manipulate the context by returning a new one.
func MakeFlunc ¶ added in v0.15.0
MakeFlunc turns an arbitrary function, that satisfies the signature of a Flunc into a function of type flunc.Flunc.
This is useful to do type assertions like ff, ok := f.(flunc.Func).
func Parallel ¶
Parallel executes the given Fluncs concurrently. Because of the nature of concurrency context manipulations are neither propagated to sibling nor to parent Fluncs. The first return value is always nil.
If a Flunc returns an error, the context handed to its sibling Fluncs is canceled (context.Context.Done is closed). Siblings should honor this and stop execution, although this is not enforced. The error is returned to the calling Flunc.
If more than one Flunc errors at a time, there is a race, which error gets to read first. Later errors will be lost.
func Sequential ¶
Sequential executes the given Fluncs one after the other. Context manipulations are propagated to later running Fluncs.
If a Flunc returns an error, execution of following Fluncs is canceled and the error is returned to the calling Flunc.