Documentation
¶
Index ¶
- Constants
- func NewCache(prefix string, store storage.AdapterCache, wxTokenStoreKey string) storage.AdapterCache
- func NewQueue(prefix string, queue storage.AdapterQueue) storage.AdapterQueue
- type Application
- func (e *Application) GetAllCasbin() map[string]*casbin.SyncedEnforcer
- func (e *Application) GetAllCrontab() map[string]*cron.Cron
- func (e *Application) GetAllDb() map[string]*gorm.DB
- func (e *Application) GetAllHandler() map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
- func (e *Application) GetAllMiddleware() map[string]interface{}
- func (e *Application) GetApp() map[string]interface{}
- func (e *Application) GetAppByTenant(tenant string) interface{}
- func (e *Application) GetAppRouters() []func()
- func (e *Application) GetBefore() []func()
- func (e *Application) GetCacheAdapter() storage.AdapterCache
- func (e *Application) GetCacheAdapterPrefix(prefix string) storage.AdapterCache
- func (e *Application) GetCasbin() *casbin.SyncedEnforcer
- func (e *Application) GetCasbinByTenant(tenant string) *casbin.SyncedEnforcer
- func (e *Application) GetCasbinExclude() map[string]interface{}
- func (e *Application) GetCasbinExcludeByTenant(tenant string) interface{}
- func (e *Application) GetConfig() map[string]interface{}
- func (e *Application) GetConfigByTenant(tenant string) map[string]interface{}
- func (e *Application) GetConfigValue(key string) interface{}
- func (e *Application) GetConfigValueByTenant(tenant, key string) interface{}
- func (e *Application) GetCrontab() *cron.Cron
- func (e *Application) GetCrontabByTenant(tenant string) *cron.Cron
- func (e *Application) GetDb() *gorm.DB
- func (e *Application) GetDbByTenant(tenant string) *gorm.DB
- func (e *Application) GetDefaultTenant() string
- func (e *Application) GetEngine() http.Handler
- func (e *Application) GetHandler() []func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
- func (e *Application) GetHandlerByTenant(tenant string) []func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
- func (e *Application) GetLogger() logger.Logger
- func (e *Application) GetMemoryQueue(prefix string) storage.AdapterQueue
- func (e *Application) GetMiddleware(key string) interface{}
- func (e *Application) GetQueue() storage.AdapterQueue
- func (e *Application) GetQueueAdapter() storage.AdapterQueue
- func (e *Application) GetQueuePrefix(key string) storage.AdapterQueue
- func (e *Application) GetRouter() []Router
- func (e *Application) GetStreamMessage(id, stream string, value map[string]interface{}) (storage.Messager, error)
- func (e *Application) SetApp(app interface{})
- func (e *Application) SetAppByTenant(key string, app interface{})
- func (e *Application) SetAppRouters(appRouters func())
- func (e *Application) SetBefore(f func())
- func (e *Application) SetCacheAdapter(c storage.AdapterCache)
- func (e *Application) SetCasbin(enforcer *casbin.SyncedEnforcer)
- func (e *Application) SetCasbinByTenant(tenant string, enforcer *casbin.SyncedEnforcer)
- func (e *Application) SetCasbinExclude(list interface{})
- func (e *Application) SetCasbinExcludeByTenant(tenant string, list interface{})
- func (e *Application) SetConfigByTenant(tenant string, value map[string]interface{})
- func (e *Application) SetConfigValue(key string, value interface{})
- func (e *Application) SetConfigValueByTenant(tenant, key string, value interface{})
- func (e *Application) SetCrontab(crontab *cron.Cron)
- func (e *Application) SetCrontabByTenant(key string, crontab *cron.Cron)
- func (e *Application) SetDb(db *gorm.DB)
- func (e *Application) SetDbByTenant(tenant string, db *gorm.DB)
- func (e *Application) SetDefaultTenant(tenant string)
- func (e *Application) SetEngine(engine http.Handler)
- func (e *Application) SetHandler(routerGroup func(r *gin.RouterGroup, hand ...*gin.HandlerFunc))
- func (e *Application) SetHandlerByTenant(tenant 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) SetMiddleware(key string, middleware interface{})
- func (e *Application) SetQueueAdapter(c storage.AdapterQueue)
- 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) 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 Config
- type Queue
- type Router
- type Routers
- type Runtime
Constants ¶
const DefaultTenant = "default"
DefaultTenant 默认租户标识符
Variables ¶
This section is empty.
Functions ¶
func NewCache ¶ added in v1.3.6
func NewCache(prefix string, store storage.AdapterCache, wxTokenStoreKey string) storage.AdapterCache
NewCache 创建对应上下文缓存
func NewQueue ¶ added in v1.3.6
func NewQueue(prefix string, queue storage.AdapterQueue) storage.AdapterQueue
NewQueue 创建对应上下文队列
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func (*Application) GetAllCasbin ¶
func (e *Application) GetAllCasbin() map[string]*casbin.SyncedEnforcer
GetAllCasbin 获取所有租户的casbin (原GetCasbin改名)
func (*Application) GetAllCrontab ¶
func (e *Application) GetAllCrontab() map[string]*cron.Cron
GetAllCrontab 获取所有租户的定时任务 (原GetCrontab改名)
func (*Application) GetAllDb ¶
func (e *Application) GetAllDb() map[string]*gorm.DB
GetAllDb 获取所有租户的数据库 (原GetDb改名)
func (*Application) GetAllHandler ¶
func (e *Application) GetAllHandler() map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
func (*Application) GetAllMiddleware ¶
func (e *Application) GetAllMiddleware() map[string]interface{}
GetAllMiddleware 获取所有中间件
func (*Application) GetApp ¶ added in v1.5.2
func (e *Application) GetApp() map[string]interface{}
GetApp 获取所有map里的app数据
func (*Application) GetAppByTenant ¶
func (e *Application) GetAppByTenant(tenant string) interface{}
GetAppByTenant 根据key获取app
func (*Application) GetAppRouters ¶ added in v1.4.0
func (e *Application) GetAppRouters() []func()
GetAppRouters 获取app的路由
func (*Application) GetBefore ¶ added in v1.5.2
func (e *Application) GetBefore() []func()
func (*Application) GetCacheAdapter ¶ added in v1.3.6
func (e *Application) GetCacheAdapter() storage.AdapterCache
GetCacheAdapter 获取缓存
func (*Application) GetCacheAdapterPrefix ¶
func (e *Application) GetCacheAdapterPrefix(prefix string) storage.AdapterCache
GetCacheAdapterPrefix 获取prefix标记的cache
func (*Application) GetCasbin ¶
func (e *Application) GetCasbin() *casbin.SyncedEnforcer
GetCasbin 获取默认租户的casbin (新增单租户快捷方法)
func (*Application) GetCasbinByTenant ¶
func (e *Application) GetCasbinByTenant(tenant string) *casbin.SyncedEnforcer
GetCasbinByTenant 根据租户获取casbin
func (*Application) GetCasbinExclude ¶ added in v1.5.2
func (e *Application) GetCasbinExclude() map[string]interface{}
GetCasbinExclude 获取所有map里的Exclude数据
func (*Application) GetCasbinExcludeByTenant ¶
func (e *Application) GetCasbinExcludeByTenant(tenant string) interface{}
GetCasbinExcludeByTenant 根据租户获取Exclude
func (*Application) GetConfig ¶ added in v1.4.0
func (e *Application) GetConfig() map[string]interface{}
GetConfig 获取默认租户的config
func (*Application) GetConfigByTenant ¶ added in v1.5.2
func (e *Application) GetConfigByTenant(tenant string) map[string]interface{}
GetConfigByTenant 获取对应租户的config
func (*Application) GetConfigValue ¶
func (e *Application) GetConfigValue(key string) interface{}
GetConfigValue 获取默认租户的配置值
func (*Application) GetConfigValueByTenant ¶
func (e *Application) GetConfigValueByTenant(tenant, key string) interface{}
GetConfigValueByTenant 获取对应租户的config
func (*Application) GetCrontab ¶
func (e *Application) GetCrontab() *cron.Cron
GetCrontab 获取默认租户的定时任务 (新增单租户快捷方法)
func (*Application) GetCrontabByTenant ¶
func (e *Application) GetCrontabByTenant(tenant string) *cron.Cron
GetCrontabByTenant 根据租户获取crontab
func (*Application) GetDbByTenant ¶
func (e *Application) GetDbByTenant(tenant string) *gorm.DB
GetDbByTenant 根据租户获取db
func (*Application) GetDefaultTenant ¶
func (e *Application) GetDefaultTenant() string
GetDefaultTenant 获取默认租户
func (*Application) GetHandler ¶ added in v1.3.6
func (e *Application) GetHandler() []func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
func (*Application) GetHandlerByTenant ¶
func (e *Application) GetHandlerByTenant(tenant string) []func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
func (*Application) GetMemoryQueue ¶ added in v1.3.6
func (e *Application) GetMemoryQueue(prefix string) storage.AdapterQueue
func (*Application) GetMiddleware ¶
func (e *Application) GetMiddleware(key string) interface{}
GetMiddleware 获取对应的中间件
func (*Application) GetQueue ¶
func (e *Application) GetQueue() storage.AdapterQueue
GetQueue 获取默认租户的队列
func (*Application) GetQueueAdapter ¶ added in v1.3.6
func (e *Application) GetQueueAdapter() storage.AdapterQueue
GetQueueAdapter 获取队列适配器
func (*Application) GetQueuePrefix ¶ added in v1.3.6
func (e *Application) GetQueuePrefix(key string) storage.AdapterQueue
GetQueuePrefix 获取标记的queue
func (*Application) GetRouter ¶ added in v1.3.6
func (e *Application) GetRouter() []Router
GetRouter 获取路由表
func (*Application) GetStreamMessage ¶ added in v1.3.6
func (e *Application) GetStreamMessage(id, stream string, value map[string]interface{}) (storage.Messager, error)
GetStreamMessage 获取队列需要用的message
func (*Application) SetApp ¶ added in v1.5.2
func (e *Application) SetApp(app interface{})
SetApp 设置默认租户的app
func (*Application) SetAppByTenant ¶
func (e *Application) SetAppByTenant(key string, app interface{})
SetAppByTenant 设置对应租户的app
func (*Application) SetAppRouters ¶ added in v1.4.0
func (e *Application) SetAppRouters(appRouters func())
SetAppRouters 设置app的路由
func (*Application) SetBefore ¶ added in v1.5.2
func (e *Application) SetBefore(f func())
func (*Application) SetCacheAdapter ¶ added in v1.3.6
func (e *Application) SetCacheAdapter(c storage.AdapterCache)
SetCacheAdapter 设置缓存
func (*Application) SetCasbin ¶
func (e *Application) SetCasbin(enforcer *casbin.SyncedEnforcer)
SetCasbin 设置默认租户的casbin
func (*Application) SetCasbinByTenant ¶
func (e *Application) SetCasbinByTenant(tenant string, enforcer *casbin.SyncedEnforcer)
func (*Application) SetCasbinExclude ¶ added in v1.5.2
func (e *Application) SetCasbinExclude(list interface{})
SetCasbinExclude 设置默认租户的Exclude
func (*Application) SetCasbinExcludeByTenant ¶
func (e *Application) SetCasbinExcludeByTenant(tenant string, list interface{})
SetCasbinExcludeByTenant 设置对应租户的Exclude
func (*Application) SetConfigByTenant ¶ added in v1.5.2
func (e *Application) SetConfigByTenant(tenant string, value map[string]interface{})
SetConfigByTenant 设置对应租户的config
func (*Application) SetConfigValue ¶
func (e *Application) SetConfigValue(key string, value interface{})
SetConfigValue 设置默认租户的配置值
func (*Application) SetConfigValueByTenant ¶
func (e *Application) SetConfigValueByTenant(tenant, key string, value interface{})
SetConfigValueByTenant 设置对应租户的key的config
func (*Application) SetCrontab ¶
func (e *Application) SetCrontab(crontab *cron.Cron)
SetCrontab 设置默认租户的crontab
func (*Application) SetCrontabByTenant ¶
func (e *Application) SetCrontabByTenant(key string, crontab *cron.Cron)
SetCrontabByTenant 设置对应租户的crontab
func (*Application) SetDbByTenant ¶
func (e *Application) SetDbByTenant(tenant string, db *gorm.DB)
SetDbByTenant 设置对应租户的db
func (*Application) SetDefaultTenant ¶
func (e *Application) SetDefaultTenant(tenant string)
SetDefaultTenant 设置默认租户
func (*Application) SetEngine ¶
func (e *Application) SetEngine(engine http.Handler)
SetEngine 设置路由引擎
func (*Application) SetHandler ¶ added in v1.3.6
func (e *Application) SetHandler(routerGroup func(r *gin.RouterGroup, hand ...*gin.HandlerFunc))
func (*Application) SetHandlerByTenant ¶
func (e *Application) SetHandlerByTenant(tenant string, routerGroup func(r *gin.RouterGroup, hand ...*gin.HandlerFunc))
func (*Application) SetLockerAdapter ¶ added in v1.3.6
func (e *Application) SetLockerAdapter(c storage.AdapterLocker)
SetLockerAdapter 设置分布式锁
func (*Application) SetMiddleware ¶
func (e *Application) SetMiddleware(key string, middleware interface{})
SetMiddleware 设置租户中间件
func (*Application) SetQueueAdapter ¶ added in v1.3.6
func (e *Application) SetQueueAdapter(c storage.AdapterQueue)
SetQueueAdapter 设置队列适配器
type Cache ¶ added in v1.3.6
type Cache struct {
// contains filtered or unexported fields
}
type Queue ¶ added in v1.3.6
type Queue struct {
// contains filtered or unexported fields
}
type Runtime ¶
type Runtime interface {
// SetDbByTenant 设置租户数据库
SetDbByTenant(tenant string, db *gorm.DB)
// SetDb 设置默认租户数据库
SetDb(db *gorm.DB)
GetDbByTenant(tenant string) *gorm.DB
GetDb() *gorm.DB
GetAllDb() map[string]*gorm.DB
SetBefore(f func())
GetBefore() []func()
SetAppByTenant(tenant string, app interface{})
SetApp(app interface{})
GetApp() map[string]interface{}
GetAppByTenant(tenant string) interface{}
SetCasbinExcludeByTenant(tenant string, list interface{})
SetCasbinExclude(list interface{})
GetCasbinExclude() map[string]interface{}
GetCasbinExcludeByTenant(tenant string) interface{}
SetCasbinByTenant(tenant string, enforcer *casbin.SyncedEnforcer)
SetCasbin(enforcer *casbin.SyncedEnforcer)
GetAllCasbin() map[string]*casbin.SyncedEnforcer
GetCasbin() *casbin.SyncedEnforcer
GetCasbinByTenant(tenant 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
SetDefaultTenant(tenant string)
GetDefaultTenant() string
// SetCrontabByTenant crontab
SetCrontabByTenant(tenant string, crontab *cron.Cron)
SetCrontab(crontab *cron.Cron)
GetCrontab() *cron.Cron
GetAllCrontab() map[string]*cron.Cron
GetCrontabByTenant(tenant string) *cron.Cron
// SetMiddleware middleware
SetMiddleware(string, interface{})
GetAllMiddleware() map[string]interface{}
GetMiddleware(string) interface{}
// SetCacheAdapter cache
SetCacheAdapter(storage.AdapterCache)
GetCacheAdapter() storage.AdapterCache
GetCacheAdapterPrefix(string) storage.AdapterCache
GetMemoryQueue(string) storage.AdapterQueue
SetQueueAdapter(storage.AdapterQueue)
GetQueueAdapter() storage.AdapterQueue
GetQueuePrefix(string) storage.AdapterQueue
SetHandler(routerGroup func(r *gin.RouterGroup, hand ...*gin.HandlerFunc))
SetHandlerByTenant(tenant string, routerGroup func(r *gin.RouterGroup, hand ...*gin.HandlerFunc))
GetAllHandler() map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
GetHandler() []func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
GetHandlerByTenant(tenant string) []func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)
GetStreamMessage(id, stream string, value map[string]interface{}) (storage.Messager, error)
// SetConfigByTenant 设置对应租户的config
SetConfigByTenant(tenant string, value map[string]interface{})
// SetConfigValueByTenant 设置对应租户的key对应的value
SetConfigValueByTenant(tenant, key string, value interface{})
SetConfigValue(key string, value interface{})
GetConfigValueByTenant(tenant, key string) interface{}
GetConfigByTenant(tenant string) map[string]interface{}
GetConfig() map[string]interface{}
GetConfigValue(key string) interface{}
// SetAppRouters set AppRouter
SetAppRouters(appRouters func())
GetAppRouters() []func()
}