Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
func Initialize(initializers ...Initializer) (Injector, Releaser)
Initialize calls all initializers and returns a compound Injector and Releaser. If an initializer panics, previous releasers are invoked before propagating it.
Types ¶
type Initializer ¶
Initializer initializes a value, returning a corresponding Injector and Releaser.
type Injector ¶
Injector injects values into a Context.
func NewInjectors ¶
NewInjectors combines multiple injectors into one.
func NewNoopInjector ¶ added in v1.1.0
func NewNoopInjector() Injector
NewNoopInjector returns an injector that does nothing.
func NewSingletonInjector ¶
func NewSingletonInjector(contextKey, value interface{}) Injector
NewSingletonInjector always injects the given value using the given context key.
type Releaser ¶
type Releaser func()
Releaser releases an initialized resource.
func NewCloseReleaser ¶
NewCloseReleaser returns a releaser that calls closer.Close, ignoring any returned error.
func NewNoopReleaser ¶
func NewNoopReleaser() Releaser
NewNoopReleaser returns a releaser that does nothing.
func NewReleasers ¶
NewReleasers combines multiple releasers into one (invoking them in reverse order).