Documentation
¶
Index ¶
- type Container
- type NewInstance
- type ServiceProvider
- type WebContainer
- func (con *WebContainer) Bind(provider ServiceProvider) error
- func (con *WebContainer) IsBind(key string) bool
- func (con *WebContainer) Make(key string) (any, error)
- func (con *WebContainer) MakeNew(key string, parmas []any) (any, error)
- func (con *WebContainer) MustMake(key string) any
- func (con *WebContainer) NameList() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container interface {
// Bind 绑定一个服务提供者,如果关键字凭证已经存在,会进行替换
Bind(provider ServiceProvider) error
// IsBind 关键字凭证是否已绑定服务提供者
IsBind(key string) bool
// Make 根据关键字凭证获取一个服务提供者
Make(key string) (any, error)
// MustMake 根据关键字凭证获取一个服务,如果这个关键字凭证未绑定服务提供者,那么panic
MustMake(key string) any
// MakeNew 根据关键字凭证获取一个服务,只是这个服务并不是单例的
// 它是根据服务提供者注册的启动函数和传递的params参数实例化出来的
// 这个函数在需要为不同参数启动不同实例时候非常有用
MakeNew(key string, params []any) (any, error)
}
type NewInstance ¶
type ServiceProvider ¶
type WebContainer ¶
type WebContainer struct {
// 强制要求WebContainer实现Container接口
Container
// contains filtered or unexported fields
}
func NewWebContainer ¶
func NewWebContainer() *WebContainer
func (*WebContainer) Bind ¶
func (con *WebContainer) Bind(provider ServiceProvider) error
func (*WebContainer) IsBind ¶
func (con *WebContainer) IsBind(key string) bool
func (*WebContainer) MakeNew ¶
func (con *WebContainer) MakeNew(key string, parmas []any) (any, error)
func (*WebContainer) MustMake ¶
func (con *WebContainer) MustMake(key string) any
func (*WebContainer) NameList ¶
func (con *WebContainer) NameList() []string
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.