Versions in this module Expand all Collapse all v0 v0.5.3 Dec 8, 2023 v0.5.2 Nov 26, 2023 Changes in this version + const PrototypeScope + const SharedScope + func Register(constructor Constructor, options ...Option) + type Constructor any + type Container interface + Contains func(name string) bool + DefinitionRegistry func() DefinitionRegistry + Get func(ctx context.Context, name string) (any, error) + GetByNameAndArgs func(ctx context.Context, name string, args ...any) (any, error) + GetByNameAndType func(ctx context.Context, name string, typ reflector.Type) (any, error) + GetByType func(ctx context.Context, typ reflector.Type) (any, error) + GetInstancesByType func(ctx context.Context, requiredType reflector.Type) ([]any, error) + GetScope func(scopeName string) (Scope, error) + Hooks func() Hooks + IsPrototype func(name string) bool + IsShared func(name string) bool + RegisterResolvable func(typ reflector.Type, object any) error + ScopeNames func() []string + SharedInstances func() SharedInstances + Start func() error + func New() Container + func WithDefinitions(definitions []*Definition) Container + type Definition struct + func MakeDefinition(constructor Constructor, options ...Option) (*Definition, error) + func RegisteredDefinitions() []*Definition + func (d *Definition) Constructor() reflector.Function + func (d *Definition) Inputs() []*Input + func (d *Definition) IsPrototype() bool + func (d *Definition) IsShared() bool + func (d *Definition) Name() string + func (d *Definition) Scope() string + func (d *Definition) Type() reflector.Type + type DefinitionRegistry interface + Contains func(name string) bool + Count func() int + DefinitionNames func() []string + DefinitionNamesByType func(requiredType reflector.Type) []string + Definitions func() []*Definition + Find func(name string) (*Definition, bool) + Register func(def *Definition) error + Remove func(name string) error + func NewDefinitionRegistry(defs []*Definition) DefinitionRegistry + type Hook struct + OnPostInitialization func(string, any) (any, error) + OnPreInitialization func(string, any) (any, error) + func PostInitialization[F HookFunc](f F) *Hook + func PreInitialization[F HookFunc](f F) *Hook + type HookFunc interface + type Hooks interface + Add func(hook *Hook) error + Count func() int + Remove func(hook *Hook) + RemoveAll func() + ToSlice func() []*Hook + func NewHooks() Hooks + type Input struct + func (i *Input) Index() int + func (i *Input) IsOptional() bool + func (i *Input) Name() string + func (i *Input) Type() reflector.Type + type Option func(def *Definition) error + func Name(name string) Option + func OptionalAt(index int) Option + func Optional[T any]() Option + func QualifierAt(index int, name string) Option + func Qualifier[T any](name string) Option + func Scoped(scope string) Option + type PostConstructor interface + PostConstruct func() error + type PostInitializationHook interface + OnPostInitialization func(name string, instance any) (any, error) + type PreInitializationHook interface + OnPreInitialization func(name string, instance any) (any, error) + type Scope interface + GetObject func(ctx context.Context, name string, ...) (any, error) + RemoveObject func(ctx context.Context, name string) (any, error) + type SharedInstances interface + Contains func(name string) bool + Count func() int + Find func(name string) (any, bool) + FindAllByType func(requiredType reflector.Type) []any + FindByType func(requiredType reflector.Type) (any, error) + InstanceNames func() []string + OrElseGet func(name string, supplier func() (any, error)) (any, error) + Register func(name string, instance any) error + func NewSharedInstances() SharedInstances