inject
--
import "github.com/codegangsta/inject"
Package inject provides utilities for mapping and injecting dependencies in
various ways.
Language Translations:
Usage
func InterfaceOf
func InterfaceOf(value interface{}) reflect.Type
InterfaceOf dereferences a pointer to an Interface type. It panics if value is
not an pointer to an interface.
type Applicator
type Applicator interface {
Apply(interface{}) error
}
Applicator represents an interface for mapping dependencies to a struct.
type Injector
type Injector interface {
Applicator
Invoker
TypeMapper
SetParent(Injector)
}
Injector represents an interface for mapping and injecting dependencies into
structs and function arguments.
func New
func New() Injector
New returns a new Injector.
type Invoker
type Invoker interface {
Invoke(interface{}) ([]reflect.Value, error)
}
Invoker represents an interface for calling functions via reflection.
type TypeMapper
type TypeMapper interface {
Map(interface{}) TypeMapper
MapTo(interface{}, interface{}) TypeMapper
Set(reflect.Type, reflect.Value) TypeMapper
Get(reflect.Type) reflect.Value
}
TypeMapper represents an interface for mapping interface{} values based on type.