Documentation ¶
Index ¶
- Constants
- func Register(constructor Constructor, options ...Option)
- type Constructor
- type Container
- type Definition
- type DefinitionRegistry
- type Hook
- type HookFunc
- type Hooks
- type Input
- type Option
- type PostConstructor
- type PostInitializationHook
- type PreInitializationHook
- type Scope
- type SharedInstances
Constants ¶
View Source
const ( PrototypeScope = "prototype" )
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(constructor Constructor, options ...Option)
Types ¶
type Constructor ¶
type Constructor any
type Container ¶
type Container interface { Start() error DefinitionRegistry() DefinitionRegistry Hooks() Hooks Get(ctx context.Context, name string) (any, error) GetByNameAndType(ctx context.Context, name string, typ reflector.Type) (any, error) GetByNameAndArgs(ctx context.Context, name string, args ...any) (any, error) GetByType(ctx context.Context, typ reflector.Type) (any, error) GetInstancesByType(ctx context.Context, requiredType reflector.Type) ([]any, error) Contains(name string) bool IsPrototype(name string) bool RegisterResolvable(typ reflector.Type, object any) error ScopeNames() []string GetScope(scopeName string) (Scope, error) }
func WithDefinitions ¶
func WithDefinitions(definitions []*Definition) Container
type Definition ¶
type Definition struct {
// contains filtered or unexported fields
}
func MakeDefinition ¶
func MakeDefinition(constructor Constructor, options ...Option) (*Definition, error)
func RegisteredDefinitions ¶
func RegisteredDefinitions() []*Definition
func (*Definition) Constructor ¶
func (d *Definition) Constructor() reflector.Function
func (*Definition) Inputs ¶
func (d *Definition) Inputs() []*Input
func (*Definition) IsPrototype ¶
func (d *Definition) IsPrototype() bool
func (*Definition) IsShared ¶
func (d *Definition) IsShared() 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 DefinitionRegistry ¶
type DefinitionRegistry interface { Register(def *Definition) error Remove(name string) error Contains(name string) bool Find(name string) (*Definition, bool) Definitions() []*Definition DefinitionNames() []string DefinitionNamesByType(requiredType reflector.Type) []string Count() int }
func NewDefinitionRegistry ¶
func NewDefinitionRegistry(defs []*Definition) DefinitionRegistry
type Hook ¶
type Hook struct { OnPreInitialization func(string, any) (any, error) OnPostInitialization func(string, any) (any, error) }
func PostInitialization ¶
func PreInitialization ¶
type Hooks ¶
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
func (*Input) IsOptional ¶
type PostConstructor ¶
type PostConstructor interface {
PostConstruct() error
}
type PostInitializationHook ¶
type PreInitializationHook ¶
type SharedInstances ¶
type SharedInstances interface {}
func NewSharedInstances ¶
func NewSharedInstances() SharedInstances
Click to show internal directories.
Click to hide internal directories.