Documentation
¶
Index ¶
- func NewCache(prefix string, store cache.Adapter, wxTokenStoreKey string) cache.Adapter
- type Application
- func (e *Application) GetCacheAdapter() cache.Adapter
- func (e *Application) GetCachePrefix(key string) cache.Adapter
- 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) GetLogger() logger.Logger
- func (e *Application) GetMiddleware() map[string]interface{}
- func (e *Application) GetMiddlewareKey(key string) interface{}
- func (e *Application) GetStreamMessage(id, stream string, value map[string]interface{}) (cache.Message, error)
- func (e *Application) SetCacheAdapter(c cache.Adapter)
- 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) SetLogger(l logger.Logger)
- func (e *Application) SetMiddleware(key string, middleware interface{})
- type Cache
- func (e Cache) Append(message cache.Message) error
- 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) Lock(key string, ttl int64, options *redislock.Options) (*redislock.Lock, error)
- func (e Cache) PutToken(token *oauth2.Token) error
- func (e Cache) Register(name string, f cache.ConsumerFunc)
- func (e Cache) Run()
- func (e Cache) Set(key string, val interface{}, expire int) error
- func (e *Cache) SetPrefix(prefix string)
- func (e Cache) Shutdown()
- func (e *Cache) String() string
- func (e Cache) Token() (token *oauth2.Token, err error)
- type Runtime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func (*Application) GetCacheAdapter ¶
func (e *Application) GetCacheAdapter() cache.Adapter
GetCacheAdapter 获取缓存
func (*Application) GetCachePrefix ¶
func (e *Application) GetCachePrefix(key string) cache.Adapter
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) GetMiddleware ¶
func (e *Application) GetMiddleware() map[string]interface{}
GetMiddleware 获取所有中间件
func (*Application) GetMiddlewareKey ¶
func (e *Application) GetMiddlewareKey(key string) interface{}
GetMiddlewareKey 获取对应key的中间件
func (*Application) GetStreamMessage ¶ added in v1.3.2
func (e *Application) GetStreamMessage(id, stream string, value map[string]interface{}) (cache.Message, error)
GetStreamMessage 获取队列需要用的message
func (*Application) SetCacheAdapter ¶
func (e *Application) SetCacheAdapter(c cache.Adapter)
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) SetMiddleware ¶
func (e *Application) SetMiddleware(key string, middleware interface{})
SetMiddleware 设置中间件
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
type Runtime ¶
type Runtime interface {
//多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(engine http.Handler)
GetEngine() http.Handler
//使用go-admin定义的logger,参考来源go-micro
SetLogger(logger logger.Logger)
GetLogger() logger.Logger
//crontab
SetCrontab(key string, crontab *cron.Cron)
GetCrontab() map[string]*cron.Cron
GetCrontabKey(key string) *cron.Cron
//middleware
SetMiddleware(string, interface{})
GetMiddleware() map[string]interface{}
GetMiddlewareKey(key string) interface{}
//cache
SetCacheAdapter(cache.Adapter)
GetCacheAdapter() cache.Adapter
GetCachePrefix(string) cache.Adapter
GetStreamMessage(id, stream string, value map[string]interface{}) (cache.Message, error)
}
Click to show internal directories.
Click to hide internal directories.