Documentation ¶
Index ¶
- func NewCache(prefix string, store storage.AdapterCache, wxTokenStoreKey string) storage.AdapterCache
- func NewLocker(prefix string, locker storage.AdapterLocker) storage.AdapterLocker
- func NewQueue(prefix string, queue storage.AdapterQueue) storage.AdapterQueue
- type Amqp
- type Application
- func (e *Application) GetAmqpAdapter() message.AdapterAmqp
- func (e *Application) GetAmqpAdapters() map[string]message.AdapterAmqp
- func (e *Application) GetAmqpKey(key string) message.AdapterAmqp
- func (e *Application) GetCacheAdapter() storage.AdapterCache
- func (e *Application) GetCachePrefix(key string) storage.AdapterCache
- func (e *Application) GetCasbin() map[string]*casbin.SyncedEnforcer
- func (e *Application) GetCasbinKey(key string) *casbin.SyncedEnforcer
- func (e *Application) GetCrontab() map[string]*cron.Cron
- func (e *Application) GetCrontabKey(key string) *cron.Cron
- func (e *Application) GetDb() map[string]*gorm.DB
- func (e *Application) GetDbByKey(key string) *gorm.DB
- func (e *Application) GetEngine() http.Handler
- func (e *Application) GetFileStoreAdapter() storage.AdapterFileStore
- func (e *Application) GetFileStoreAdapters() map[string]storage.AdapterFileStore
- func (e *Application) GetFileStoreKey(key string) storage.AdapterFileStore
- func (e *Application) GetHandler() map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
- func (e *Application) GetHandlerPrefix(key string) []func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
- func (e *Application) GetLockerAdapter() storage.AdapterLocker
- func (e *Application) GetLockerPrefix(key string) storage.AdapterLocker
- func (e *Application) GetLogger() logger.Logger
- func (e *Application) GetMailAdapter() message.AdapterMail
- func (e *Application) GetMailAdapters() map[string]message.AdapterMail
- func (e *Application) GetMailKey(key string) message.AdapterMail
- func (e *Application) GetMemoryQueue(prefix string) storage.AdapterQueue
- func (e *Application) GetMiddleware() map[string]interface{}
- func (e *Application) GetMiddlewareKey(key string) interface{}
- func (e *Application) GetQueueAdapter() storage.AdapterQueue
- func (e *Application) GetQueuePrefix(key string) storage.AdapterQueue
- func (e *Application) GetRouter() []Router
- func (e *Application) GetSmsAdapter() message.AdapterSms
- func (e *Application) GetSmsAdapters() map[string]message.AdapterSms
- func (e *Application) GetSmsKey(key string) message.AdapterSms
- func (e *Application) GetStreamMessage(id, stream string, value map[string]interface{}) (storage.Messager, error)
- func (e *Application) GetThirdPartyAdapter() message.AdapterThirdParty
- func (e *Application) GetThirdPartyAdapters() map[string]message.AdapterThirdParty
- func (e *Application) GetThirdPartyKey(key string) message.AdapterThirdParty
- func (e *Application) SetAmqpAdapter(key string, c message.AdapterAmqp)
- func (e *Application) SetCacheAdapter(c storage.AdapterCache)
- func (e *Application) SetCasbin(key string, enforcer *casbin.SyncedEnforcer)
- func (e *Application) SetCrontab(key string, crontab *cron.Cron)
- func (e *Application) SetDb(key string, db *gorm.DB)
- func (e *Application) SetEngine(engine http.Handler)
- func (e *Application) SetFileStoreAdapter(key string, c storage.AdapterFileStore)
- func (e *Application) SetHandler(key string, routerGroup func(r *gin.RouterGroup, hand ...*gin.HandlerFunc))
- func (e *Application) SetLockerAdapter(c storage.AdapterLocker)
- func (e *Application) SetLogger(l logger.Logger)
- func (e *Application) SetMailAdapter(key string, c message.AdapterMail)
- func (e *Application) SetMiddleware(key string, middleware interface{})
- func (e *Application) SetQueueAdapter(c storage.AdapterQueue)
- func (e *Application) SetSmsAdapter(key string, c message.AdapterSms)
- func (e *Application) SetThirdPartyAdapter(key string, c message.AdapterThirdParty)
- type Cache
- func (e Cache) Connect() error
- func (e Cache) Decrease(key string) error
- func (e Cache) Del(key string) error
- func (e Cache) Expire(key string, dur time.Duration) error
- func (e Cache) Get(key string) (string, error)
- func (e Cache) HashDel(hk, key string) error
- func (e Cache) HashGet(hk, key string) (string, error)
- func (e Cache) HashKeys(hk string) ([]string, error)
- func (e Cache) HashSet(hk, key string, val interface{}, expire int) error
- func (e Cache) Increase(key string) error
- func (e Cache) PutToken(token *oauth2.Token) error
- func (e Cache) Set(key string, val interface{}, expire int) error
- func (e *Cache) SetPrefix(prefix string)
- func (e *Cache) String() string
- func (e Cache) Token() (token *oauth2.Token, err error)
- type FileStore
- type Locker
- type Mail
- type Queue
- type Router
- type Routers
- type Runtime
- type Sms
- type ThirdParty
- func (e *ThirdParty) GetAccessToken(force bool) (string, error)
- func (e *ThirdParty) GetConnectUrl(state, scope, redirectUrl string, popUp bool) (string, error)
- func (e *ThirdParty) GetUserAccessToken(code, state string) (string, error)
- func (e *ThirdParty) GetUserInfo(accessToken, openId string) (string, error)
- func (e *ThirdParty) SendTemplateMessage(openId, templateId, url string, data []byte) (string, error)
- func (e *ThirdParty) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCache ¶
func NewCache(prefix string, store storage.AdapterCache, wxTokenStoreKey string) storage.AdapterCache
NewCache 创建对应上下文缓存
func NewLocker ¶
func NewLocker(prefix string, locker storage.AdapterLocker) storage.AdapterLocker
NewLocker 创建对应上下文分布式锁
func NewQueue ¶
func NewQueue(prefix string, queue storage.AdapterQueue) storage.AdapterQueue
NewQueue 创建对应上下文队列
Types ¶
type Amqp ¶
type Amqp struct {
// contains filtered or unexported fields
}
func (*Amqp) PublishOnQueue ¶
PublishOnQueue 发送消息
func (*Amqp) SubscribeToQueue ¶
func (e *Amqp) SubscribeToQueue(queueName string, consumerName string, f message.AmqpConsumerFunc) error
SubscribeToQueue 消费消息
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func (*Application) GetAmqpAdapter ¶
func (e *Application) GetAmqpAdapter() message.AdapterAmqp
GetAmqpAdapter 获取缓存
func (*Application) GetAmqpAdapters ¶
func (e *Application) GetAmqpAdapters() map[string]message.AdapterAmqp
GetAmqpAdapters 获取缓存
func (*Application) GetAmqpKey ¶
func (e *Application) GetAmqpKey(key string) message.AdapterAmqp
GetAmqpKey 获取带租户标记的amqp
func (*Application) GetCacheAdapter ¶
func (e *Application) GetCacheAdapter() storage.AdapterCache
GetCacheAdapter 获取缓存
func (*Application) GetCachePrefix ¶
func (e *Application) GetCachePrefix(key string) storage.AdapterCache
GetCachePrefix 获取带租户标记的cache
func (*Application) GetCasbin ¶
func (e *Application) GetCasbin() map[string]*casbin.SyncedEnforcer
func (*Application) GetCasbinKey ¶
func (e *Application) GetCasbinKey(key string) *casbin.SyncedEnforcer
GetCasbinKey 根据key获取casbin
func (*Application) GetCrontab ¶
func (e *Application) GetCrontab() map[string]*cron.Cron
GetCrontab 获取所有map里的crontab数据
func (*Application) GetCrontabKey ¶
func (e *Application) GetCrontabKey(key string) *cron.Cron
GetCrontabKey 根据key获取crontab
func (*Application) GetDbByKey ¶
func (e *Application) GetDbByKey(key string) *gorm.DB
GetDbByKey 根据key获取db
func (*Application) GetFileStoreAdapter ¶
func (e *Application) GetFileStoreAdapter() storage.AdapterFileStore
GetFileStoreAdapter 获取缓存
func (*Application) GetFileStoreAdapters ¶
func (e *Application) GetFileStoreAdapters() map[string]storage.AdapterFileStore
GetFileStoreAdapters 获取缓存
func (*Application) GetFileStoreKey ¶
func (e *Application) GetFileStoreKey(key string) storage.AdapterFileStore
GetFileStoreKey 获取带租户标记的cos
func (*Application) GetHandler ¶
func (e *Application) GetHandler() map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
func (*Application) GetHandlerPrefix ¶
func (e *Application) GetHandlerPrefix(key string) []func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
func (*Application) GetLockerAdapter ¶
func (e *Application) GetLockerAdapter() storage.AdapterLocker
GetLockerAdapter 获取分布式锁
func (*Application) GetLockerPrefix ¶
func (e *Application) GetLockerPrefix(key string) storage.AdapterLocker
func (*Application) GetMailAdapter ¶ added in v1.3.13
func (e *Application) GetMailAdapter() message.AdapterMail
GetMailAdapter 获取缓存
func (*Application) GetMailAdapters ¶ added in v1.3.13
func (e *Application) GetMailAdapters() map[string]message.AdapterMail
GetMailAdapters 获取缓存
func (*Application) GetMailKey ¶ added in v1.3.13
func (e *Application) GetMailKey(key string) message.AdapterMail
GetMailKey 获取带租户标记的mail
func (*Application) GetMemoryQueue ¶
func (e *Application) GetMemoryQueue(prefix string) storage.AdapterQueue
func (*Application) GetMiddleware ¶
func (e *Application) GetMiddleware() map[string]interface{}
GetMiddleware 获取所有中间件
func (*Application) GetMiddlewareKey ¶
func (e *Application) GetMiddlewareKey(key string) interface{}
GetMiddlewareKey 获取对应key的中间件
func (*Application) GetQueueAdapter ¶
func (e *Application) GetQueueAdapter() storage.AdapterQueue
GetQueueAdapter 获取队列适配器
func (*Application) GetQueuePrefix ¶
func (e *Application) GetQueuePrefix(key string) storage.AdapterQueue
GetQueuePrefix 获取带租户标记的queue
func (*Application) GetSmsAdapter ¶ added in v1.3.13
func (e *Application) GetSmsAdapter() message.AdapterSms
GetSmsAdapter 获取缓存
func (*Application) GetSmsAdapters ¶ added in v1.3.13
func (e *Application) GetSmsAdapters() map[string]message.AdapterSms
GetSmsAdapters 获取缓存
func (*Application) GetSmsKey ¶ added in v1.3.13
func (e *Application) GetSmsKey(key string) message.AdapterSms
GetSmsKey 获取带租户标记的sms
func (*Application) GetStreamMessage ¶
func (e *Application) GetStreamMessage(id, stream string, value map[string]interface{}) (storage.Messager, error)
GetStreamMessage 获取队列需要用的message
func (*Application) GetThirdPartyAdapter ¶ added in v1.3.16
func (e *Application) GetThirdPartyAdapter() message.AdapterThirdParty
GetThirdPartyAdapter 获取缓存
func (*Application) GetThirdPartyAdapters ¶ added in v1.3.16
func (e *Application) GetThirdPartyAdapters() map[string]message.AdapterThirdParty
GetThirdPartyAdapters 获取缓存
func (*Application) GetThirdPartyKey ¶ added in v1.3.16
func (e *Application) GetThirdPartyKey(key string) message.AdapterThirdParty
GetThirdPartyKey 获取带租户标记的amqp
func (*Application) SetAmqpAdapter ¶
func (e *Application) SetAmqpAdapter(key string, c message.AdapterAmqp)
SetAmqpAdapter 设置缓存
func (*Application) SetCacheAdapter ¶
func (e *Application) SetCacheAdapter(c storage.AdapterCache)
SetCacheAdapter 设置缓存
func (*Application) SetCasbin ¶
func (e *Application) SetCasbin(key string, enforcer *casbin.SyncedEnforcer)
func (*Application) SetCrontab ¶
func (e *Application) SetCrontab(key string, crontab *cron.Cron)
SetCrontab 设置对应key的crontab
func (*Application) SetEngine ¶
func (e *Application) SetEngine(engine http.Handler)
SetEngine 设置路由引擎
func (*Application) SetFileStoreAdapter ¶
func (e *Application) SetFileStoreAdapter(key string, c storage.AdapterFileStore)
SetFileStoreAdapter 设置缓存
func (*Application) SetHandler ¶
func (e *Application) SetHandler(key string, routerGroup func(r *gin.RouterGroup, hand ...*gin.HandlerFunc))
func (*Application) SetLockerAdapter ¶
func (e *Application) SetLockerAdapter(c storage.AdapterLocker)
SetLockerAdapter 设置分布式锁
func (*Application) SetMailAdapter ¶ added in v1.3.13
func (e *Application) SetMailAdapter(key string, c message.AdapterMail)
SetMailAdapter 设置缓存
func (*Application) SetMiddleware ¶
func (e *Application) SetMiddleware(key string, middleware interface{})
SetMiddleware 设置中间件
func (*Application) SetQueueAdapter ¶
func (e *Application) SetQueueAdapter(c storage.AdapterQueue)
SetQueueAdapter 设置队列适配器
func (*Application) SetSmsAdapter ¶ added in v1.3.13
func (e *Application) SetSmsAdapter(key string, c message.AdapterSms)
SetSmsAdapter 设置缓存
func (*Application) SetThirdPartyAdapter ¶ added in v1.3.16
func (e *Application) SetThirdPartyAdapter(key string, c message.AdapterThirdParty)
SetThirdPartyAdapter 设置缓存
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
type Locker ¶
type Locker struct {
// contains filtered or unexported fields
}
type Mail ¶ added in v1.3.13
type Mail struct {
// contains filtered or unexported fields
}
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
type Runtime ¶
type Runtime interface { // SetDb 多db设置,⚠️SetDbs不允许并发,可以根据自己的业务,例如app分库、host分库 SetDb(key string, db *gorm.DB) GetDb() map[string]*gorm.DB GetDbByKey(key string) *gorm.DB SetCasbin(key string, enforcer *casbin.SyncedEnforcer) GetCasbin() map[string]*casbin.SyncedEnforcer GetCasbinKey(key string) *casbin.SyncedEnforcer // SetEngine 使用的路由 SetEngine(engine http.Handler) GetEngine() http.Handler GetRouter() []Router // SetLogger 使用go-admin定义的logger,参考来源go-micro SetLogger(logger logger.Logger) GetLogger() logger.Logger // SetCrontab crontab SetCrontab(key string, crontab *cron.Cron) GetCrontab() map[string]*cron.Cron GetCrontabKey(key string) *cron.Cron // SetMiddleware middleware SetMiddleware(string, interface{}) GetMiddleware() map[string]interface{} GetMiddlewareKey(key string) interface{} // SetCacheAdapter cache SetCacheAdapter(storage.AdapterCache) GetCacheAdapter() storage.AdapterCache GetCachePrefix(string) storage.AdapterCache GetMemoryQueue(string) storage.AdapterQueue SetQueueAdapter(storage.AdapterQueue) GetQueueAdapter() storage.AdapterQueue GetQueuePrefix(string) storage.AdapterQueue SetLockerAdapter(storage.AdapterLocker) GetLockerAdapter() storage.AdapterLocker GetLockerPrefix(string) storage.AdapterLocker SetSmsAdapter(string, message.AdapterSms) GetSmsAdapter() message.AdapterSms GetSmsAdapters() map[string]message.AdapterSms GetSmsKey(key string) message.AdapterSms SetMailAdapter(string, message.AdapterMail) GetMailAdapter() message.AdapterMail GetMailAdapters() map[string]message.AdapterMail GetMailKey(key string) message.AdapterMail SetFileStoreAdapter(string, storage.AdapterFileStore) GetFileStoreAdapter() storage.AdapterFileStore GetFileStoreAdapters() map[string]storage.AdapterFileStore GetFileStoreKey(key string) storage.AdapterFileStore SetAmqpAdapter(string, message.AdapterAmqp) GetAmqpAdapter() message.AdapterAmqp GetAmqpAdapters() map[string]message.AdapterAmqp GetAmqpKey(key string) message.AdapterAmqp SetThirdPartyAdapter(string, message.AdapterThirdParty) GetThirdPartyAdapter() message.AdapterThirdParty GetThirdPartyAdapters() map[string]message.AdapterThirdParty GetThirdPartyKey(key string) message.AdapterThirdParty SetHandler(key string, routerGroup func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)) GetHandler() map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc) GetHandlerPrefix(key string) []func(r *gin.RouterGroup, hand ...*gin.HandlerFunc) GetStreamMessage(id, stream string, value map[string]interface{}) (storage.Messager, error) }
type Sms ¶ added in v1.3.13
type Sms struct {
// contains filtered or unexported fields
}
type ThirdParty ¶ added in v1.3.16
type ThirdParty struct {
// contains filtered or unexported fields
}
func (*ThirdParty) GetAccessToken ¶ added in v1.3.16
func (e *ThirdParty) GetAccessToken(force bool) (string, error)
GetAccessToken 获取access token
func (*ThirdParty) GetConnectUrl ¶ added in v1.3.16
func (e *ThirdParty) GetConnectUrl(state, scope, redirectUrl string, popUp bool) (string, error)
func (*ThirdParty) GetUserAccessToken ¶ added in v1.3.16
func (e *ThirdParty) GetUserAccessToken(code, state string) (string, error)
func (*ThirdParty) GetUserInfo ¶ added in v1.3.16
func (e *ThirdParty) GetUserInfo(accessToken, openId string) (string, error)
func (*ThirdParty) SendTemplateMessage ¶ added in v1.3.16
func (e *ThirdParty) SendTemplateMessage(openId, templateId, url string, data []byte) (string, error)
SendTemplateMessage 发送模板消息