Documentation
ΒΆ
Index ΒΆ
- Variables
- func Fetch[T any](ctx context.Context, key any) (T, bool)
- func Go(ctx context.Context, opts *Options, fs ...func() error) (err error)
- func GoCtx(ctx context.Context, opts *Options, fs ...func(context.Context) error) error
- func NewMapStore() *mapStore
- func Put[K, V any](ctx context.Context, key K, value V)
- func RecoverContext(ctx context.Context, err *error)
- func SafeRun(ctx context.Context, f func() error) (err error)
- func SafeRunNode(ctx context.Context, f func(context.Context, any) error, shared any) (err error)
- func Store[V any](ctx context.Context, value V)
- func TryGo(ctx context.Context, opts *Options, fs ...func() error) (ok bool, err error)
- func TryGoCtx(ctx context.Context, opts *Options, fs ...func(context.Context) error) (bool, error)
- func WithAfterFunc(f AfterFunc) option
- func WithErrorCollector(errC chan error) option
- func WithLimit(x int) option
- func WithLogger(logger *slog.Logger) option
- func WithPreFunc(f PreFunc) option
- func WithPrefix(s string) option
- func WithStore(ctx context.Context, store Storer) context.Context
- func WithTimeout(t time.Duration) option
- type AfterFunc
- type AutoNode
- type GraphOptions
- type Group
- func (g *Group) AddAutoNode(n AutoNode) *node
- func (g *Group) AddAutoRunner(runner func() (any, error)) *node
- func (g *Group) AddAutoSharedRunner(runner func(any) (any, error)) *node
- func (g *Group) AddAutoSharedTask(task func(context.Context, any) (any, error)) *node
- func (g *Group) AddAutoTask(task func(context.Context) (any, error)) *node
- func (g *Group) AddNode(n Node) *node
- func (g *Group) AddRunner(runner func() error) *node
- func (g *Group) AddSharedRunner(runner func(any) error) *node
- func (g *Group) AddSharedTask(task func(context.Context, any) error) *node
- func (g *Group) AddTask(task func(context.Context) error) *node
- func (g *Group) DOT(ctx context.Context, opts *GraphOptions) (string, error)
- func (g *Group) Go(ctx context.Context, shared ...any) (err error)
- func (g *Group) GraphURL(ctx context.Context, opts *GraphOptions) (string, error)
- func (g *Group) Node(key any) *node
- func (g *Group) RenderGraph(ctx context.Context, opts *GraphOptions, w io.Writer) error
- func (g *Group) RenderGraphImage(ctx context.Context, opts *GraphOptions) (image.Image, error)
- func (g *Group) RenderGraphToFile(ctx context.Context, opts *GraphOptions, filename string) error
- func (g *Group) Verify(panicking bool) string
- type Node
- type NodeAfterFunc
- type NodePreFunc
- type NodeRollbackFunc
- type Options
- type PreFunc
- type Storer
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var ErrPanic = errors.New("panic recovered")
View Source
var WithLog option = func(o *Options) { o.log = true }
Functions ΒΆ
func NewMapStore ΒΆ
func NewMapStore() *mapStore
copy-on-write map store [ideal for read-heavy scenarios]
func RecoverContext ΒΆ
func SafeRunNode ΒΆ
func WithAfterFunc ΒΆ
func WithAfterFunc(f AfterFunc) option
func WithErrorCollector ΒΆ
func WithErrorCollector(errC chan error) option
func WithLogger ΒΆ
func WithPreFunc ΒΆ
func WithPreFunc(f PreFunc) option
func WithPrefix ΒΆ
func WithPrefix(s string) option
func WithTimeout ΒΆ
Types ΒΆ
type GraphOptions ΒΆ
type GraphOptions struct {
Title string // graph title
Format graphviz.Format // output format
RankDir cgraph.RankDir // direction: TB (top-bottom), LR (left-right), BT, RL
NodeShape cgraph.Shape // node shape: box, ellipse, circle, etc.
NodeColor string // node color
FastFailColor string // color for fast-fail nodes
SilentFailColor string // color for silent-fail nodes
EdgeColor string // edge color
WeakEdgeStyle cgraph.EdgeStyle // style for weak dependency edges (dashed, dotted)
ShowGroupInfo bool // show group options in title
ShowNodeSpec bool // show node spec details
}
func DefaultGraphOptions ΒΆ
func DefaultGraphOptions() *GraphOptions
type Group ΒΆ
type Group struct {
Options
// contains filtered or unexported fields
}
func NewGroup ΒΆ
func NewGroup(opts ...option) *Group
Use [Add...] methods to add different types of nodes to the group
- [AddAuto...] adds an auto node that returns a value and automatically stores it in the context store
- CAUTION: will PANIC if auto nodes are not used with storer-context
func (*Group) AddAutoNode ΒΆ
func (*Group) AddAutoRunner ΒΆ
func (*Group) AddAutoSharedRunner ΒΆ
func (*Group) AddAutoSharedTask ΒΆ
func (*Group) AddAutoTask ΒΆ
func (*Group) AddSharedRunner ΒΆ
func (*Group) AddSharedTask ΒΆ
func (*Group) Go ΒΆ
Go runs the group with added nodes
- if shared units are provided, they will be passed to the shared nodes
- if len(shared) == 1, the node receives shared[0] (type any)
- if len(shared) > 1, the node receives shared (type []any)
- multiple shared units are not recommended
func (*Group) RenderGraph ΒΆ
func (*Group) RenderGraphImage ΒΆ
func (*Group) RenderGraphToFile ΒΆ
type NodePreFunc ΒΆ
node level interceptor
type NodeRollbackFunc ΒΆ
Source Files
ΒΆ
Click to show internal directories.
Click to hide internal directories.