Documentation
¶
Index ¶
- type Container
- type NewInstance
- type OneContainer
- func (one *OneContainer) Bind(provider ServiceProvider) error
- func (one *OneContainer) IsBind(key string) bool
- func (one *OneContainer) Make(key string) (interface{}, error)
- func (one *OneContainer) MakeNew(key string, params []interface{}) (interface{}, error)
- func (one *OneContainer) MustMake(key string) interface{}
- func (one *OneContainer) NameList() []string
- type ServiceProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container interface { // 绑定服务提供者到容器 Bind(provider ServiceProvider) error // 是否已绑定服务提供者 IsBind(key string) bool // 根据关键字获取一个服务 Make(key string) (interface{}, error) // 如果没有绑定,panic MustMake(key string) interface{} // 为不同的参数启动不同的服务实例,不再是单例模式 MakeNew(key string, params []interface{}) (interface{}, error) // 所有服务提供者的KEY NameList() []string }
type NewInstance ¶
type NewInstance func(...interface{}) (interface{}, error)
type OneContainer ¶
type OneContainer struct { // 强制要求OneContainer实现Container Container // contains filtered or unexported fields }
func NewOneContainer ¶
func NewOneContainer() *OneContainer
func (*OneContainer) Bind ¶
func (one *OneContainer) Bind(provider ServiceProvider) error
func (*OneContainer) IsBind ¶
func (one *OneContainer) IsBind(key string) bool
func (*OneContainer) Make ¶
func (one *OneContainer) Make(key string) (interface{}, error)
func (*OneContainer) MakeNew ¶
func (one *OneContainer) MakeNew(key string, params []interface{}) (interface{}, error)
func (*OneContainer) MustMake ¶
func (one *OneContainer) MustMake(key string) interface{}
func (*OneContainer) NameList ¶
func (one *OneContainer) NameList() []string
NameList 列出容器中所有服务提供者的字符串凭证
type ServiceProvider ¶
Directories
¶
Path | Synopsis |
---|---|
Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
|
Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces. |
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.