Documentation
¶
Index ¶
- Variables
- func IsErrDependencyNotFound(err error) bool
- type Container
- func (di *Container) Bind(k interface{}, f func(args ...interface{}) (interface{}, error)) *Container
- func (di *Container) BindSingleton(k interface{}, f func(args ...interface{}) (interface{}, error)) *Container
- func (di *Container) Make(k interface{}, args ...interface{}) (interface{}, error)
- func (di *Container) MustMake(k interface{}, args ...interface{}) interface{}
- type ErrDependencyNotFound
- type Injecter
- type Maker
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDependencyNotFoundMsg = "Dependency '%v' does not exist"
ErrDependencyNotFoundMsg is the error message returned if the Maker is not found
Functions ¶
func IsErrDependencyNotFound ¶ added in v0.1.0
IsErrDependencyNotFound returns whether the given error is a DependencNotFound error
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container is the structure representing the dependency injecter
func (*Container) Bind ¶
func (di *Container) Bind(k interface{}, f func(args ...interface{}) (interface{}, error)) *Container
Bind adds a Maker for the key k to the Container's store.
func (*Container) BindSingleton ¶
func (di *Container) BindSingleton(k interface{}, f func(args ...interface{}) (interface{}, error)) *Container
BindSingleton adds a singleton Maker for the key k to the Container's store. It will always return the same instance returned by the first call to the Maker function.
type ErrDependencyNotFound ¶
type ErrDependencyNotFound error
ErrDependencyNotFound is a custom error type for errors when dependency does not exist
func ErrDependencyNotFoundF ¶ added in v0.1.0
func ErrDependencyNotFoundF(dep interface{}) ErrDependencyNotFound
ErrDependencyNotFoundF returns an ErrDependencyNotFound error with the given dependency
Click to show internal directories.
Click to hide internal directories.