Documentation ¶
Index ¶
- type Cleaner
- type Initializer
- type InjectWrapper
- func (i *InjectWrapper) AllObjects() []interface{}
- func (i *InjectWrapper) CheckNoImplicitObjects() *InjectWrapper
- func (i *InjectWrapper) InitializeGraph() *InjectWrapper
- func (i *InjectWrapper) InitializeGraphWithImplicitObjects() *InjectWrapper
- func (i InjectWrapper) MustGetNamedObject(sample interface{}, name string) interface{}
- func (i InjectWrapper) MustGetObject(sample interface{}) interface{}
- func (i *InjectWrapper) Stop(maxDuration time.Duration)
- func (i *InjectWrapper) Stopper(maxDuration time.Duration) func()
- func (i *InjectWrapper) WithCleanBeforeShutdown(maxDuration time.Duration, sig ...os.Signal) *InjectWrapper
- func (i *InjectWrapper) WithNamedObject(name string, obj interface{}) *InjectWrapper
- func (i *InjectWrapper) WithObject(object interface{}) *InjectWrapper
- func (i *InjectWrapper) WithObjectOrErr(object interface{}, err error) *InjectWrapper
- func (i *InjectWrapper) WithObjects(objects ...interface{}) *InjectWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cleaner ¶
type Cleaner interface {
Clean() error
}
Cleaners are called when everything ends, note that Stop() must be called explicitly.
type Initializer ¶
type Initializer interface {
Init() error
}
type InjectWrapper ¶
type InjectWrapper struct {
// contains filtered or unexported fields
}
func New ¶
func New() *InjectWrapper
func (*InjectWrapper) AllObjects ¶
func (i *InjectWrapper) AllObjects() []interface{}
func (*InjectWrapper) CheckNoImplicitObjects ¶
func (i *InjectWrapper) CheckNoImplicitObjects() *InjectWrapper
func (*InjectWrapper) InitializeGraph ¶
func (i *InjectWrapper) InitializeGraph() *InjectWrapper
InitializeGraph initializes a graph, but fails if an object is not specified with one of the With() methods.
func (*InjectWrapper) InitializeGraphWithImplicitObjects ¶
func (i *InjectWrapper) InitializeGraphWithImplicitObjects() *InjectWrapper
InitializeGraphWithImplicitObjects initializes a graph allowing implicitly created objects. Those are objects not specified with one of the With...() methods.
func (InjectWrapper) MustGetNamedObject ¶
func (i InjectWrapper) MustGetNamedObject(sample interface{}, name string) interface{}
MustFindObject privides an object of the specified type and name (name can be empty for unnamed objects). Note that this function is only for debugging and testing. In production, objects should be used injected and never retrieved with this. That's why this method panics!
func (InjectWrapper) MustGetObject ¶
func (i InjectWrapper) MustGetObject(sample interface{}) interface{}
MustGetObject: see MustGetNamedObject
func (*InjectWrapper) Stop ¶
func (i *InjectWrapper) Stop(maxDuration time.Duration)
func (*InjectWrapper) Stopper ¶
func (i *InjectWrapper) Stopper(maxDuration time.Duration) func()
func (*InjectWrapper) WithCleanBeforeShutdown ¶
func (i *InjectWrapper) WithCleanBeforeShutdown(maxDuration time.Duration, sig ...os.Signal) *InjectWrapper
func (*InjectWrapper) WithNamedObject ¶
func (i *InjectWrapper) WithNamedObject(name string, obj interface{}) *InjectWrapper
func (*InjectWrapper) WithObject ¶
func (i *InjectWrapper) WithObject(object interface{}) *InjectWrapper
func (*InjectWrapper) WithObjectOrErr ¶
func (i *InjectWrapper) WithObjectOrErr(object interface{}, err error) *InjectWrapper
WithObjectOrErr is a helper methods to be used with initializers which return a pointer and error
func (*InjectWrapper) WithObjects ¶
func (i *InjectWrapper) WithObjects(objects ...interface{}) *InjectWrapper