Documentation ¶
Index ¶
- Variables
- type ChangedObserver
- type ChangedObserverFunc
- type ChangingObserver
- type ChangingObserverFunc
- type ChildEndedObserver
- type ChildEndedObserverFunc
- type ChildEndingObserver
- type ChildEndingObserverFunc
- type Context
- func (c *Context) Children() []miruken.Traversing
- func (c *Context) Dispose()
- func (c *Context) End(reason any)
- func (c *Context) Handle(callback any, greedy bool, composer miruken.Handler) miruken.HandleResult
- func (c *Context) HandleAxis(axis miruken.TraversingAxis, callback any, greedy bool, ...) miruken.HandleResult
- func (c *Context) HasChildren() bool
- func (c *Context) NewChild() *Context
- func (c *Context) Observe(observer Observer) miruken.Disposable
- func (c *Context) Parent() miruken.Traversing
- func (c *Context) Root() *Context
- func (c *Context) State() State
- func (c *Context) Store(values ...any) *Context
- func (c *Context) Traverse(axis miruken.TraversingAxis, visitor miruken.TraversalVisitor) error
- func (c *Context) Unwind(reason any) *Context
- func (c *Context) UnwindToRoot(reason any) *Context
- type Contextual
- type ContextualBase
- type EndedObserver
- type EndedObserverFunc
- type EndingObserver
- type EndingObserverFunc
- type Observer
- type Reason
- type Rooted
- type Scoped
- type State
Constants ¶
This section is empty.
Variables ¶
var (
ErrScopeInactiveContext = errors.New("scoped: cannot scope instances to an inactive context")
)
Functions ¶
This section is empty.
Types ¶
type ChangedObserver ¶
type ChangedObserver interface { ContextChanged( contextual Contextual, oldCtx *Context, newCtx *Context) }
ChangedObserver reports a Context contextualObserverChanged.
type ChangedObserverFunc ¶
type ChangedObserverFunc func( contextual Contextual, oldCtx *Context, newCtx *Context)
func (ChangedObserverFunc) ContextChanged ¶
func (f ChangedObserverFunc) ContextChanged( contextual Contextual, oldCtx *Context, newCtx *Context, )
type ChangingObserver ¶
type ChangingObserver interface { ContextChanging( contextual Contextual, oldCtx *Context, newCtx **Context) }
ChangingObserver reports a Context is contextualObserverChanging.
type ChangingObserverFunc ¶
type ChangingObserverFunc func( contextual Contextual, oldCtx *Context, newCtx **Context)
func (ChangingObserverFunc) ContextChanging ¶
func (f ChangingObserverFunc) ContextChanging( contextual Contextual, oldCtx *Context, newCtx **Context, )
type ChildEndedObserver ¶
ChildEndedObserver reports child Context ended.
type ChildEndedObserverFunc ¶
func (ChildEndedObserverFunc) ChildContextEnded ¶
func (f ChildEndedObserverFunc) ChildContextEnded( ctx *Context, reason any, )
type ChildEndingObserver ¶
ChildEndingObserver reports child Context is ending.
type ChildEndingObserverFunc ¶
func (ChildEndingObserverFunc) ChildContextEnding ¶
func (f ChildEndingObserverFunc) ChildContextEnding( ctx *Context, reason any, )
type Context ¶
type Context struct { miruken.MutableHandlers // contains filtered or unexported fields }
A Context represents the scope at a give point in time. Context has a beginning and an end and can handle callbacks As well As notify observers of lifecycle changes. In addition, it maintains parent-child relationships and thus can form a graph.
func (*Context) Children ¶
func (c *Context) Children() []miruken.Traversing
func (*Context) HandleAxis ¶
func (c *Context) HandleAxis( axis miruken.TraversingAxis, callback any, greedy bool, composer miruken.Handler, ) miruken.HandleResult
func (*Context) HasChildren ¶
func (*Context) Parent ¶
func (c *Context) Parent() miruken.Traversing
func (*Context) Traverse ¶
func (c *Context) Traverse( axis miruken.TraversingAxis, visitor miruken.TraversalVisitor, ) error
func (*Context) UnwindToRoot ¶
type Contextual ¶
type Contextual interface { Context() *Context SetContext(*Context) Observe(Observer) miruken.Disposable }
Contextual represents anything with a Context.
type ContextualBase ¶
type ContextualBase struct {
// contains filtered or unexported fields
}
ContextualBase is a base implementation for Contextual.
func (*ContextualBase) ChangeContext ¶
func (c *ContextualBase) ChangeContext( contextual Contextual, ctx *Context, )
func (*ContextualBase) Context ¶
func (c *ContextualBase) Context() *Context
func (*ContextualBase) EndContext ¶
func (c *ContextualBase) EndContext()
func (*ContextualBase) Observe ¶
func (c *ContextualBase) Observe( observer Observer, ) miruken.Disposable
type EndedObserver ¶
EndedObserver reports Context ended.
type EndedObserverFunc ¶
func (EndedObserverFunc) ContextEnded ¶
func (f EndedObserverFunc) ContextEnded( ctx *Context, reason any, )
type EndingObserver ¶
EndingObserver reports Context is ending.
type EndingObserverFunc ¶
func (EndingObserverFunc) ContextEnding ¶
func (f EndingObserverFunc) ContextEnding( ctx *Context, reason any, )
type Rooted ¶
type Rooted struct { miruken.BindingGroup Scoped `mode:"rooted"` }
Rooted is a BindingGroup for configuring a rooted scoped lifestyle in which all resolutions are assigned to the root Context.
type Scoped ¶ added in v0.30.32
type Scoped struct { miruken.LifestyleProvider // contains filtered or unexported fields }
Scoped is a LifestyleProvider that provides instances per Context.