Versions in this module Expand all Collapse all v1 v1.0.0 Feb 11, 2026 Changes in this version + var ErrClosed = errors.New("flux: exec context is closed") + var ErrNotResolved = errors.New("flux: atom not resolved — call Resolve before accessing value") + var ErrScopeClosed = errors.New("flux: scope has been disposed") + var NameTag = &Tag[string] + func Acquire[T any](ec *ExecContext, r *Resource[T]) (T, error) + func DeleteTag[T any](d *ContextData, tag *Tag[T]) bool + func ExecFlow[In, Out any](ec *ExecContext, f *Flow[In, Out], input In, opts ...ExecOption) (Out, error) + func ExecFn[Out any](ec *ExecContext, fn func(*ExecContext) (Out, error), opts ...ExecOption) (Out, error) + func GetOrSetTag[T any](d *ContextData, tag *Tag[T], values ...T) T + func GetTag[T any](d *ContextData, tag *Tag[T]) (T, bool) + func HasTag[T any](d *ContextData, tag *Tag[T]) bool + func MustAcquire[T any](ec *ExecContext, r *Resource[T]) T + func MustResolve[T any](scope Scope, atom *Atom[T]) T + func Release[T any](scope Scope, atom *Atom[T]) error + func ResolveAny(scope Scope, atom AnyAtom) (any, error) + func ResolveAnyFrom(rc *ResolveContext, atom AnyAtom) (any, error) + func ResolveFrom[T any](rc *ResolveContext, atom *Atom[T]) (T, error) + func Resolve[T any](scope Scope, atom *Atom[T]) (T, error) + func SeekTag[T any](d *ContextData, tag *Tag[T]) (T, bool) + func SetTag[T any](d *ContextData, tag *Tag[T], value T) + type AnyAtom interface + Deps func() []Resolvable + ID func() uint64 + Name func() string + type AnyExecTarget interface + ExecTargetName func() string + type AnyFlow interface + Deps func() []Resolvable + ID func() uint64 + Name func() string + type AnyTagged interface + TagKey func() string + TagValue func() any + type Atom struct + func NewAtomFrom2[D1, D2, T any](dep1 *Atom[D1], dep2 *Atom[D2], ...) *Atom[T] + func NewAtomFrom3[D1, D2, D3, T any](dep1 *Atom[D1], dep2 *Atom[D2], dep3 *Atom[D3], ...) *Atom[T] + func NewAtomFrom[D1, T any](dep1 *Atom[D1], factory func(*ResolveContext, D1) (T, error), ...) *Atom[T] + func NewAtomUnsafe[T any](deps []Resolvable, factory any, opts ...AtomOption) *Atom[T] + func NewAtom[T any](factory func(*ResolveContext) (T, error), opts ...AtomOption) *Atom[T] + func Required[T any](tag *Tag[T]) *Atom[T] + func (a *Atom) Deps() []Resolvable + func (a *Atom) ID() uint64 + func (a *Atom) Name() string + type AtomOption func(*atomBase) + func WithAtomName(name string) AtomOption + func WithAtomTags(tags ...AnyTagged) AtomOption + func WithKeepAlive() AtomOption + type AtomState int + const StateFailed + const StateIdle + const StateResolved + const StateResolving + func (s AtomState) String() string + type CircularDepError struct + Path []uint64 + func (e *CircularDepError) Error() string + type ContextData struct + func (d *ContextData) All() iter.Seq2[string, any] + func (d *ContextData) Clear() + func (d *ContextData) Delete(key string) bool + func (d *ContextData) Get(key string) (any, bool) + func (d *ContextData) Has(key string) bool + func (d *ContextData) Seek(key string) (any, bool) + func (d *ContextData) SeekAll(key string) iter.Seq[any] + func (d *ContextData) Set(key string, value any) + type Controller struct + func GetControllerResolved[T any](s Scope, atom *Atom[T]) (*Controller[T], error) + func GetController[T any](s Scope, atom *Atom[T]) *Controller[T] + func (c *Controller[T]) Get() (T, error) + func (c *Controller[T]) Invalidate() + func (c *Controller[T]) On(event ControllerEvent, listener func()) UnsubscribeFunc + func (c *Controller[T]) Release() error + func (c *Controller[T]) Resolve() (T, error) + func (c *Controller[T]) Set(value T) error + func (c *Controller[T]) State() AtomState + func (c *Controller[T]) Update(fn func(T) T) error + type ControllerEvent int + const EventAll + const EventResolved + const EventResolving + func (e ControllerEvent) String() string + type CreateContextOption func(*ecOptions) + func WithContextTags(tags ...AnyTagged) CreateContextOption + type Disposer interface + Dispose func(s Scope) error + type ExecContext struct + func (ec *ExecContext) Close(cause error) error + func (ec *ExecContext) Closed() bool + func (ec *ExecContext) Context() context.Context + func (ec *ExecContext) Data() *ContextData + func (ec *ExecContext) Depth() int + func (ec *ExecContext) Input() any + func (ec *ExecContext) Name() string + func (ec *ExecContext) OnClose(fn func(error) error) + func (ec *ExecContext) Parent() *ExecContext + func (ec *ExecContext) Root() *ExecContext + func (ec *ExecContext) Scope() Scope + type ExecOption func(*execOpts) + func WithExecName(name string) ExecOption + func WithExecTags(tags ...AnyTagged) ExecOption + type ExecWrapper interface + WrapExec func(next func() (any, error), target AnyExecTarget, ec *ExecContext) (any, error) + type Extension interface + Name func() string + type Flow struct + func NewFlowFrom2[D1, D2, In, Out any](dep1 FlowDep[D1], dep2 FlowDep[D2], ...) *Flow[In, Out] + func NewFlowFrom3[D1, D2, D3, In, Out any](dep1 FlowDep[D1], dep2 FlowDep[D2], dep3 FlowDep[D3], ...) *Flow[In, Out] + func NewFlowFrom[D1, In, Out any](dep1 FlowDep[D1], factory func(*ExecContext, In, D1) (Out, error), ...) *Flow[In, Out] + func NewFlowUnsafe[In, Out any](deps []Resolvable, factory any, opts ...FlowOption) *Flow[In, Out] + func NewFlow[In, Out any](factory func(*ExecContext, In) (Out, error), opts ...FlowOption) *Flow[In, Out] + func (f *Flow) Deps() []Resolvable + func (f *Flow) ID() uint64 + func (f *Flow) Name() string + func (f *Flow[In, Out]) ExecTargetName() string + type FlowDep interface + type FlowOption func(*flowBase) + func WithFlowName(name string) FlowOption + func WithFlowTags(tags ...AnyTagged) FlowOption + func WithParse[In any](parse func(any) (In, error)) FlowOption + type GCOptions struct + Enabled bool + GraceMs int + type Initializer interface + Init func(s Scope) error + type InvalidationLoopError struct + Path []string + func (e *InvalidationLoopError) Error() string + type ParseError struct + Cause error + Label string + Phase string + func (e *ParseError) Error() string + func (e *ParseError) Unwrap() error + type PresetOption struct + func PresetAtom[T any](target *Atom[T], replacement *Atom[T]) PresetOption + func PresetFlowFn[In, Out any](target *Flow[In, Out], fn func(*ExecContext) (Out, error)) PresetOption + func PresetFlow[In, Out any](target *Flow[In, Out], replacement *Flow[In, Out]) PresetOption + func Preset[T any](target *Atom[T], value T) PresetOption + type Resolvable interface + ID func() uint64 + Name func() string + type ResolveContext struct + func (rc *ResolveContext) Atom() AnyAtom + func (rc *ResolveContext) Cleanup(fn func() error) + func (rc *ResolveContext) Context() context.Context + func (rc *ResolveContext) Data() *ContextData + func (rc *ResolveContext) Invalidate() + func (rc *ResolveContext) Scope() Scope + type ResolveWrapper interface + WrapResolve func(next func() (any, error), atom AnyAtom, s Scope) (any, error) + type Resource struct + func NewResourceFrom2[D1, D2, T any](dep1 FlowDep[D1], dep2 FlowDep[D2], name string, ...) *Resource[T] + func NewResourceFrom[D1, T any](dep1 FlowDep[D1], name string, factory func(*ExecContext, D1) (T, error)) *Resource[T] + func NewResource[T any](name string, factory func(*ExecContext) (T, error)) *Resource[T] + func (r *Resource[T]) ID() uint64 + func (r *Resource[T]) Name() string + type Scope interface + CreateContext func(opts ...CreateContextOption) *ExecContext + Dispose func() error + Flush func() error + On func(state AtomState, atom AnyAtom, listener func()) UnsubscribeFunc + Ready func() error + ReadyErr func() error + Tags func() []AnyTagged + func NewScope(parentCtx context.Context, opts ...ScopeOption) Scope + type ScopeOption func(*scopeOpts) + func WithExtensions(exts ...Extension) ScopeOption + func WithGC(opts GCOptions) ScopeOption + func WithPresets(presets ...PresetOption) ScopeOption + func WithScopeTags(tags ...AnyTagged) ScopeOption + type SelectHandle struct + func SelectWith[T any, S any](s Scope, atom *Atom[T], selector func(T) S, eq func(S, S) bool) *SelectHandle[S] + func Select[T any, S comparable](s Scope, atom *Atom[T], selector func(T) S) *SelectHandle[S] + func (h *SelectHandle[S]) Get() S + func (h *SelectHandle[S]) Subscribe(listener func()) UnsubscribeFunc + type Tag struct + func NewTagWithDefault[T any](label string, def T) *Tag[T] + func NewTagWithParse[T any](label string, parse func(any) (T, error)) *Tag[T] + func NewTag[T any](label string) *Tag[T] + func (t *Tag[T]) All(source []AnyTagged) iter.Seq[T] + func (t *Tag[T]) Collect(source []AnyTagged) []T + func (t *Tag[T]) Find(source []AnyTagged) (T, bool) + func (t *Tag[T]) Get(source []AnyTagged) (T, error) + func (t *Tag[T]) Key() string + func (t *Tag[T]) Label() string + func (t *Tag[T]) Value(v T) *Tagged[T] + type Tagged struct + func (t *Tagged[T]) TagKey() string + func (t *Tagged[T]) TagValue() any + type UnsubscribeFunc func()