Documentation
¶
Index ¶
- type ConditionInjectionFunc
- type Container
- func (c *Container) Bind(abstract, instance interface{}, singleton bool)
- func (c *Container) BindFunc(abs interface{}, register InstanceRegister, singleton bool)
- func (c *Container) Bound(abs interface{}) bool
- func (c *Container) Clone() Interface
- func (c *Container) GetRegisters() map[interface{}]InstanceRegister
- func (c *Container) InjectionCondition(f ConditionInjectionFunc, i InjectionFunc)
- func (c *Container) InjectionRequire(requireAbs interface{}, i InjectionFunc)
- func (c *Container) InjectionWith(i InjectionFunc)
- func (c *Container) Instance(abs interface{}) (instance reflect.Value, e error)
- func (c *Container) InstanceFor(abs interface{}, out interface{}) error
- func (c *Container) Invoke(f interface{}) ([]reflect.Value, error)
- func (c *Container) IsSingleton(abs interface{}) bool
- func (c *Container) MethodCall(abs interface{}, method string) ([]reflect.Value, error)
- func (c *Container) Register(instance interface{}, singleton bool)
- func (c *Container) RegisterSingleton(instance interface{})
- func (c *Container) Singleton(abs interface{}, instance interface{})
- func (c *Container) WithInjector(h Injector)
- type InjectPassedError
- type InjectionFunc
- type Injector
- type InstanceRegister
- type Interface
- type UnregisterdAbstractError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConditionInjectionFunc ¶
type ConditionInjectionFunc func(abs interface{}) bool
ConditionInjectionFunc conditional injection function
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container is a IoC-Container
func (*Container) Bind ¶
Bind: pre-bind abstract to container
Abstract could be string,reflect.Type,struct or pointer Instance could be reflect.Value, struct, pointer or InstanceRegister
func (*Container) BindFunc ¶
func (c *Container) BindFunc(abs interface{}, register InstanceRegister, singleton bool)
func (*Container) GetRegisters ¶
func (c *Container) GetRegisters() map[interface{}]InstanceRegister
func (*Container) InjectionCondition ¶
func (c *Container) InjectionCondition(f ConditionInjectionFunc, i InjectionFunc)
func (*Container) InjectionRequire ¶
func (c *Container) InjectionRequire(requireAbs interface{}, i InjectionFunc)
func (*Container) InjectionWith ¶
func (c *Container) InjectionWith(i InjectionFunc)
func (*Container) InstanceFor ¶
func (*Container) IsSingleton ¶
func (*Container) MethodCall ¶
func (*Container) RegisterSingleton ¶
func (c *Container) RegisterSingleton(instance interface{})
func (*Container) WithInjector ¶
type InjectPassedError ¶ added in v0.0.14
type InjectPassedError struct { }
func (InjectPassedError) Error ¶ added in v0.0.14
func (InjectPassedError) Error() string
type InjectionFunc ¶
InjectionFunc injection function
type Injector ¶
type Injector interface { Injection(abs interface{}, last reflect.Value) (reflect.Value, error) When(abs interface{}) bool }
Injector interface for conditional initializer
type InstanceRegister ¶
InstanceRegister register instance for container
type Interface ¶
type Interface interface { BindFunc(abs interface{}, register InstanceRegister, singleton bool) Bind(abstract, instance interface{}, singleton bool) Instance(abs interface{}) (instance reflect.Value, e error) InstanceFor(abs interface{}, out interface{}) error Invoke(f interface{}) ([]reflect.Value, error) MethodCall(abs interface{}, method string) ([]reflect.Value, error) RegisterSingleton(instance interface{}) Register(instance interface{}, singleton bool) Singleton(abs interface{}, instance interface{}) WithInjector(h Injector) InjectionWith(i InjectionFunc) InjectionRequire(requireAbs interface{}, i InjectionFunc) InjectionCondition(f ConditionInjectionFunc, i InjectionFunc) IsSingleton(abs interface{}) bool Bound(abs interface{}) bool GetRegisters() map[interface{}]InstanceRegister Clone() Interface }
type UnregisterdAbstractError ¶
type UnregisterdAbstractError struct {
Abs string
}
func (UnregisterdAbstractError) Error ¶
func (u UnregisterdAbstractError) Error() string
Click to show internal directories.
Click to hide internal directories.