Documentation
¶
Index ¶
- type Builder
- type Container
- type ErrParameterProvideFailed
- type ErrParameterProviderNotFound
- type ExtractOption
- type ExtractParams
- type Graph
- type Interactor
- type InvokeOption
- type InvokeParams
- type Parameter
- type ParameterBag
- func (b ParameterBag) Exists(key string) bool
- func (b ParameterBag) Float64(key string) (float64, bool)
- func (b ParameterBag) Get(key string) (interface{}, bool)
- func (b ParameterBag) Int(key string) (int, bool)
- func (b ParameterBag) Int64(key string) (int64, bool)
- func (b ParameterBag) Require(key string) interface{}
- func (b ParameterBag) RequireFloat64(key string) float64
- func (b ParameterBag) RequireInt(key string) int
- func (b ParameterBag) RequireInt64(key string) int64
- func (b ParameterBag) RequireString(key string) string
- func (b ParameterBag) String(key string) (string, bool)
- type ProvideOption
- type ProvideParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface {
Provide(provider interface{}, options ...ProvideOption)
}
Builder is helper interface.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container is a dependency injection container.
func (*Container) Cleanup ¶
func (c *Container) Cleanup()
Cleanup runs destructors in order that was been created.
func (*Container) Compile ¶
func (c *Container) Compile()
Compile compiles the container. It iterates over all nodes in graph and register their parameters.
func (*Container) Extract ¶
func (c *Container) Extract(target interface{}, options ...ExtractOption) error
Extract builds instance of target type and fills target pointer.
func (*Container) Invoke ¶
func (c *Container) Invoke(fn interface{}, options ...InvokeOption) error
Invoke calls provided function.
func (*Container) Provide ¶
func (c *Container) Provide(constructor interface{}, options ...ProvideOption)
Provide adds constructor into container with parameters.
type ErrParameterProvideFailed ¶
type ErrParameterProvideFailed struct {
// contains filtered or unexported fields
}
ErrParameterProvideFailed
func (ErrParameterProvideFailed) Error ¶
func (e ErrParameterProvideFailed) Error() string
type ErrParameterProviderNotFound ¶
type ErrParameterProviderNotFound struct {
// contains filtered or unexported fields
}
ErrParameterProviderNotFound
func (ErrParameterProviderNotFound) Error ¶
func (e ErrParameterProviderNotFound) Error() string
type ExtractOption ¶
type ExtractOption interface {
// contains filtered or unexported methods
}
ExtractOption
type Interactor ¶
type Interactor interface { Extract(target interface{}, options ...ExtractOption) error Invoke(fn interface{}, options ...InvokeOption) error }
Interactor is a helper interface.
type InvokeOption ¶
type InvokeOption interface {
// contains filtered or unexported methods
}
InvokeOption
type ParameterBag ¶
type ParameterBag map[string]interface{}
ParameterBag
func (ParameterBag) RequireFloat64 ¶
func (b ParameterBag) RequireFloat64(key string) float64
RequireFloat64
func (ParameterBag) RequireInt64 ¶
func (b ParameterBag) RequireInt64(key string) int64
RequireInt64
func (ParameterBag) RequireString ¶
func (b ParameterBag) RequireString(key string) string
RequireString
type ProvideOption ¶
type ProvideOption interface {
// contains filtered or unexported methods
}
ExtractOption
type ProvideParams ¶
type ProvideParams struct { Name string Interfaces []interface{} Parameters ParameterBag IsPrototype bool }
ProvideParams is a `Provide()` method options. Name is a unique identifier of type instance. Provider is a constructor function. Interfaces is a interface that implements a provider result type.