Documentation ¶
Index ¶
- type Container
- type NewInstance
- type ServiceProvider
- type WebContainer
- func (web *WebContainer) Bind(provider ServiceProvider) error
- func (web *WebContainer) IsBind(key string) bool
- func (web *WebContainer) Make(key string) (interface{}, error)
- func (web *WebContainer) MakeNew(key string, params []interface{}) (interface{}, error)
- func (web *WebContainer) MustMake(key string) interface{}
- func (web *WebContainer) PrintProviders() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container interface { // Bind a service provider if keyword exists will be replace and return error Bind(provider ServiceProvider) error // IsBind identify check service provider has been bind IsBind(key string) bool // Make service by key identify Make(key string) (interface{}, error) // Make service by key identify, if key does not bound service provider will throw panic // So using the interfae must be sure keep service container already assign key identify bind service provider MustMake(key string) interface{} // MakeNew get service by key identify, but is not singleton // New instance by service provider register boot function pass paramters // This function is useful when you need to start different instances for different parameters MakeNew(key string, params []interface{}) (interface{}, error) }
Define container is server container Privoder bindig service
type NewInstance ¶
type NewInstance func(...interface{}) (interface{}, error)
NewInstance create all container service
type ServiceProvider ¶
type ServiceProvider interface { // Register register instance on container Register(Container) NewInstance // Boot return error service instance fail Boot(Container) error // IsDefer false don't need delay initialization // true need delay initialization IsDefer() bool // Params define new instance paramters Params(Container) []interface{} // Name represent service identify Name() string }
ServiceProvider define Service providder
type WebContainer ¶
type WebContainer struct { Container // contains filtered or unexported fields }
WebContainer
func (*WebContainer) Bind ¶
func (web *WebContainer) Bind(provider ServiceProvider) error
func (*WebContainer) MakeNew ¶
func (web *WebContainer) MakeNew(key string, params []interface{}) (interface{}, error)
MakeNew
func (*WebContainer) PrintProviders ¶
func (web *WebContainer) PrintProviders() []string
PrintPrivoders print registered provider key name
Directories ¶
Path | Synopsis |
---|---|
Package gin implements a HTTP web framework called gin.
|
Package gin implements a HTTP web framework called gin. |
provider
|
|
Click to show internal directories.
Click to hide internal directories.