Documentation ¶
Index ¶
- func GetStructName(i interface{}) string
- type ApplicationContext
- func (ctx *ApplicationContext) GetInstanceByName(instanceName string) (interface{}, error)
- func (ctx *ApplicationContext) GetInstanceByType(instanceType interface{}) (interface{}, error)
- func (ctx *ApplicationContext) MustGetInstance(instanceTypeOrName interface{}) interface{}
- func (ctx *ApplicationContext) RegisterInstance(instance interface{})
- func (ctx *ApplicationContext) RegisterInstanceWithName(instance interface{}, instanceName string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStructName ¶
func GetStructName(i interface{}) string
Types ¶
type ApplicationContext ¶
type ApplicationContext struct {
// contains filtered or unexported fields
}
ApplicationContext定义
func NewApplicationContext ¶
func NewApplicationContext() *ApplicationContext
NewApplicationContext创建一个新的ApplicationContext
func (*ApplicationContext) GetInstanceByName ¶
func (ctx *ApplicationContext) GetInstanceByName(instanceName string) (interface{}, error)
GetInstance根据InstanceName获取实例
func (*ApplicationContext) GetInstanceByType ¶
func (ctx *ApplicationContext) GetInstanceByType(instanceType interface{}) (interface{}, error)
GetInstance根据类型获取实例
func (*ApplicationContext) MustGetInstance ¶
func (ctx *ApplicationContext) MustGetInstance(instanceTypeOrName interface{}) interface{}
MustGetInstance获取实例,如果不存在则panic
func (*ApplicationContext) RegisterInstance ¶
func (ctx *ApplicationContext) RegisterInstance(instance interface{})
RegisterInstance注册一个实例
func (*ApplicationContext) RegisterInstanceWithName ¶
func (ctx *ApplicationContext) RegisterInstanceWithName(instance interface{}, instanceName string)
Click to show internal directories.
Click to hide internal directories.