Documentation ¶
Index ¶
- Variables
- func NewContainerByBoot(bootContainer inter.Container) inter.Container
- func NewTestApp(decorator func(container inter.Container) inter.Container) inter.App
- type Application
- func (a *Application) Bind(abstract interface{}, concrete interface{})
- func (a *Application) Container() *inter.Container
- func (a *Application) Db(connectionName ...string) inter.Database
- func (a *Application) Environment() (string, error)
- func (a *Application) Instance(abstract interface{}) interface{}
- func (a *Application) IsEnvironment(environments ...string) bool
- func (a *Application) Log(channels ...string) inter.LoggerFacade
- func (a *Application) Make(abstract interface{}) interface{}
- func (a *Application) MakeE(abstract interface{}) (interface{}, error)
- func (a *Application) SetContainer(container inter.Container)
- func (a *Application) Singleton(abstract interface{}, concrete interface{})
- type Container
- func (c *Container) Bind(abstract interface{}, concrete interface{})
- func (c *Container) Bindings() inter.Bindings
- func (c *Container) Bound(abstract string) bool
- func (c *Container) Extend(abstract interface{}, function func(service interface{}) interface{})
- func (c *Container) Instance(concrete interface{}) interface{}
- func (c *Container) Make(abstract interface{}) interface{}
- func (c *Container) MakeE(abstract interface{}) (interface{}, error)
- func (c *Container) Singleton(abstract interface{}, concrete interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var CanNotInstantiateCallbackWithParameters = errors.New("Can not instantiate callback with parameters")
Functions ¶
func NewContainerByBoot ¶ added in v0.3.1
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApp ¶ added in v0.3.1
func NewApp() *Application
func (*Application) Bind ¶ added in v0.3.1
func (a *Application) Bind(abstract interface{}, concrete interface{})
Bind registers a binding. You can pass the struct or interface that we want to register, along with a closure that returns an instance of the struct.
func (*Application) Container ¶
func (a *Application) Container() *inter.Container
Container fetch the container from the application
func (*Application) Db ¶ added in v0.10.0
func (a *Application) Db(connectionName ...string) inter.Database
func (*Application) Environment ¶ added in v0.3.1
func (a *Application) Environment() (string, error)
func (*Application) Instance ¶ added in v0.3.1
func (a *Application) Instance(abstract interface{}) interface{}
func (*Application) IsEnvironment ¶ added in v0.3.1
func (a *Application) IsEnvironment(environments ...string) bool
func (*Application) Log ¶ added in v0.3.1
func (a *Application) Log(channels ...string) inter.LoggerFacade
func (*Application) Make ¶
func (a *Application) Make(abstract interface{}) interface{}
Make the given type from the container.
func (*Application) MakeE ¶ added in v0.3.1
func (a *Application) MakeE(abstract interface{}) (interface{}, error)
MakeE make or give an error by the given type from the container.
func (*Application) SetContainer ¶ added in v0.3.1
func (a *Application) SetContainer(container inter.Container)
SetContainer set the service container
func (*Application) Singleton ¶ added in v0.3.1
func (a *Application) Singleton(abstract interface{}, concrete interface{})
Singleton registered a shared binding in the container.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶
func NewContainer() *Container
func (*Container) Bind ¶
func (c *Container) Bind(abstract interface{}, concrete interface{})
Register a binding with the container.
func (*Container) Extend ¶ added in v0.3.1
func (c *Container) Extend(abstract interface{}, function func(service interface{}) interface{})
Extend an abstract type in the container.
func (*Container) Instance ¶
func (c *Container) Instance(concrete interface{}) interface{}
Register an existing instance as shared in the container without an abstract
func (*Container) Make ¶
func (c *Container) Make(abstract interface{}) interface{}
MakeE the given type from the container.
Click to show internal directories.
Click to hide internal directories.