Documentation ¶
Index ¶
- Variables
- func AutoMigrateEnv()
- func GetBean(beanName string) (bean interface{}, ok bool)
- func GetBeanName(o interface{}) (name string)
- func GetByType(beanType interface{}) (bean interface{}, ok bool)
- func GetProperty(key string) interface{}
- func IsPtr(o interface{}) bool
- func Load()
- func LoadAndServ(ctx context.Context)
- func LoadEnvironment(replacer *strings.Replacer, trimPrefix bool, prefix ...string) map[string]interface{}
- func LoadProperties(prefix string, propertyType interface{}) interface{}
- func New() *di
- func NewBean(beanType interface{}) (bean interface{})
- func NewBeanByName(beanName string) (bean interface{})
- func Serve(ctx context.Context)
- type AfterPropertiesSet
- type AfterPropertiesSetWithContainer
- type BeanConstruct
- type BeanConstructWithContainer
- type BeanName
- type BeanWithName
- type DI
- func Provide(prototype interface{}) DI
- func ProvideNamedBean(beanName string, prototype interface{}) DI
- func RegisterBean(bean interface{}) DI
- func RegisterNamedBean(name string, bean interface{}) DI
- func SetDefaultProperty(key string, value interface{}) DI
- func SetDefaultPropertyMap(properties map[string]interface{}) DI
- func SetProperty(key string, value interface{}) DI
- func SetPropertyMap(properties map[string]interface{}) DI
- func UseValueStore(v ValueStore) DI
- type Disposable
- type DisposableWithContainer
- type Initialized
- type InitializedWithContainer
- type InjectInfo
- type Injector
- type Log
- type PreInitialize
- type PreInitializeWithContainer
- type ValueStore
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AutoMigrateEnv ¶ added in v0.0.5
func AutoMigrateEnv()
func GetBeanName ¶
func GetBeanName(o interface{}) (name string)
func GetProperty ¶ added in v0.1.5
func GetProperty(key string) interface{}
func LoadAndServ ¶
func LoadEnvironment ¶ added in v0.0.5
func LoadProperties ¶ added in v0.1.5
func LoadProperties(prefix string, propertyType interface{}) interface{}
func NewBeanByName ¶ added in v0.1.0
func NewBeanByName(beanName string) (bean interface{})
Types ¶
type AfterPropertiesSet ¶
type AfterPropertiesSet interface {
AfterPropertiesSet()
}
AfterPropertiesSet Bean实例注入完成
type AfterPropertiesSetWithContainer ¶ added in v0.0.8
type AfterPropertiesSetWithContainer interface {
AfterPropertiesSet(DI)
}
AfterPropertiesSetWithContainer Bean实例注入完成
type BeanConstructWithContainer ¶ added in v0.0.8
type BeanConstructWithContainer interface {
BeanConstruct(DI)
}
BeanConstructWithContainer Bean实例创建时
type BeanWithName ¶ added in v0.1.6
type BeanWithName struct { Name string Bean interface{} }
func GetByTypeAll ¶ added in v0.1.6
func GetByTypeAll(beanType interface{}) (beans []BeanWithName)
type DI ¶
type DI interface { DebugMode(bool) DI Log(log Log) DI RegisterBean(bean interface{}) DI RegisterNamedBean(name string, bean interface{}) DI Provide(prototype interface{}) DI ProvideNamedBean(beanName string, prototype interface{}) DI GetBean(beanName string) (bean interface{}, ok bool) GetByType(beanType interface{}) (bean interface{}, ok bool) GetByTypeAll(beanType interface{}) (beans []BeanWithName) NewBean(beanType interface{}) (bean interface{}) NewBeanByName(beanName string) (bean interface{}) UseValueStore(v ValueStore) DI Property() ValueStore SetDefaultProperty(key string, value interface{}) DI SetDefaultPropertyMap(properties map[string]interface{}) DI SetProperty(key string, value interface{}) DI SetPropertyMap(properties map[string]interface{}) DI GetProperty(key string) interface{} LoadProperties(prefix string, propertyType interface{}) interface{} Load() Serve(ctx context.Context) Context() context.Context }
func ProvideNamedBean ¶ added in v0.0.5
func RegisterBean ¶
func RegisterBean(bean interface{}) DI
func RegisterNamedBean ¶
func SetDefaultProperty ¶
func SetDefaultPropertyMap ¶ added in v0.0.5
func SetProperty ¶
func SetPropertyMap ¶
func UseValueStore ¶
func UseValueStore(v ValueStore) DI
type DisposableWithContainer ¶ added in v0.0.8
type DisposableWithContainer interface {
Destroy(DI)
}
DisposableWithContainer 在Bean注销时调用
type Initialized ¶
type Initialized interface {
Initialized()
}
Initialized 在Bean依赖注入完成后执行,可以理解为DI加载完成的通知事件。
type InitializedWithContainer ¶ added in v0.0.8
type InitializedWithContainer interface {
Initialized(DI)
}
InitializedWithContainer 在Bean依赖注入完成后执行,可以理解为DI加载完成的通知事件。
type InjectInfo ¶ added in v0.1.6
type Injector ¶ added in v0.1.6
type Injector interface {
BeanInject(di DI, info *InjectInfo)
}
Injector bean实例注入器
type PreInitializeWithContainer ¶ added in v0.0.8
type PreInitializeWithContainer interface {
PreInitialize(DI)
}
PreInitializeWithContainer Bean实例依赖注入前
type ValueStore ¶
type ValueStore interface { SetDefault(key string, value interface{}) Set(key string, value interface{}) Get(key string) (val interface{}) GetAll() map[string]interface{} }
func Property ¶
func Property() ValueStore
Source Files ¶
Click to show internal directories.
Click to hide internal directories.