Documentation ¶
Index ¶
- Constants
- Variables
- func Batch(handler Handler, configure func(Handler), tags ...any) *promise.Promise[[]any]
- func BatchAsync[T any](handler Handler, configure func(Handler) *promise.Promise[T], tags ...any) *promise.Promise[[]any]
- func BatchTag[T any](handler Handler, configure func(Handler)) *promise.Promise[[]any]
- func BatchTagAsync[T any, E any](handler Handler, configure func(Handler) *promise.Promise[T]) *promise.Promise[[]any]
- func Command(handler Handler, callback any, constraints ...any) (pv *promise.Promise[any], err error)
- func CommandAll(handler Handler, callback any, constraints ...any) (p *promise.Promise[any], err error)
- func Create[T any](handler Handler, constraints ...any) (T, *promise.Promise[T], error)
- func CreateAll[T any](handler Handler, constraints ...any) (t []T, tp *promise.Promise[[]T], err error)
- func CreateKey[T any](handler Handler, key any, constraints ...any) (t T, tp *promise.Promise[T], err error)
- func Execute[T any](handler Handler, callback any, constraints ...any) (t T, tp *promise.Promise[T], err error)
- func ExecuteAll[T any](handler Handler, callback any, constraints ...any) (t []T, tp *promise.Promise[[]T], err error)
- func GetBatch[TB batching](handler Handler, tags ...any) TB
- func GetOptions[T any](handler Handler) (t T, ok bool)
- func GetOptionsInto(handler Handler, target any) bool
- func MergeOptions(from, into any) bool
- func Resolve[T any](handler Handler, constraints ...any) (T, *promise.Promise[T], bool, error)
- func ResolveAll[T any](handler Handler, constraints ...any) (t []T, tp *promise.Promise[[]T], err error)
- func ResolveKey[T any](handler Handler, key any, constraints ...any) (t T, tp *promise.Promise[T], ok bool, err error)
- func TraverseAxis(node Traversing, axis TraversingAxis, visitor TraversalVisitor) error
- func TraverseLevelOrder(node Traversing, visitor TraversalVisitor) error
- func TraversePostOrder(node Traversing, visitor TraversalVisitor) error
- func TraversePreOrder(node Traversing, visitor TraversalVisitor) error
- func TraverseReverseLevelOrder(node Traversing, visitor TraversalVisitor) error
- func ValidEffect(typ reflect.Type) (bool, error)
- type AcceptPromiseResultFunc
- type AcceptResultFunc
- type Batched
- type Binding
- type BindingBase
- type BindingGroup
- type BindingParser
- type BindingParserFunc
- type BindingReducer
- type BivariantPolicy
- func (p *BivariantPolicy) AcceptResults(results []any) (any, HandleResult, []Effect, []any)
- func (p *BivariantPolicy) Less(binding, otherBinding Binding) bool
- func (p *BivariantPolicy) MatchesKey(key, otherKey any, invariant bool) (matches, exact bool)
- func (p *BivariantPolicy) NewFuncBinding(fun reflect.Value, spec *bindingSpec, key any) (Binding, error)
- func (p *BivariantPolicy) NewMethodBinding(method *reflect.Method, spec *bindingSpec, key any) (Binding, error)
- func (p *BivariantPolicy) Strict() bool
- func (p *BivariantPolicy) VariantKey(key any) (bool, bool)
- type Builder
- type BuilderFunc
- type Callback
- type CallbackArg
- type CallbackBase
- func (c *CallbackBase) AddResult(result any, composer Handler) HandleResult
- func (c *CallbackBase) Constraints() []Constraint
- func (c *CallbackBase) ReceiveResult(result any, strict bool, composer Handler) HandleResult
- func (c *CallbackBase) Result(many bool) (any, *promise.Promise[any])
- func (c *CallbackBase) ResultCount() int
- func (c *CallbackBase) SetAcceptPromiseResult(accept AcceptPromiseResultFunc)
- func (c *CallbackBase) SetAcceptResult(accept AcceptResultFunc)
- func (c *CallbackBase) SetResult(result any)
- func (c *CallbackBase) Source() any
- func (c *CallbackBase) Target() any
- func (c *CallbackBase) TargetForWrite() any
- type CallbackBuilder
- type CallbackGuard
- type CallbackSemantics
- func (c *CallbackSemantics) CanBatch() bool
- func (c *CallbackSemantics) CanFilter() bool
- func (c *CallbackSemantics) CanInfer() bool
- func (c *CallbackSemantics) HasOption(options SemanticFlags) bool
- func (c *CallbackSemantics) IsSpecified(options SemanticFlags) bool
- func (c *CallbackSemantics) MergeInto(semantics *CallbackSemantics)
- func (c *CallbackSemantics) SetOption(options SemanticFlags, enabled bool)
- type CallerFunc
- type CanceledError
- type Cascade
- type Composition
- type CompositionScope
- type Constraint
- type ConstraintProvider
- type ConstraintSource
- type ConstructorBinder
- type ContravariantPolicy
- func (p *ContravariantPolicy) AcceptResults(results []any) (any, HandleResult, []Effect, []any)
- func (p *ContravariantPolicy) Less(binding, otherBinding Binding) bool
- func (p *ContravariantPolicy) MatchesKey(key, otherKey any, invariant bool) (matches, exact bool)
- func (p *ContravariantPolicy) NewFuncBinding(fun reflect.Value, spec *bindingSpec, key any) (Binding, error)
- func (p *ContravariantPolicy) NewMethodBinding(method *reflect.Method, spec *bindingSpec, key any) (Binding, error)
- func (p *ContravariantPolicy) Strict() bool
- func (p *ContravariantPolicy) VariantKey(key any) (variant, unknown bool)
- type CovariantPolicy
- func (p *CovariantPolicy) AcceptResults(results []any) (result any, accepted HandleResult, effects []Effect, cascade []any)
- func (p *CovariantPolicy) Less(binding, otherBinding Binding) bool
- func (p *CovariantPolicy) MatchesKey(key, otherKey any, invariant bool) (matches, exact bool)
- func (p *CovariantPolicy) NewCtorBinding(typ reflect.Type, ctor *reflect.Method, inits []*reflect.Method, ...) (Binding, error)
- func (p *CovariantPolicy) NewFuncBinding(fun reflect.Value, spec *bindingSpec, key any) (Binding, error)
- func (p *CovariantPolicy) NewMethodBinding(method *reflect.Method, spec *bindingSpec, key any) (Binding, error)
- func (p *CovariantPolicy) Strict() bool
- func (p *CovariantPolicy) VariantKey(key any) (variant, unknown bool)
- type Creates
- type CreatesBuilder
- type CurrentHandlerInfoFactoryProvider
- type DependencyArg
- type DependencyResolver
- type DiKey
- type Disposable
- type DisposableFunc
- type Effect
- type Filter
- type FilterAdapter
- type FilterFunc
- type FilterInstanceProvider
- type FilterOptions
- type FilterProvider
- type Filtered
- type FilteredScope
- type FromOptions
- type FuncBinder
- type FuncBindingError
- type FuncSpec
- type HandleContext
- type HandleResult
- func (r HandleResult) And(other HandleResult) HandleResult
- func (r HandleResult) AndBlock(other HandleResult) HandleResult
- func (r HandleResult) Error() error
- func (r HandleResult) Handled() bool
- func (r HandleResult) IsError() bool
- func (r HandleResult) Or(other HandleResult) HandleResult
- func (r HandleResult) OrBlock(block HandleResultBlock) HandleResult
- func (r HandleResult) Otherwise(block HandleResultBlock) HandleResult
- func (r HandleResult) OtherwiseHandledIf(handled bool) HandleResult
- func (r HandleResult) OtherwiseIf(condition bool, block HandleResultBlock) HandleResult
- func (r HandleResult) Stop() bool
- func (r HandleResult) Then(block HandleResultBlock) HandleResult
- func (r HandleResult) ThenIf(condition bool, block HandleResultBlock) HandleResult
- func (r HandleResult) WithError(err error) HandleResult
- func (r HandleResult) WithoutError() HandleResult
- type HandleResultBlock
- type Handler
- type HandlerAxis
- type HandlerInfo
- type HandlerInfoError
- type HandlerInfoFactory
- type HandlerInfoFactoryBuilder
- type HandlerInfoObserver
- type HandlerInfoObserverFunc
- type HandlerInfoProvider
- type HandlerSpec
- type Handles
- func (h *Handles) CanBatch() bool
- func (h *Handles) CanDispatch(handler any, binding Binding) (reset func(), approved bool)
- func (h *Handles) CanFilter() bool
- func (h *Handles) CanInfer() bool
- func (h *Handles) Dispatch(handler any, greedy bool, composer Handler) HandleResult
- func (h *Handles) Key() any
- func (h *Handles) Policy() Policy
- func (h *Handles) Source() any
- func (h *Handles) String() string
- type HandlesBuilder
- type Init
- type Key
- type Lifestyle
- type LifestyleInit
- type LifestyleProvider
- func (l *LifestyleProvider) AppliesTo(callback Callback) bool
- func (l *LifestyleProvider) Filters(binding Binding, callback any, composer Handler) ([]Filter, error)
- func (l *LifestyleProvider) FiltersAssigned() bool
- func (l *LifestyleProvider) Required() bool
- func (l *LifestyleProvider) SetFilters(filters ...Filter)
- type Metadata
- type MethodBinder
- type MethodBindingError
- type MutableHandlers
- func (m *MutableHandlers) AppendHandlers(handlers ...any) *MutableHandlers
- func (m *MutableHandlers) Handle(callback any, greedy bool, composer Handler) HandleResult
- func (m *MutableHandlers) Handlers() []any
- func (m *MutableHandlers) InsertHandlers(index int, handlers ...any) *MutableHandlers
- func (m *MutableHandlers) RemoveHandlers(handlers ...any) *MutableHandlers
- func (m *MutableHandlers) ResetHandlers(handlers ...any) *MutableHandlers
- func (m *MutableHandlers) SuppressDispatch()
- type Named
- type Next
- func (n Next) Abort() ([]any, *promise.Promise[[]any], error)
- func (n Next) Fail(err error) ([]any, *promise.Promise[[]any], error)
- func (n Next) Handle(callback any, greedy bool, composer Handler) ([]any, *promise.Promise[[]any], error)
- func (n Next) Pipe(values ...any) ([]any, *promise.Promise[[]any], error)
- func (n Next) PipeAwait(values ...any) []any
- func (n Next) PipeComposer(composer Handler, values ...any) ([]any, *promise.Promise[[]any], error)
- func (n Next) PipeComposerAwait(composer Handler, values ...any) []any
- type NotHandledError
- type Option
- type Optional
- type Policy
- type PolicyDispatch
- type Predicate
- type ProceedFunc
- type Provides
- func (p *Provides) Binding() Binding
- func (p *Provides) CanDispatch(handler any, binding Binding) (reset func(), approved bool)
- func (p *Provides) Dispatch(handler any, greedy bool, composer Handler) (result HandleResult)
- func (p *Provides) Key() any
- func (p *Provides) Owner() any
- func (p *Provides) Parent() *Provides
- func (p *Provides) Policy() Policy
- func (p *Provides) Resolve(handler Handler, many bool) (any, *promise.Promise[any], error)
- func (p *Provides) String() string
- type ProvidesBuilder
- func (b *ProvidesBuilder) Build() Provides
- func (b *ProvidesBuilder) ForOwner(owner any) *ProvidesBuilder
- func (b *ProvidesBuilder) New() *Provides
- func (b *ProvidesBuilder) WithConstraints(constraints ...any) *CallbackBuilder
- func (b *ProvidesBuilder) WithKey(key any) *ProvidesBuilder
- func (b *ProvidesBuilder) WithParent(parent *Provides) *ProvidesBuilder
- type Qualifier
- type RejectedError
- type Resolves
- type ResolvesBuilder
- type SemanticFlags
- type Single
- type SkipFilters
- type Strict
- type Timespan
- type Trampoline
- func (t *Trampoline) Callback() any
- func (t *Trampoline) CanBatch() bool
- func (t *Trampoline) CanDispatch(handler any, binding Binding) (reset func(), approved bool)
- func (t *Trampoline) CanFilter() bool
- func (t *Trampoline) CanInfer() bool
- func (t *Trampoline) Dispatch(callback any, handler any, greedy bool, composer Handler) HandleResult
- func (t *Trampoline) Policy() Policy
- func (t *Trampoline) Result(many bool) (any, *promise.Promise[any])
- func (t *Trampoline) SetResult(result any)
- func (t *Trampoline) Source() any
- type TraversalCircularityError
- type TraversalVisitor
- type TraversalVisitorFunc
- type Traversing
- type TraversingAxis
- type TypeSpec
- type UnresolvedArgError
Constants ¶
const ( FilterStage = 0 FilterStageLogging = 10 FilterStageAuthorization = 30 FilterStageValidation = 50 )
Filter stage priorities.
Variables ¶
var ( ErrBivMissingCallback = errors.New("bivariant: missing callback argument") ErrBivMissingReturn = errors.New("bivariant: must have a return value") )
var ( ErrCovResultsExceeded = errors.New("covariant: cannot accept more than 2 results") ErrCovMissingReturn = errors.New("covariant: must have a return value") )
var ( DisableFilters = Options(FilterOptions{SkipFilters: Set(true)}) EnableFilters = Options(FilterOptions{SkipFilters: Set(false)}) )
var ( Handled = HandleResult{true, false, nil} HandledAndStop = HandleResult{true, true, nil} NotHandled = HandleResult{false, false, nil} NotHandledAndStop = HandleResult{false, true, nil} )
var ( Broadcast = CallWith(SemanticBroadcast) BestEffort = CallWith(SemanticBestEffort) Notify = CallWith(SemanticNotify) )
var AncestorAxis = Axis(TraverseAncestor)
var ChildAxis = Axis(TraverseChild)
var DescendantAxis = Axis(TraverseDescendant)
var DescendantReverseAxis = Axis(TraverseDescendantReverse)
var ErrConMissingCallback = errors.New("contravariant: missing callback argument")
var (
ErrConstraintNameMissing = errors.New("the Named constraint requires a non-empty `name:[name]` tag")
)
var (
// Explicit suppresses implied resolution.
Explicit explicit
)
var Publish = ComposeBuilders(SelfOrDescendantAxis, Notify)
var RootAxis = Axis(TraverseRoot)
var SelfAxis = Axis(TraverseSelf)
var SelfOrAncestorAxis = Axis(TraverseSelfOrAncestor)
var SelfOrChildAxis = Axis(TraverseSelfOrChild)
var SelfOrDescendantAxis = Axis(TraverseSelfOrDescendant)
var SelfOrDescendantReverseAxis = Axis(TraverseSelfOrDescendant)
var SelfOrSiblingAxis = Axis(TraverseSelfOrSibling)
var SelfSiblingOrAncestorAxis = Axis(TraverseSelfSiblingOrAncestor)
var SiblingAxis = Axis(TraverseSibling)
Functions ¶
func BatchAsync ¶ added in v0.10.0
func BatchTagAsync ¶ added in v0.10.0
func Command ¶ added in v0.10.0
func Command( handler Handler, callback any, constraints ...any, ) (pv *promise.Promise[any], err error)
Command invokes a callback with no results. returns an empty promise if execution is asynchronous.
func CommandAll ¶ added in v0.10.0
func CommandAll( handler Handler, callback any, constraints ...any, ) (p *promise.Promise[any], err error)
CommandAll invokes a callback on all with no results. returns an empty promise if execution is asynchronous.
func CreateAll ¶
func CreateAll[T any]( handler Handler, constraints ...any, ) (t []T, tp *promise.Promise[[]T], err error)
CreateAll creates all values of type parameter T.
func CreateKey ¶ added in v0.11.0
func CreateKey[T any]( handler Handler, key any, constraints ...any, ) (t T, tp *promise.Promise[T], err error)
CreateKey creates a value of type parameter T with the specified key.
func Execute ¶ added in v0.10.0
func Execute[T any]( handler Handler, callback any, constraints ...any, ) (t T, tp *promise.Promise[T], err error)
Execute executes a callback with results. returns the results or promise if execution is asynchronous.
func ExecuteAll ¶ added in v0.10.0
func ExecuteAll[T any]( handler Handler, callback any, constraints ...any, ) (t []T, tp *promise.Promise[[]T], err error)
ExecuteAll executes a callback on all and collects the results. returns the results or promise if execution is asynchronous.
func GetOptions ¶
func GetOptionsInto ¶ added in v0.30.23
func MergeOptions ¶
MergeOptions merges from options into options
func ResolveAll ¶
func ResolveAll[T any]( handler Handler, constraints ...any, ) (t []T, tp *promise.Promise[[]T], err error)
ResolveAll retrieves all values of type parameter T. Applies any lifestyle if present.
func ResolveKey ¶ added in v0.11.0
func ResolveKey[T any]( handler Handler, key any, constraints ...any, ) (t T, tp *promise.Promise[T], ok bool, err error)
ResolveKey retrieves a value of type parameter T with the specified key. Applies any lifestyle if present.
func TraverseAxis ¶
func TraverseAxis( node Traversing, axis TraversingAxis, visitor TraversalVisitor, ) error
TraverseAxis traverses a node over an axis.
func TraverseLevelOrder ¶
func TraverseLevelOrder( node Traversing, visitor TraversalVisitor, ) error
TraverseLevelOrder traverse the node using level-order algorithm.
func TraversePostOrder ¶
func TraversePostOrder( node Traversing, visitor TraversalVisitor, ) error
TraversePostOrder traverse the node using post-order algorithm.
func TraversePreOrder ¶
func TraversePreOrder( node Traversing, visitor TraversalVisitor, ) error
TraversePreOrder traverse the node using pre-order algorithm.
func TraverseReverseLevelOrder ¶
func TraverseReverseLevelOrder( node Traversing, visitor TraversalVisitor, ) error
TraverseReverseLevelOrder traverse the node using reverse level-order algorithm.
Types ¶
type AcceptPromiseResultFunc ¶ added in v0.10.0
AcceptPromiseResultFunc adjusts promise callback results.
type AcceptResultFunc ¶
type AcceptResultFunc func( result any, composer Handler, ) HandleResult
AcceptResultFunc accepts or rejects callback results.
type Binding ¶
type Binding interface { Filtered Key() any Strict() bool SkipFilters() bool Async() bool Exported() bool Metadata() []any LogicalOutputType() reflect.Type Invoke( ctx HandleContext, initArgs ...any, ) ([]any, *promise.Promise[[]any], error) }
Binding connects a Callback to a handler.
type BindingBase ¶ added in v0.21.0
type BindingBase struct { FilteredScope // contains filtered or unexported fields }
BindingBase implements common binding contract.
func (*BindingBase) Async ¶ added in v0.22.0
func (b *BindingBase) Async() bool
func (*BindingBase) Metadata ¶ added in v0.21.0
func (b *BindingBase) Metadata() []any
func (*BindingBase) SkipFilters ¶ added in v0.21.0
func (b *BindingBase) SkipFilters() bool
func (*BindingBase) Strict ¶ added in v0.21.0
func (b *BindingBase) Strict() bool
type BindingGroup ¶ added in v0.10.0
type BindingGroup struct{}
BindingGroup marks bindings that aggregate one or more binding metadata.
func (BindingGroup) DefinesBindingGroup ¶ added in v0.10.0
func (BindingGroup) DefinesBindingGroup()
type BindingParser ¶ added in v0.22.0
type BindingParser interface {
// contains filtered or unexported methods
}
BindingParser is an extension for binding customizations.
type BindingParserFunc ¶ added in v0.22.0
type BindingParserFunc func( index int, field *reflect.StructField, binding any, ) (bound bool, err error)
BindingParserFunc implements a BindingParser using a function.
type BindingReducer ¶
type BindingReducer func( binding Binding, result HandleResult, ) (HandleResult, bool)
BindingReducer aggregates Binding results.
type BivariantPolicy ¶
type BivariantPolicy struct { FilteredScope // contains filtered or unexported fields }
BivariantPolicy matches related input and output values.
func (*BivariantPolicy) AcceptResults ¶
func (p *BivariantPolicy) AcceptResults( results []any, ) (any, HandleResult, []Effect, []any)
func (*BivariantPolicy) Less ¶
func (p *BivariantPolicy) Less( binding, otherBinding Binding, ) bool
func (*BivariantPolicy) MatchesKey ¶
func (p *BivariantPolicy) MatchesKey( key, otherKey any, invariant bool, ) (matches, exact bool)
func (*BivariantPolicy) NewFuncBinding ¶ added in v0.3.0
func (*BivariantPolicy) NewMethodBinding ¶
func (*BivariantPolicy) Strict ¶ added in v0.10.0
func (p *BivariantPolicy) Strict() bool
func (*BivariantPolicy) VariantKey ¶ added in v0.23.0
func (p *BivariantPolicy) VariantKey( key any, ) (bool, bool)
type Builder ¶
Builder augments a Handler.
func CallWith ¶ added in v0.7.0
func CallWith(semantics SemanticFlags) Builder
func ComposeBuilders ¶
func PipeBuilders ¶
func ProvideFilters ¶ added in v0.7.0
func ProvideFilters(providers ...FilterProvider) Builder
func UseFilters ¶ added in v0.7.0
type BuilderFunc ¶
BuilderFunc promotes a function to Builder.
func Axis ¶ added in v0.7.0
func Axis(axis TraversingAxis) BuilderFunc
func Options ¶ added in v0.7.0
func Options(options any) BuilderFunc
Options returns a BuilderFunc that makes the provided options available for merging into matching options.
func Reentrant ¶ added in v0.7.0
func Reentrant(filter FilterFunc) BuilderFunc
func With ¶
func With(values ...any) BuilderFunc
func (BuilderFunc) BuildUp ¶ added in v0.7.0
func (f BuilderFunc) BuildUp( handler Handler, ) Handler
type Callback ¶
type Callback interface { ConstraintSource Key() any Source() any Target() any TargetForWrite() any Policy() Policy ResultCount() int Result(many bool) (any, *promise.Promise[any]) SetResult(result any) ReceiveResult( result any, strict bool, composer Handler, ) HandleResult }
Callback represents an intention.
type CallbackBase ¶
type CallbackBase struct {
// contains filtered or unexported fields
}
CallbackBase is abstract Callback implementation.
func (*CallbackBase) AddResult ¶
func (c *CallbackBase) AddResult( result any, composer Handler, ) HandleResult
func (*CallbackBase) Constraints ¶ added in v0.21.0
func (c *CallbackBase) Constraints() []Constraint
func (*CallbackBase) ReceiveResult ¶
func (c *CallbackBase) ReceiveResult( result any, strict bool, composer Handler, ) HandleResult
func (*CallbackBase) ResultCount ¶ added in v0.7.0
func (c *CallbackBase) ResultCount() int
func (*CallbackBase) SetAcceptPromiseResult ¶ added in v0.10.0
func (c *CallbackBase) SetAcceptPromiseResult( accept AcceptPromiseResultFunc, )
func (*CallbackBase) SetAcceptResult ¶ added in v0.7.0
func (c *CallbackBase) SetAcceptResult( accept AcceptResultFunc, )
func (*CallbackBase) SetResult ¶
func (c *CallbackBase) SetResult(result any)
func (*CallbackBase) Source ¶ added in v0.4.0
func (c *CallbackBase) Source() any
func (*CallbackBase) Target ¶ added in v0.26.0
func (c *CallbackBase) Target() any
func (*CallbackBase) TargetForWrite ¶ added in v0.26.0
func (c *CallbackBase) TargetForWrite() any
type CallbackBuilder ¶
type CallbackBuilder struct {
// contains filtered or unexported fields
}
CallbackBuilder builds common CallbackBase.
func (*CallbackBuilder) CallbackBase ¶
func (b *CallbackBuilder) CallbackBase() CallbackBase
func (*CallbackBuilder) IntoTarget ¶ added in v0.26.0
func (b *CallbackBuilder) IntoTarget( target any, ) *CallbackBuilder
func (*CallbackBuilder) WithConstraints ¶ added in v0.11.0
func (b *CallbackBuilder) WithConstraints( constraints ...any, ) *CallbackBuilder
type CallbackGuard ¶
type CallbackGuard interface { CanDispatch( handler any, binding Binding, ) (reset func(), approved bool) }
CallbackGuard detects and prevents circular Callback dispatch.
type CallbackSemantics ¶
type CallbackSemantics struct { Composition // contains filtered or unexported fields }
CallbackSemantics captures semantic options.
func GetSemantics ¶
func GetSemantics(handler Handler) *CallbackSemantics
func (*CallbackSemantics) CanBatch ¶ added in v0.10.0
func (c *CallbackSemantics) CanBatch() bool
func (*CallbackSemantics) CanFilter ¶
func (c *CallbackSemantics) CanFilter() bool
func (*CallbackSemantics) CanInfer ¶
func (c *CallbackSemantics) CanInfer() bool
func (*CallbackSemantics) HasOption ¶
func (c *CallbackSemantics) HasOption(options SemanticFlags) bool
func (*CallbackSemantics) IsSpecified ¶
func (c *CallbackSemantics) IsSpecified(options SemanticFlags) bool
func (*CallbackSemantics) MergeInto ¶
func (c *CallbackSemantics) MergeInto(semantics *CallbackSemantics)
func (*CallbackSemantics) SetOption ¶
func (c *CallbackSemantics) SetOption(options SemanticFlags, enabled bool)
type CallerFunc ¶ added in v0.30.11
CallerFunc is a function that invokes a handler method. The first argument is the handler instance. The remaining arguments become the initial arguments to the handler method. All remaining handler method arguments are resolved from the context.
func MakeCaller ¶ added in v0.3.0
func MakeCaller(fun any) (CallerFunc, error)
MakeCaller creates a CallerFunc from a function.
type CanceledError ¶ added in v0.26.0
CanceledError reports a canceled operation.
func (*CanceledError) Error ¶ added in v0.26.0
func (e *CanceledError) Error() string
func (*CanceledError) Unwrap ¶ added in v0.26.0
func (e *CanceledError) Unwrap() error
type Cascade ¶ added in v0.30.105
type Cascade struct {
// contains filtered or unexported fields
}
Cascade is a standard Effect for cascading callbacks.
func CascadeCallbacks ¶ added in v0.30.105
CascadeCallbacks is a fluent builder to Cascade callbacks.
func (*Cascade) Apply ¶ added in v0.30.105
func (c *Cascade) Apply( ctx HandleContext, ) (promise.Reflect, error)
func (*Cascade) WithConstraints ¶ added in v0.30.105
func (*Cascade) WithHandler ¶ added in v0.30.105
type Composition ¶
type Composition struct {
Trampoline
}
Composition wraps a callback for composition.
func (*Composition) Dispatch ¶
func (c *Composition) Dispatch( handler any, greedy bool, composer Handler, ) HandleResult
type CompositionScope ¶ added in v0.22.0
type CompositionScope struct {
Handler
}
CompositionScope decorates a Handler for composition.
func (*CompositionScope) Handle ¶ added in v0.22.0
func (c *CompositionScope) Handle( callback any, greedy bool, composer Handler, ) HandleResult
type Constraint ¶ added in v0.25.0
type Constraint interface { // Required determines if Constraint must be satisfied. // If it is not required, it will accept Callback's without it. Required() bool // Implied determines if Constraint can be satisfied with just HandleContext. Implied() bool // Satisfies checks if the required Constraint is satisfied. // if implied, nil will be passed for `required` Constraint parameter. Satisfies(required Constraint, ctx HandleContext) bool }
Constraint manages BindingMetadata assertions.
type ConstraintProvider ¶
type ConstraintProvider struct {
// contains filtered or unexported fields
}
ConstraintProvider is a FilterProvider for constraints.
func (*ConstraintProvider) Constraints ¶
func (c *ConstraintProvider) Constraints() []Constraint
func (*ConstraintProvider) Required ¶
func (c *ConstraintProvider) Required() bool
type ConstraintSource ¶ added in v0.25.0
type ConstraintSource interface {
Constraints() []Constraint
}
ConstraintSource returns one or more Constraint.
type ConstructorBinder ¶
type ConstructorBinder interface { NewCtorBinding( typ reflect.Type, ctor *reflect.Method, inits []*reflect.Method, spec *bindingSpec, key any, ) (Binding, error) }
ConstructorBinder creates constructor Binding's.
type ContravariantPolicy ¶
type ContravariantPolicy struct {
FilteredScope
}
ContravariantPolicy matches related input values.
func (*ContravariantPolicy) AcceptResults ¶
func (p *ContravariantPolicy) AcceptResults( results []any, ) (any, HandleResult, []Effect, []any)
func (*ContravariantPolicy) Less ¶
func (p *ContravariantPolicy) Less( binding, otherBinding Binding, ) bool
func (*ContravariantPolicy) MatchesKey ¶
func (p *ContravariantPolicy) MatchesKey( key, otherKey any, invariant bool, ) (matches, exact bool)
func (*ContravariantPolicy) NewFuncBinding ¶ added in v0.3.0
func (*ContravariantPolicy) NewMethodBinding ¶
func (*ContravariantPolicy) Strict ¶ added in v0.10.0
func (p *ContravariantPolicy) Strict() bool
func (*ContravariantPolicy) VariantKey ¶ added in v0.23.0
func (p *ContravariantPolicy) VariantKey( key any, ) (variant, unknown bool)
type CovariantPolicy ¶
type CovariantPolicy struct {
FilteredScope
}
CovariantPolicy matches related output values.
func (*CovariantPolicy) AcceptResults ¶
func (p *CovariantPolicy) AcceptResults( results []any, ) (result any, accepted HandleResult, effects []Effect, cascade []any)
func (*CovariantPolicy) Less ¶
func (p *CovariantPolicy) Less( binding, otherBinding Binding, ) bool
func (*CovariantPolicy) MatchesKey ¶
func (p *CovariantPolicy) MatchesKey( key, otherKey any, invariant bool, ) (matches, exact bool)
func (*CovariantPolicy) NewCtorBinding ¶ added in v0.30.28
func (*CovariantPolicy) NewFuncBinding ¶ added in v0.3.0
func (*CovariantPolicy) NewMethodBinding ¶
func (*CovariantPolicy) Strict ¶ added in v0.10.0
func (p *CovariantPolicy) Strict() bool
func (*CovariantPolicy) VariantKey ¶ added in v0.23.0
func (p *CovariantPolicy) VariantKey( key any, ) (variant, unknown bool)
type Creates ¶
type Creates struct { CallbackBase // contains filtered or unexported fields }
Creates instances covariantly.
type CreatesBuilder ¶
type CreatesBuilder struct { CallbackBuilder // contains filtered or unexported fields }
CreatesBuilder builds Creates callbacks.
func (*CreatesBuilder) New ¶ added in v0.22.0
func (b *CreatesBuilder) New() *Creates
func (*CreatesBuilder) WithKey ¶ added in v0.11.0
func (b *CreatesBuilder) WithKey( key any, ) *CreatesBuilder
type CurrentHandlerInfoFactoryProvider ¶ added in v0.30.79
type CurrentHandlerInfoFactoryProvider struct {
Factory HandlerInfoFactory
}
CurrentHandlerInfoFactoryProvider Resolves the current HandlerInfoFactory
func (*CurrentHandlerInfoFactoryProvider) CabBatch ¶ added in v0.30.79
func (f *CurrentHandlerInfoFactoryProvider) CabBatch() bool
func (*CurrentHandlerInfoFactoryProvider) Handle ¶ added in v0.30.79
func (f *CurrentHandlerInfoFactoryProvider) Handle( callback any, greedy bool, composer Handler, ) HandleResult
func (*CurrentHandlerInfoFactoryProvider) SuppressDispatch ¶ added in v0.30.79
func (f *CurrentHandlerInfoFactoryProvider) SuppressDispatch()
type DependencyArg ¶
type DependencyArg struct {
// contains filtered or unexported fields
}
DependencyArg is a parameter resolved at runtime.
func (DependencyArg) Metadata ¶ added in v0.9.0
func (d DependencyArg) Metadata() []any
func (DependencyArg) Optional ¶
func (d DependencyArg) Optional() bool
func (DependencyArg) Promise ¶ added in v0.10.0
func (d DependencyArg) Promise() bool
func (DependencyArg) Strict ¶
func (d DependencyArg) Strict() bool
type DependencyResolver ¶
type DependencyResolver interface { Resolve( reflect.Type, DependencyArg, HandleContext, ) (reflect.Value, *promise.Promise[reflect.Value], error) }
DependencyResolver defines how an argument value is retrieved.
type Disposable ¶
type Disposable interface {
Dispose()
}
type DisposableFunc ¶
type DisposableFunc func()
func (DisposableFunc) Dispose ¶
func (f DisposableFunc) Dispose()
type Effect ¶ added in v0.30.113
type Effect interface {
Apply(HandleContext) (promise.Reflect, error)
}
Effect describes an action to be performed. Effects are additional outputs from a Handler. These actions generally represent interactions with external entities i.e. databases and other IO.
func MakeEffect ¶ added in v0.30.113
MakeEffect creates an Effect from anything. If the argument is already an Effect it is returned. If require is true, an error is returned if the argument cannot be coerced into an Effect.
func MakeEffects ¶ added in v0.30.113
MakeEffects creates Effect from anything. If an argument is already an Effect it is returned. Unrecognized effects are returned as is. If require is true, an error is returned if any argument cannot be coerced into an Effect.
type Filter ¶
type Filter interface { Order() int Next( self Filter, next Next, ctx HandleContext, provider FilterProvider, ) ([]any, *promise.Promise[[]any], error) }
Filter defines a middleware step in a pipeline.
type FilterAdapter ¶ added in v0.30.23
type FilterAdapter struct{}
FilterAdapter is an adapter for implementing a Filter using late binding method resolution.
func (FilterAdapter) Next ¶ added in v0.30.23
func (l FilterAdapter) Next( self Filter, next Next, ctx HandleContext, provider FilterProvider, ) ([]any, *promise.Promise[[]any], error)
type FilterFunc ¶
type FilterFunc func( callback any, greedy bool, composer Handler, proceed ProceedFunc, ) HandleResult
FilterFunc defines a function that can intercept a callback.
func (FilterFunc) BuildUp ¶ added in v0.7.0
func (f FilterFunc) BuildUp(handler Handler) Handler
type FilterInstanceProvider ¶
type FilterInstanceProvider struct {
// contains filtered or unexported fields
}
FilterInstanceProvider provides existing Filters.
func NewFilterInstanceProvider ¶
func NewFilterInstanceProvider( required bool, filters ...Filter, ) *FilterInstanceProvider
func (*FilterInstanceProvider) Required ¶
func (f *FilterInstanceProvider) Required() bool
type FilterOptions ¶
type FilterOptions struct { Providers []FilterProvider SkipFilters Option[bool] }
FilterOptions are used to control Filter processing.
type FilterProvider ¶
type FilterProvider interface { Required() bool Filters( binding Binding, callback any, composer Handler, ) ([]Filter, error) }
FilterProvider provides one or more Filter's.
type Filtered ¶
type Filtered interface { Filters() []FilterProvider AddFilters(providers ...FilterProvider) RemoveFilters(providers ...FilterProvider) RemoveAllFilters() }
Filtered is a container of Filters.
type FilteredScope ¶
type FilteredScope struct {
// contains filtered or unexported fields
}
FilteredScope implements a container of Filters.
func (*FilteredScope) AddFilters ¶
func (f *FilteredScope) AddFilters(providers ...FilterProvider)
func (*FilteredScope) Filters ¶
func (f *FilteredScope) Filters() []FilterProvider
func (*FilteredScope) RemoveAllFilters ¶
func (f *FilteredScope) RemoveAllFilters()
func (*FilteredScope) RemoveFilters ¶
func (f *FilteredScope) RemoveFilters(providers ...FilterProvider)
type FromOptions ¶
type FromOptions struct{}
FromOptions is a DependencyResolver for option arguments.
type FuncBinder ¶ added in v0.3.0
type FuncBinder interface { NewFuncBinding( fun reflect.Value, spec *bindingSpec, key any, ) (Binding, error) }
FuncBinder creates a binding to a function.
type FuncBindingError ¶ added in v0.3.0
type FuncBindingError struct {
// contains filtered or unexported fields
}
FuncBindingError reports a failed function binding.
func (*FuncBindingError) Error ¶ added in v0.3.0
func (e *FuncBindingError) Error() string
func (*FuncBindingError) Func ¶ added in v0.3.0
func (e *FuncBindingError) Func() reflect.Value
func (*FuncBindingError) Unwrap ¶ added in v0.3.0
func (e *FuncBindingError) Unwrap() error
type FuncSpec ¶ added in v0.30.25
type FuncSpec struct {
// contains filtered or unexported fields
}
FuncSpec creates a HandlerInfo from a single function.
type HandleContext ¶
type HandleContext struct { Handler any Callback Callback Binding Binding Composer Handler Greedy bool }
HandleContext allows inspection of the current Callback.
func (HandleContext) Handle ¶ added in v0.30.35
func (c HandleContext) Handle( callback any, greedy bool, composer Handler, ) HandleResult
type HandleResult ¶
type HandleResult struct {
// contains filtered or unexported fields
}
HandleResult describes the result of an operation.
func DispatchCallback ¶
func DispatchCallback( handler any, callback any, greedy bool, composer Handler, ) HandleResult
func DispatchPolicy ¶
func DispatchPolicy( handler any, callback Callback, greedy bool, composer Handler, ) HandleResult
func (HandleResult) And ¶
func (r HandleResult) And(other HandleResult) HandleResult
func (HandleResult) AndBlock ¶ added in v0.7.0
func (r HandleResult) AndBlock(other HandleResult) HandleResult
func (HandleResult) Error ¶
func (r HandleResult) Error() error
func (HandleResult) Handled ¶ added in v0.21.0
func (r HandleResult) Handled() bool
func (HandleResult) IsError ¶
func (r HandleResult) IsError() bool
func (HandleResult) Or ¶
func (r HandleResult) Or(other HandleResult) HandleResult
func (HandleResult) OrBlock ¶ added in v0.7.0
func (r HandleResult) OrBlock(block HandleResultBlock) HandleResult
func (HandleResult) Otherwise ¶
func (r HandleResult) Otherwise( block HandleResultBlock, ) HandleResult
func (HandleResult) OtherwiseHandledIf ¶
func (r HandleResult) OtherwiseHandledIf( handled bool, ) HandleResult
func (HandleResult) OtherwiseIf ¶
func (r HandleResult) OtherwiseIf( condition bool, block HandleResultBlock, ) HandleResult
func (HandleResult) Stop ¶ added in v0.22.0
func (r HandleResult) Stop() bool
func (HandleResult) Then ¶
func (r HandleResult) Then( block HandleResultBlock, ) HandleResult
func (HandleResult) ThenIf ¶
func (r HandleResult) ThenIf( condition bool, block HandleResultBlock, ) HandleResult
func (HandleResult) WithError ¶
func (r HandleResult) WithError(err error) HandleResult
func (HandleResult) WithoutError ¶
func (r HandleResult) WithoutError() HandleResult
type HandleResultBlock ¶
type HandleResultBlock func() HandleResult
HandleResultBlock provides another HandleResult.
type Handler ¶
type Handler interface { Handle( callback any, greedy bool, composer Handler, ) HandleResult }
Handler is the uniform metaphor for processing.
func AddHandlers ¶
func NewInferenceHandler ¶ added in v0.30.79
func NewInferenceHandler( factory HandlerInfoFactory, specs []HandlerSpec, ) Handler
func NewProvider ¶
type HandlerAxis ¶
type HandlerAxis interface { Handler HandleAxis( axis TraversingAxis, callback any, greedy bool, composer Handler, ) HandleResult }
HandlerAxis extends Handler with traversal behavior.
type HandlerInfo ¶ added in v0.30.25
type HandlerInfo struct { FilteredScope // contains filtered or unexported fields }
HandlerInfo describes the structure of a Handler.
func (*HandlerInfo) Dispatch ¶ added in v0.30.25
func (h *HandlerInfo) Dispatch( policy Policy, handler any, callback Callback, greedy bool, composer Handler, guard CallbackGuard, ) (result HandleResult)
func (*HandlerInfo) Spec ¶ added in v0.30.25
func (h *HandlerInfo) Spec() HandlerSpec
type HandlerInfoError ¶ added in v0.30.25
type HandlerInfoError struct { Spec HandlerSpec Cause error }
HandlerInfoError reports a failed HandlerInfo.
func (*HandlerInfoError) Error ¶ added in v0.30.25
func (e *HandlerInfoError) Error() string
func (*HandlerInfoError) Unwrap ¶ added in v0.30.25
func (e *HandlerInfoError) Unwrap() error
type HandlerInfoFactory ¶ added in v0.30.25
type HandlerInfoFactory interface { HandlerInfoProvider Spec(src any) HandlerSpec Register(src any) (*HandlerInfo, bool, error) }
HandlerInfoFactory registers HandlerInfo's.
func CurrentHandlerInfoFactory ¶ added in v0.30.25
func CurrentHandlerInfoFactory( handler Handler, ) HandlerInfoFactory
CurrentHandlerInfoFactory retrieves the current HandlerInfoFactory assigned to the Handler context.
type HandlerInfoFactoryBuilder ¶ added in v0.30.25
type HandlerInfoFactoryBuilder struct {
// contains filtered or unexported fields
}
HandlerInfoFactoryBuilder build the HandlerInfoFactory.
func (*HandlerInfoFactoryBuilder) Build ¶ added in v0.30.25
func (b *HandlerInfoFactoryBuilder) Build() HandlerInfoFactory
func (*HandlerInfoFactoryBuilder) Observers ¶ added in v0.30.25
func (b *HandlerInfoFactoryBuilder) Observers( observers ...HandlerInfoObserver, ) *HandlerInfoFactoryBuilder
func (*HandlerInfoFactoryBuilder) Parsers ¶ added in v0.30.25
func (b *HandlerInfoFactoryBuilder) Parsers( parsers ...BindingParser, ) *HandlerInfoFactoryBuilder
type HandlerInfoObserver ¶ added in v0.30.25
type HandlerInfoObserver interface { BindingCreated( policy Policy, handlerInfo *HandlerInfo, binding Binding, ) HandlerInfoCreated(handlerInfo *HandlerInfo) }
HandlerInfoObserver observes HandlerInfo creation.
type HandlerInfoObserverFunc ¶ added in v0.30.25
type HandlerInfoObserverFunc func(Policy, *HandlerInfo, Binding)
func (HandlerInfoObserverFunc) BindingCreated ¶ added in v0.30.25
func (f HandlerInfoObserverFunc) BindingCreated( policy Policy, handlerInfo *HandlerInfo, binding Binding, )
type HandlerInfoProvider ¶ added in v0.30.25
type HandlerInfoProvider interface {
Get(src any) *HandlerInfo
}
HandlerInfoProvider returns HandlerInfo's.
type HandlerSpec ¶ added in v0.3.0
type HandlerSpec interface { fmt.Stringer PkgPath() string // contains filtered or unexported methods }
HandlerSpec is Factory for HandlerInfo and associated metadata.
type Handles ¶
type Handles struct { CallbackBase // contains filtered or unexported fields }
Handles callbacks contravariantly.
func (*Handles) CanDispatch ¶
type HandlesBuilder ¶
type HandlesBuilder struct { CallbackBuilder // contains filtered or unexported fields }
HandlesBuilder builds Handles callbacks.
func (*HandlesBuilder) New ¶ added in v0.22.0
func (b *HandlesBuilder) New() *Handles
func (*HandlesBuilder) WithCallback ¶
func (b *HandlesBuilder) WithCallback( callback any, ) *HandlesBuilder
type Key ¶ added in v0.30.35
type Key string
Key is a miruken.DependencyResolver for resolving values referenced by a string key.
type LifestyleInit ¶ added in v0.30.28
LifestyleInit initializes a Lifestyle from Binding info.
type LifestyleProvider ¶
type LifestyleProvider struct {
// contains filtered or unexported fields
}
LifestyleProvider is a FilterProvider of lifestyles.
func (*LifestyleProvider) AppliesTo ¶
func (l *LifestyleProvider) AppliesTo( callback Callback, ) bool
func (*LifestyleProvider) FiltersAssigned ¶ added in v0.30.28
func (l *LifestyleProvider) FiltersAssigned() bool
func (*LifestyleProvider) Required ¶
func (l *LifestyleProvider) Required() bool
func (*LifestyleProvider) SetFilters ¶
func (l *LifestyleProvider) SetFilters(filters ...Filter)
type Metadata ¶
Metadata matches against kev/value pairs.
func (*Metadata) Satisfies ¶ added in v0.21.0
func (m *Metadata) Satisfies(required Constraint, _ HandleContext) bool
type MethodBinder ¶
type MethodBinder interface { NewMethodBinding( method *reflect.Method, spec *bindingSpec, key any, ) (Binding, error) }
MethodBinder creates a binding a method.
type MethodBindingError ¶
MethodBindingError reports a failed method binding.
func (*MethodBindingError) Error ¶
func (e *MethodBindingError) Error() string
func (*MethodBindingError) Unwrap ¶
func (e *MethodBindingError) Unwrap() error
type MutableHandlers ¶ added in v0.22.0
type MutableHandlers struct {
// contains filtered or unexported fields
}
MutableHandlers manages a mutable list of Handlers.
func (*MutableHandlers) AppendHandlers ¶ added in v0.30.25
func (m *MutableHandlers) AppendHandlers( handlers ...any, ) *MutableHandlers
func (*MutableHandlers) Handle ¶ added in v0.22.0
func (m *MutableHandlers) Handle( callback any, greedy bool, composer Handler, ) HandleResult
func (*MutableHandlers) Handlers ¶ added in v0.22.0
func (m *MutableHandlers) Handlers() []any
func (*MutableHandlers) InsertHandlers ¶ added in v0.22.0
func (m *MutableHandlers) InsertHandlers( index int, handlers ...any, ) *MutableHandlers
func (*MutableHandlers) RemoveHandlers ¶ added in v0.22.0
func (m *MutableHandlers) RemoveHandlers( handlers ...any, ) *MutableHandlers
func (*MutableHandlers) ResetHandlers ¶ added in v0.30.25
func (m *MutableHandlers) ResetHandlers( handlers ...any, ) *MutableHandlers
func (*MutableHandlers) SuppressDispatch ¶ added in v0.22.0
func (m *MutableHandlers) SuppressDispatch()
type Named ¶
type Named string
Named matches against a name.
func (*Named) Satisfies ¶ added in v0.21.0
func (n *Named) Satisfies(required Constraint, _ HandleContext) bool
type Next ¶
type Next func( composer Handler, proceed bool, values ...any, ) ([]any, *promise.Promise[[]any], error)
Next advances to the next step in a pipeline. The optional composer replaces the Handler in the next step. The optional values provide dependencies to the next step.
func (Next) PipeComposer ¶ added in v0.10.0
type NotHandledError ¶
type NotHandledError struct {
Callback any
}
NotHandledError reports a failed callback.
func (*NotHandledError) Error ¶
func (e *NotHandledError) Error() string
type Option ¶ added in v0.11.0
type Option[T any] struct { // contains filtered or unexported fields }
Option provides an explicit representation of an optional value when the Zero value is not sufficient to distinguish unset values.
func (*Option[T]) ValueOrDefault ¶ added in v0.11.0
func (o *Option[T]) ValueOrDefault(val T) T
type Policy ¶
type Policy interface { Filtered Strict() bool Less(binding, otherBinding Binding) bool VariantKey(key any) (bool, bool) MatchesKey(key, otherKey any, invariant bool) (bool, bool) AcceptResults(results []any) (any, HandleResult, []Effect, []any) }
Policy manages behaviors and callback Binding's.
type PolicyDispatch ¶
type PolicyDispatch interface { DispatchPolicy( policy Policy, callback Callback, greedy bool, composer Handler, ) HandleResult }
PolicyDispatch customizes Callback Policy dispatch.
type ProceedFunc ¶ added in v0.7.0
type ProceedFunc func() HandleResult
ProceedFunc calls the next filter in the pipeline.
type Provides ¶
type Provides struct { CallbackBase // contains filtered or unexported fields }
Provides results covariantly.
func (*Provides) CanDispatch ¶
func (*Provides) Dispatch ¶
func (p *Provides) Dispatch( handler any, greedy bool, composer Handler, ) (result HandleResult)
type ProvidesBuilder ¶
type ProvidesBuilder struct { CallbackBuilder // contains filtered or unexported fields }
ProvidesBuilder builds Provides callbacks.
func (*ProvidesBuilder) Build ¶ added in v0.22.0
func (b *ProvidesBuilder) Build() Provides
func (*ProvidesBuilder) ForOwner ¶ added in v0.11.0
func (b *ProvidesBuilder) ForOwner( owner any, ) *ProvidesBuilder
func (*ProvidesBuilder) New ¶ added in v0.22.0
func (b *ProvidesBuilder) New() *Provides
func (*ProvidesBuilder) WithConstraints ¶
func (b *ProvidesBuilder) WithConstraints( constraints ...any, ) *CallbackBuilder
func (*ProvidesBuilder) WithKey ¶
func (b *ProvidesBuilder) WithKey( key any, ) *ProvidesBuilder
func (*ProvidesBuilder) WithParent ¶
func (b *ProvidesBuilder) WithParent( parent *Provides, ) *ProvidesBuilder
type Qualifier ¶
type Qualifier[T any] struct{}
Qualifier matches against a type.
func (Qualifier[T]) Satisfies ¶ added in v0.21.0
func (q Qualifier[T]) Satisfies(required Constraint, _ HandleContext) bool
type RejectedError ¶
type RejectedError struct {
Callback any
}
RejectedError reports a rejected callback.
func (*RejectedError) Error ¶
func (e *RejectedError) Error() string
type Resolves ¶ added in v0.10.0
type Resolves struct { Provides // contains filtered or unexported fields }
Resolves extends Provides semantics to dispatch a Callback on the resolved handler.
func (*Resolves) CanDispatch ¶ added in v0.10.0
type ResolvesBuilder ¶ added in v0.10.0
type ResolvesBuilder struct { ProvidesBuilder // contains filtered or unexported fields }
ResolvesBuilder builds Resolves callbacks.
func (*ResolvesBuilder) New ¶ added in v0.30.25
func (b *ResolvesBuilder) New() *Resolves
func (*ResolvesBuilder) WithCallback ¶ added in v0.10.0
func (b *ResolvesBuilder) WithCallback( callback Callback, ) *ResolvesBuilder
func (*ResolvesBuilder) WithGreedy ¶ added in v0.10.0
func (b *ResolvesBuilder) WithGreedy( greedy bool, ) *ResolvesBuilder
type SemanticFlags ¶
type SemanticFlags uint8
SemanticFlags enumerates semantic options.
const ( SemanticNone SemanticFlags = 0 SemanticBroadcast SemanticFlags = 1 << iota SemanticBestEffort SemanticNotify = SemanticBroadcast | SemanticBestEffort )
type Single ¶ added in v0.22.0
type Single struct { LifestyleProvider // contains filtered or unexported fields }
Single LifestyleProvider providing same instance.
func (*Single) InitLifestyle ¶ added in v0.30.28
type Trampoline ¶
type Trampoline struct {
// contains filtered or unexported fields
}
func (*Trampoline) Callback ¶
func (t *Trampoline) Callback() any
func (*Trampoline) CanBatch ¶ added in v0.10.0
func (t *Trampoline) CanBatch() bool
func (*Trampoline) CanDispatch ¶
func (t *Trampoline) CanDispatch( handler any, binding Binding, ) (reset func(), approved bool)
func (*Trampoline) CanFilter ¶
func (t *Trampoline) CanFilter() bool
func (*Trampoline) CanInfer ¶
func (t *Trampoline) CanInfer() bool
func (*Trampoline) Dispatch ¶
func (t *Trampoline) Dispatch( callback any, handler any, greedy bool, composer Handler, ) HandleResult
func (*Trampoline) Policy ¶
func (t *Trampoline) Policy() Policy
func (*Trampoline) SetResult ¶
func (t *Trampoline) SetResult(result any)
func (*Trampoline) Source ¶ added in v0.4.0
func (t *Trampoline) Source() any
type TraversalCircularityError ¶
type TraversalCircularityError struct {
// contains filtered or unexported fields
}
TraversalCircularityError reports a traversal circularity.
func (TraversalCircularityError) Culprit ¶
func (e TraversalCircularityError) Culprit() Traversing
func (TraversalCircularityError) Error ¶
func (e TraversalCircularityError) Error() string
type TraversalVisitor ¶
type TraversalVisitor interface {
VisitTraversal(node Traversing) (stop bool, err error)
}
TraversalVisitor is called during traversal.
type TraversalVisitorFunc ¶
type TraversalVisitorFunc func(node Traversing) (stop bool, err error)
func (TraversalVisitorFunc) VisitTraversal ¶
func (f TraversalVisitorFunc) VisitTraversal(node Traversing) (bool, error)
type Traversing ¶
type Traversing interface { Parent() Traversing Children() []Traversing Traverse(axis TraversingAxis, visitor TraversalVisitor) error }
Traversing represents a node in a graph.
type TraversingAxis ¶
type TraversingAxis uint
TraversingAxis defines a path of traversal.
const ( TraverseSelf TraversingAxis = iota TraverseRoot TraverseChild TraverseSibling TraverseAncestor TraverseDescendant TraverseDescendantReverse TraverseSelfOrChild TraverseSelfOrSibling TraverseSelfOrAncestor TraverseSelfOrDescendant TraverseSelfOrDescendantReverse TraverseSelfSiblingOrAncestor )
type TypeSpec ¶ added in v0.30.25
type TypeSpec struct {
// contains filtered or unexported fields
}
TypeSpec creates a HandlerInfo using all the exported methods of reflect.Type instance.
type UnresolvedArgError ¶ added in v0.3.0
type UnresolvedArgError struct { Reason error // contains filtered or unexported fields }
UnresolvedArgError reports a failed resolve an arg.
func (*UnresolvedArgError) Error ¶ added in v0.3.0
func (e *UnresolvedArgError) Error() string
func (*UnresolvedArgError) Unwrap ¶ added in v0.3.0
func (e *UnresolvedArgError) Unwrap() error
Source Files ¶
- arg.go
- axis.go
- batch.go
- bind.go
- bivar.go
- build.go
- call.go
- callback.go
- compose.go
- constraint.go
- contravar.go
- covar.go
- creates.go
- ctorbind.go
- describe.go
- dispose.go
- effect.go
- filter.go
- funcbind.go
- graph.go
- handler.go
- handles.go
- infer.go
- initialize.go
- key.go
- lifestyle.go
- methodbind.go
- options.go
- policy.go
- predicate.go
- provider.go
- provides.go
- resolves.go
- result.go
- semantics.go
- timespan.go
- trampoline.go