Documentation
¶
Index ¶
- Constants
- type Component
- type Condition
- type ConditionContext
- type ConditionEvaluator
- type Constructor
- type ConstructorArgument
- type Container
- type Definition
- func (d *Definition) Constructor() reflector.Function
- func (d *Definition) ConstructorArguments() []*ConstructorArgument
- func (d *Definition) IsPrototype() bool
- func (d *Definition) IsSingleton() bool
- func (d *Definition) Name() string
- func (d *Definition) Scope() string
- func (d *Definition) Type() reflector.Type
- type DefinitionLoader
- type DefinitionNotFoundError
- type DefinitionRegistry
- type Initialization
- type ObjectContainer
- func (c *ObjectContainer) AddObjectProcessor(processor ObjectProcessor) error
- func (c *ObjectContainer) ContainsObject(name string) bool
- func (c *ObjectContainer) Definitions() DefinitionRegistry
- func (c *ObjectContainer) FindScope(name string) (Scope, error)
- func (c *ObjectContainer) GetObject(ctx context.Context, filters ...filter.Filter) (any, error)
- func (c *ObjectContainer) IsPrototype(name string) bool
- func (c *ObjectContainer) IsSingleton(name string) bool
- func (c *ObjectContainer) ListObjects(ctx context.Context, filters ...filter.Filter) []any
- func (c *ObjectContainer) ObjectProcessorCount() int
- func (c *ObjectContainer) RegisterScope(name string, scope Scope) error
- func (c *ObjectContainer) ScopeNames() []string
- func (c *ObjectContainer) Singletons() SingletonRegistry
- type ObjectDefinitionRegistry
- func (r *ObjectDefinitionRegistry) Contains(name string) bool
- func (r *ObjectDefinitionRegistry) Count() int
- func (r *ObjectDefinitionRegistry) Find(filters ...filter.Filter) (*Definition, error)
- func (r *ObjectDefinitionRegistry) FindFirst(filters ...filter.Filter) (*Definition, bool)
- func (r *ObjectDefinitionRegistry) List(filters ...filter.Filter) []*Definition
- func (r *ObjectDefinitionRegistry) Names() []string
- func (r *ObjectDefinitionRegistry) Register(definition *Definition) error
- func (r *ObjectDefinitionRegistry) Remove(name string) error
- type ObjectNotFoundError
- type ObjectProcessor
- type ObjectProvider
- type Option
- type Prioritized
- type Registration
- type Scope
- type SingletonObjectRegistry
- func (r *SingletonObjectRegistry) Contains(name string) bool
- func (r *SingletonObjectRegistry) Count() int
- func (r *SingletonObjectRegistry) Find(filters ...filter.Filter) (any, error)
- func (r *SingletonObjectRegistry) FindFirst(filters ...filter.Filter) (any, bool)
- func (r *SingletonObjectRegistry) List(filters ...filter.Filter) []any
- func (r *SingletonObjectRegistry) Names() []string
- func (r *SingletonObjectRegistry) OrElseCreate(name string, provider ObjectProvider) (any, error)
- func (r *SingletonObjectRegistry) Register(name string, object any) error
- func (r *SingletonObjectRegistry) Remove(name string) error
- type SingletonRegistry
Constants ¶
View Source
const ( HighestPriority = math.MinInt LowestPriority = math.MaxInt )
View Source
const ( SingletonScope = "singleton" PrototypeScope = "prototype" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
func (*Component) Conditions ¶
func (*Component) Definition ¶
func (c *Component) Definition() *Definition
type Condition ¶
type Condition interface {
MatchesCondition(ctx ConditionContext) bool
}
type ConditionContext ¶
type ConditionContext struct {
// contains filtered or unexported fields
}
func (ConditionContext) Container ¶
func (c ConditionContext) Container() Container
func (ConditionContext) Deadline ¶
func (c ConditionContext) Deadline() (deadline time.Time, ok bool)
func (ConditionContext) Done ¶
func (c ConditionContext) Done() <-chan struct{}
func (ConditionContext) Err ¶
func (c ConditionContext) Err() error
func (ConditionContext) Value ¶
func (c ConditionContext) Value(key any) any
type ConditionEvaluator ¶
type ConditionEvaluator struct {
// contains filtered or unexported fields
}
func NewConditionEvaluator ¶
func NewConditionEvaluator(container Container) ConditionEvaluator
type Constructor ¶
type Constructor any
type ConstructorArgument ¶
type ConstructorArgument struct {
// contains filtered or unexported fields
}
func (ConstructorArgument) ArgumentIndex ¶
func (a ConstructorArgument) ArgumentIndex() int
func (ConstructorArgument) IsOptional ¶
func (a ConstructorArgument) IsOptional() bool
func (ConstructorArgument) Name ¶
func (a ConstructorArgument) Name() string
func (ConstructorArgument) Type ¶
func (a ConstructorArgument) Type() reflector.Type
type Container ¶
type Container interface { GetObject(ctx context.Context, filters ...filter.Filter) (any, error) ListObjects(ctx context.Context, filters ...filter.Filter) []any ContainsObject(name string) bool IsSingleton(name string) bool IsPrototype(name string) bool Definitions() DefinitionRegistry Singletons() SingletonRegistry RegisterScope(name string, scope Scope) error ScopeNames() []string FindScope(name string) (Scope, error) AddObjectProcessor(processor ObjectProcessor) error ObjectProcessorCount() int }
type Definition ¶
type Definition struct {
// contains filtered or unexported fields
}
func MakeDefinition ¶
func MakeDefinition(constructor Constructor, options ...Option) (*Definition, error)
func (*Definition) Constructor ¶
func (d *Definition) Constructor() reflector.Function
func (*Definition) ConstructorArguments ¶
func (d *Definition) ConstructorArguments() []*ConstructorArgument
func (*Definition) IsPrototype ¶
func (d *Definition) IsPrototype() bool
func (*Definition) IsSingleton ¶
func (d *Definition) IsSingleton() bool
func (*Definition) Name ¶
func (d *Definition) Name() string
func (*Definition) Scope ¶
func (d *Definition) Scope() string
func (*Definition) Type ¶
func (d *Definition) Type() reflector.Type
type DefinitionLoader ¶ added in v0.0.17
type DefinitionLoader struct {
// contains filtered or unexported fields
}
func NewDefinitionLoader ¶ added in v0.0.17
func NewDefinitionLoader(container Container) *DefinitionLoader
func (*DefinitionLoader) LoadDefinitions ¶ added in v0.0.17
func (l *DefinitionLoader) LoadDefinitions(ctx context.Context, components []*Component) error
type DefinitionNotFoundError ¶
type DefinitionNotFoundError struct {
// contains filtered or unexported fields
}
func (DefinitionNotFoundError) Error ¶
func (e DefinitionNotFoundError) Error() string
type DefinitionRegistry ¶
type DefinitionRegistry interface { Register(definition *Definition) error Remove(name string) error Contains(name string) bool Find(filters ...filter.Filter) (*Definition, error) FindFirst(filters ...filter.Filter) (*Definition, bool) List(filters ...filter.Filter) []*Definition Names() []string Count() int }
type Initialization ¶
type ObjectContainer ¶
type ObjectContainer struct {
// contains filtered or unexported fields
}
func NewObjectContainer ¶
func NewObjectContainer() *ObjectContainer
func (*ObjectContainer) AddObjectProcessor ¶
func (c *ObjectContainer) AddObjectProcessor(processor ObjectProcessor) error
func (*ObjectContainer) ContainsObject ¶
func (c *ObjectContainer) ContainsObject(name string) bool
func (*ObjectContainer) Definitions ¶
func (c *ObjectContainer) Definitions() DefinitionRegistry
func (*ObjectContainer) IsPrototype ¶
func (c *ObjectContainer) IsPrototype(name string) bool
func (*ObjectContainer) IsSingleton ¶
func (c *ObjectContainer) IsSingleton(name string) bool
func (*ObjectContainer) ListObjects ¶
func (*ObjectContainer) ObjectProcessorCount ¶
func (c *ObjectContainer) ObjectProcessorCount() int
func (*ObjectContainer) RegisterScope ¶
func (c *ObjectContainer) RegisterScope(name string, scope Scope) error
func (*ObjectContainer) ScopeNames ¶
func (c *ObjectContainer) ScopeNames() []string
func (*ObjectContainer) Singletons ¶
func (c *ObjectContainer) Singletons() SingletonRegistry
type ObjectDefinitionRegistry ¶
type ObjectDefinitionRegistry struct {
// contains filtered or unexported fields
}
func NewObjectDefinitionRegistry ¶
func NewObjectDefinitionRegistry() *ObjectDefinitionRegistry
func (*ObjectDefinitionRegistry) Contains ¶
func (r *ObjectDefinitionRegistry) Contains(name string) bool
func (*ObjectDefinitionRegistry) Count ¶
func (r *ObjectDefinitionRegistry) Count() int
func (*ObjectDefinitionRegistry) Find ¶
func (r *ObjectDefinitionRegistry) Find(filters ...filter.Filter) (*Definition, error)
func (*ObjectDefinitionRegistry) FindFirst ¶
func (r *ObjectDefinitionRegistry) FindFirst(filters ...filter.Filter) (*Definition, bool)
func (*ObjectDefinitionRegistry) List ¶
func (r *ObjectDefinitionRegistry) List(filters ...filter.Filter) []*Definition
func (*ObjectDefinitionRegistry) Names ¶
func (r *ObjectDefinitionRegistry) Names() []string
func (*ObjectDefinitionRegistry) Register ¶
func (r *ObjectDefinitionRegistry) Register(definition *Definition) error
func (*ObjectDefinitionRegistry) Remove ¶
func (r *ObjectDefinitionRegistry) Remove(name string) error
type ObjectNotFoundError ¶
type ObjectNotFoundError struct {
// contains filtered or unexported fields
}
func (ObjectNotFoundError) Error ¶
func (e ObjectNotFoundError) Error() string
type ObjectProcessor ¶
type Prioritized ¶ added in v0.0.17
type Prioritized interface {
Priority() int
}
type Registration ¶
type Registration struct {
// contains filtered or unexported fields
}
func Register ¶
func Register(constructor Constructor, options ...Option) Registration
func (Registration) ConditionalOn ¶
func (r Registration) ConditionalOn(condition Condition) Registration
type SingletonObjectRegistry ¶
type SingletonObjectRegistry struct {
// contains filtered or unexported fields
}
func NewSingletonObjectRegistry ¶
func NewSingletonObjectRegistry() *SingletonObjectRegistry
func (*SingletonObjectRegistry) Contains ¶
func (r *SingletonObjectRegistry) Contains(name string) bool
func (*SingletonObjectRegistry) Count ¶
func (r *SingletonObjectRegistry) Count() int
func (*SingletonObjectRegistry) Find ¶
func (r *SingletonObjectRegistry) Find(filters ...filter.Filter) (any, error)
func (*SingletonObjectRegistry) FindFirst ¶
func (r *SingletonObjectRegistry) FindFirst(filters ...filter.Filter) (any, bool)
func (*SingletonObjectRegistry) List ¶
func (r *SingletonObjectRegistry) List(filters ...filter.Filter) []any
func (*SingletonObjectRegistry) Names ¶
func (r *SingletonObjectRegistry) Names() []string
func (*SingletonObjectRegistry) OrElseCreate ¶
func (r *SingletonObjectRegistry) OrElseCreate(name string, provider ObjectProvider) (any, error)
func (*SingletonObjectRegistry) Register ¶
func (r *SingletonObjectRegistry) Register(name string, object any) error
func (*SingletonObjectRegistry) Remove ¶
func (r *SingletonObjectRegistry) Remove(name string) error
type SingletonRegistry ¶
type SingletonRegistry interface { Register(name string, object any) error Remove(name string) error Find(filters ...filter.Filter) (any, error) FindFirst(filters ...filter.Filter) (any, bool) List(filters ...filter.Filter) []any OrElseCreate(name string, provider ObjectProvider) (any, error) Contains(name string) bool Names() []string Count() int }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.