Documentation ¶
Index ¶
- func InitContainer()
- func IsRegister[TInterface any](iocName ...string) bool
- func IsRegisterType(interfaceType reflect.Type, iocName ...string) bool
- func NewComponentModel(name string, lifecycle eumLifecycle.Enum, interfaceType reflect.Type, ...) *componentModel
- func NewComponentModelByInstance(name string, lifecycle eumLifecycle.Enum, interfaceType reflect.Type, ...) *componentModel
- func NewContainer() *container
- func Register(constructor any, iocName ...string)
- func RegisterInstance[TInterface any](ins TInterface, iocName ...string)
- func RegisterTransient(constructor any, iocName ...string)
- func Remove[TInterface any](iocName ...string)
- func RemoveUnused[TInterface any](ttl time.Duration)
- func Resolve[TInterface any](iocName ...string) TInterface
- func ResolveAll[TInterface any]() []TInterface
- func ResolveIns[TIns any](ins TIns) TIns
- func ResolveType(interfaceType reflect.Type, iocName ...string) (any, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitContainer ¶
func InitContainer()
func IsRegister ¶ added in v0.5.0
IsRegister 是否注册过
func IsRegisterType ¶ added in v0.12.0
IsRegisterType 判断类型是否注册过
func NewComponentModel ¶ added in v0.4.0
func NewComponentModelByInstance ¶ added in v0.4.0
func RegisterInstance ¶ added in v0.4.0
RegisterInstance 注册实例,默认使用单例
func RegisterTransient ¶ added in v0.4.0
RegisterTransient 注册实例,默认使用单例
func RemoveUnused ¶ added in v0.8.0
RemoveUnused 移除长时间未使用的实例
func ResolveAll ¶ added in v0.7.0
func ResolveAll[TInterface any]() []TInterface
ResolveAll 从容器中获取所有实例
func ResolveIns ¶ added in v0.7.0
func ResolveIns[TIns any](ins TIns) TIns
ResolveIns 将现有中实例内的字段做注入操作
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.