Documentation
¶
Index ¶
- func Injectable(v ...interface{}) uint
- func NewIOCloserProvider(v io.Closer) (closer *ioCloserProvider)
- func NewPoolProvider(pool *sync.Pool, v interface{}) (pooler *poolerProvider)
- func TypeOf(i interface{}) reflect.Type
- func TypeOfElem(i interface{}) reflect.Type
- type Disposer
- type Initializer
- type InitializerFunc
- type Provider
- type ProviderFunc
- type Registry
- func (r *Registry) Container() *Registry
- func (r *Registry) Dispose() int64
- func (r *Registry) Fork() (child *Registry)
- func (r *Registry) Inject(target interface{})
- func (r *Registry) InjectValue(value reflect.Value)
- func (r *Registry) Load(dst interface{})
- func (r *Registry) LoadType(typ reflect.Type) (val interface{})
- func (r *Registry) LoadValue(dst reflect.Value)
- func (r *Registry) MapInitializer(typ reflect.Type, initializer Initializer)
- func (r *Registry) MapInitializerFunc(typ reflect.Type, initializer InitializerFunc)
- func (r *Registry) MapProvider(typ reflect.Type, provider Provider)
- func (r *Registry) MustDispose()
- func (r *Registry) WithTypeAndProviderFunc(typ reflect.Type, provider ProviderFunc)
- func (r *Registry) WithTypeAndValue(typOf reflect.Type, value interface{})
- func (r *Registry) WithValues(values ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Injectable ¶
func Injectable(v ...interface{}) uint
Injectable marks the type as field to be injectable while searching for fields to inject
func NewIOCloserProvider ¶
func NewPoolProvider ¶
func TypeOfElem ¶
Types ¶
type Initializer ¶
type InitializerFunc ¶
type ProviderFunc ¶
type ProviderFunc func(c *Registry) interface{}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) Dispose ¶
Dispose call end when the request is not need any more, this will cause all finalizers to run, this will my cause parent scopes to end also, this will happen case the parent scopes already ended but is waiting all children to end
func (*Registry) Fork ¶
Fork creates a new context using current value's repository as provider for the new context
func (*Registry) Inject ¶
func (r *Registry) Inject(target interface{})
Inject walks the target looking the for exported fields that types match injectable types in Registry
func (*Registry) InjectValue ¶
InjectValue walks the struct value looking to injectable fields
func (*Registry) MapInitializer ¶
func (r *Registry) MapInitializer(typ reflect.Type, initializer Initializer)
func (*Registry) MapInitializerFunc ¶
func (r *Registry) MapInitializerFunc(typ reflect.Type, initializer InitializerFunc)
func (*Registry) MustDispose ¶
func (r *Registry) MustDispose()
MustDispose works same as End, but require that all children to be terminated when called
func (*Registry) WithTypeAndProviderFunc ¶
func (r *Registry) WithTypeAndProviderFunc(typ reflect.Type, provider ProviderFunc)
func (*Registry) WithTypeAndValue ¶
WithTypeAndValue sets a provider for the type of typ with value of val
func (*Registry) WithValues ¶
func (r *Registry) WithValues(values ...interface{})
WithValues puts the list of values into the current context