Documentation
¶
Index ¶
- type Application
- func (e *Application) GetCache() cache.Cache
- func (e *Application) GetDefaultGormClient() *gorm.Client
- func (e *Application) GetGormClient(name string) *gorm.Client
- func (e *Application) GetGormClients() map[string]*gorm.Client
- func (e *Application) GetInterface(s string) any
- func (e *Application) GetKey() key.Key
- func (e *Application) GetLocker() locker.Locker
- func (e *Application) GetOSS() oss.OSS
- func (e *Application) GetQueue() queue.Queue
- func (e *Application) GetStreamMessage(id string, value map[string]interface{}) (data.Message, error)
- func (e *Application) GetTranslator() translator.Translator
- func (e *Application) SetCache(c cache.Cache)
- func (e *Application) SetGormClients(gormClients map[string]*gorm.Client)
- func (e *Application) SetInterface(s string, a any)
- func (e *Application) SetKey(value key.Key)
- func (e *Application) SetLocker(locker locker.Locker)
- func (e *Application) SetOSS(oss oss.OSS)
- func (e *Application) SetQueue(c queue.Queue)
- func (e *Application) SetTranslator(translatorValue translator.Translator)
- type Runtime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application 保存业务系统共享的基础设施实例。
func (*Application) GetDefaultGormClient ¶ added in v0.0.69
func (e *Application) GetDefaultGormClient() *gorm.Client
GetDefaultGormClient 获取默认数据库客户端。
func (*Application) GetGormClient ¶
func (e *Application) GetGormClient(name string) *gorm.Client
GetGormClient 按名称获取数据库客户端,未找到时回退到默认客户端。
func (*Application) GetGormClients ¶ added in v0.0.69
func (e *Application) GetGormClients() map[string]*gorm.Client
GetGormClients 获取数据库客户端集合。
func (*Application) GetInterface ¶
func (e *Application) GetInterface(s string) any
GetInterface 按名称获取自定义实例。
func (*Application) GetStreamMessage ¶
func (e *Application) GetStreamMessage(id string, value map[string]interface{}) (data.Message, error)
GetStreamMessage 创建队列流消息。
func (*Application) GetTranslator ¶ added in v0.0.68
func (e *Application) GetTranslator() translator.Translator
GetTranslator 获取翻译器。
func (*Application) SetGormClients ¶ added in v0.0.69
func (e *Application) SetGormClients(gormClients map[string]*gorm.Client)
SetGormClients 设置数据库客户端集合。
func (*Application) SetInterface ¶
func (e *Application) SetInterface(s string, a any)
SetInterface 按名称保存自定义实例。
func (*Application) SetKey ¶ added in v0.0.78
func (e *Application) SetKey(value key.Key)
SetKey 设置密钥实例。
func (*Application) SetLocker ¶
func (e *Application) SetLocker(locker locker.Locker)
SetLocker 设置分布式锁实例。
func (*Application) SetTranslator ¶ added in v0.0.68
func (e *Application) SetTranslator(translatorValue translator.Translator)
SetTranslator 设置翻译器。
type Runtime ¶
type Runtime interface {
// SetInterface 按名称保存自定义实例。
SetInterface(string, any)
// GetInterface 按名称获取自定义实例。
GetInterface(string) any
// SetGormClients 设置数据库客户端集合。
SetGormClients(clients map[string]*gorm.Client)
// GetGormClients 获取数据库客户端集合。
GetGormClients() map[string]*gorm.Client
// GetDefaultGormClient 获取默认数据库客户端。
GetDefaultGormClient() *gorm.Client
// GetGormClient 按名称获取数据库客户端,未找到时回退到默认客户端。
GetGormClient(name string) *gorm.Client
// SetCache 设置缓存实例。
SetCache(cache.Cache)
// GetCache 获取缓存实例。
GetCache() cache.Cache
// SetOSS 设置对象存储实例。
SetOSS(oss.OSS)
// GetOSS 获取对象存储实例。
GetOSS() oss.OSS
// SetLocker 设置分布式锁实例。
SetLocker(locker.Locker)
// GetLocker 获取分布式锁实例。
GetLocker() locker.Locker
// SetQueue 设置队列实例。
SetQueue(queue.Queue)
// GetQueue 获取队列实例。
GetQueue() queue.Queue
// SetTranslator 设置翻译器。
SetTranslator(translator.Translator)
// GetTranslator 获取翻译器。
GetTranslator() translator.Translator
// SetKey 设置密钥实例。
SetKey(value key.Key)
// GetKey 获取密钥实例。
GetKey() key.Key
// GetStreamMessage 创建队列流消息。
GetStreamMessage(id string, value map[string]interface{}) (data.Message, error)
}
Runtime 定义业务系统共享基础设施实例的存取能力。
Click to show internal directories.
Click to hide internal directories.