Documentation
¶
Overview ¶
Package concurrent provide a helpers to setup, start and shutdown a lot of services in parallel.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Serve ¶
Serve runs given services in parallel until either ctx.Done or any service exits, then it call cancel and wait until all services will exit.
Returns error of first service which returned non-nil error, if any.
func Setup ¶
Setup processes map which keys must be references to variables and values must be functions which returns values for these variables to run in parallel all functions which corresponding variables is nil.
var a, b *int err = Setup(ctx, map[interface{}]SetupFunc{ &a: setA, &b: setB, })
Returns first non-nil error returned by any of executed functions. It will panic if referenced variable can't be nil or corresponding function returns value which can't be assigned to that variable.