Documentation ¶
Index ¶
- Variables
- func LoadConfig(forceEnv EnumEnv) (err error)
- type Cache
- func (m *Cache) CreateKey(key string) string
- func (m *Cache) Decr(key string) (result int64, err error)
- func (m *Cache) Del(key string) (result bool, err error)
- func (m *Cache) Exists(key string) (result bool, err error)
- func (m *Cache) Get(key string) (result string, err error)
- func (m *Cache) GetBackend() (result *redis.Client, err error)
- func (m *Cache) GetMutex(key string, options ...redsync.Option) (result *redsync.Mutex)
- func (m *Cache) GetMyRank(key string, member string, desc bool) (rank int64, score float64, err error)
- func (m *Cache) GetRankList(key string, start, stop int64, desc bool) (data []redis.Z, allCount int64, err error)
- func (m *Cache) Incr(key string) (result int64, err error)
- func (m *Cache) IncrRankScore(key string, member string, score float64) (err error)
- func (m *Cache) Md5(str string) string
- func (m *Cache) Set(key string, value string) (result string, err error)
- func (m *Cache) SetEx(key string, value string, ttl time.Duration) (result string, err error)
- func (m *Cache) UpdateRankScore(key string, member string, score float64) (err error)
- type CacheConfig
- type Captcha
- type Channel
- type DataBase
- type DataLog
- type DataLogger
- func (m *DataLogger) WriteAddLog(entity base.IDBModel, ctx context.Context, transId string) (err error)
- func (m *DataLogger) WriteDelLog(entity base.IDBModel, ctx context.Context, transId string) (err error)
- func (m *DataLogger) WriteEditLog(oldEntity, newEntity base.IDBModel, ctx context.Context, transId string) (err error)
- func (m *DataLogger) WriteUpdateLog(oldEntity base.IDBModel, newValues map[string]interface{}, ctx context.Context, ...) (err error)
- type DataUpdateLog
- type EnumEnv
- type ICache
- type ICaptcha
- type IDataBase
- type IDataLogger
- type IJob
- type IJobCenter
- type IJwtService
- type ILogCenter
- type ILruCache
- type IMsgCenter
- type INsq
- type ISessionCache
- type ISwaggerService
- type IUnionJD
- type IWxAuth
- type JWTService
- func (m *JWTService) CreateToken(ctx iris.Context, claims interface{}) (token string, err error)
- func (m *JWTService) FromCookie(ctx iris.Context) string
- func (m *JWTService) FromHeader(ctx iris.Context) string
- func (m *JWTService) GetClaims(ctx iris.Context) (claims interface{}, err error)
- func (m *JWTService) GetExecutorContext(ctx iris.Context) context.Context
- func (m *JWTService) GetExecutorContextWithInfo(ctx iris.Context) (result context.Context, info *pkg.BaseUserInfo)
- func (m *JWTService) GetExecutorInfo(ctx iris.Context) (result pkg.BaseUserInfo, err error)
- func (m *JWTService) GetMiddleware() iris.Handler
- func (m *JWTService) RemoveToken(ctx iris.Context)
- func (m *JWTService) VerifyCookieToken(token string) (result *jwt.VerifiedToken, err error)
- func (m *JWTService) VerifyToken(ctx iris.Context) (result *jwt.VerifiedToken, err error)
- type JobCenter
- type JobOption
- type LogCenter
- type LruCache
- func (c *LruCache) Add(key, value interface{}) bool
- func (c *LruCache) AddEx(key, value interface{}, expire time.Duration) bool
- func (c *LruCache) Contains(key interface{}) bool
- func (c *LruCache) ContainsOrAdd(key, value interface{}) (ok, evict bool)
- func (c *LruCache) Get(key interface{}) (interface{}, bool)
- func (c *LruCache) Keys() []interface{}
- func (c *LruCache) Len() int
- func (c *LruCache) Peek(key interface{}) (interface{}, bool)
- func (c *LruCache) Purge()
- func (c *LruCache) Remove(key interface{})
- func (c *LruCache) RemoveOldest()
- type MsgCenter
- func (m *MsgCenter) CloseChannel(channels []string) (err error)
- func (m *MsgCenter) CreateAppChannelId(channel string) (result string, err error)
- func (m *MsgCenter) GetConnToken(user string, exp int64) string
- func (m *MsgCenter) GetSubscriptionToken(channel string, user string, exp int64) (channelId string, token string)
- func (m *MsgCenter) OpenChannel(channels []string, onReceiveMsg func(*centrifuge.ClientInfo, *pkg.MsgContent)) (err error)
- func (m *MsgCenter) SendMsg(channel, msgType, msg string) (err error)
- type Nsq
- type RedisStore
- type SessionCache
- func (m *SessionCache) Del(ctx iris.Context, key string) (result bool, err error)
- func (m *SessionCache) Exists(ctx iris.Context, key string) (result bool, err error)
- func (m *SessionCache) Get(ctx iris.Context, key string) (result string, err error)
- func (m *SessionCache) GetCacheKey(ctx iris.Context, key string) string
- func (m *SessionCache) Incr(ctx iris.Context, key string) (result int64, err error)
- func (m *SessionCache) Set(ctx iris.Context, key string, value string, ttl time.Duration) (result string, err error)
- type SwaggerService
- type UnionJD
- func (m *UnionJD) BysubunionidPromotion(req common.Request) (result response.PromotionCodeResult, err error)
- func (m *UnionJD) GetJDDeepLink(platform string, sourceUrl string) (result string, err error)
- func (m *UnionJD) OrderRowQuery(req common.Request) (result response.OrderRowQueryResult, err error)
- type WxAuth
- func (m *WxAuth) CheckAuth(ctx iris.Context, cak string, customReturnURL string) (result bool)
- func (m *WxAuth) ClearAuth(ctx iris.Context) (err error)
- func (m *WxAuth) DoAuth(ctx iris.Context, afterAuth func(authInfo *pkg.WxAuthInfo, cak string))
- func (m *WxAuth) GetAuthUrl(cak string) (result string)
- func (m *WxAuth) GetCurrentUser(ctx iris.Context) (result *pkg.WxAuthInfo)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func LoadConfig ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func NewCacheByConfig ¶
func NewCacheByConfig(config CacheConfig) *Cache
func (*Cache) GetBackend ¶
func (*Cache) GetRankList ¶
func (*Cache) IncrRankScore ¶
type CacheConfig ¶
type DataBase ¶
type DataBase struct { Enable bool // contains filtered or unexported fields }
func (*DataBase) GetTransaction ¶
type DataLog ¶
type DataLog struct { Id string `gorm:"size:20;primaryKey" json:"id"` Table string `gorm:"size:100" json:"table"` Action string `gorm:"size:10" json:"action"` Executor string `gorm:"size:50" json:"executor"` Content string `gorm:"type:longText" json:"content"` CreateTime time.Time `json:"createTime"` }
type DataLogger ¶
type DataLogger struct {
// contains filtered or unexported fields
}
func (*DataLogger) WriteAddLog ¶
func (*DataLogger) WriteDelLog ¶
func (*DataLogger) WriteEditLog ¶
func (*DataLogger) WriteUpdateLog ¶
type DataUpdateLog ¶
type ICache ¶
type ICache interface { GetBackend() (result *redis.Client, err error) Get(key string) (result string, err error) Set(key string, value string) (result string, err error) SetEx(key string, value string, ttl time.Duration) (result string, err error) Del(key string) (result bool, err error) Exists(key string) (result bool, err error) Incr(key string) (result int64, err error) Decr(key string) (result int64, err error) CreateKey(key string) string GetMutex(key string, options ...redsync.Option) (result *redsync.Mutex) GetRankList(key string, start, stop int64, desc bool) (data []redis.Z, allCount int64, err error) UpdateRankScore(key string, member string, score float64) (err error) IncrRankScore(key string, member string, score float64) (err error) GetMyRank(key string, member string, desc bool) (rank int64, score float64, err error) }
type ICaptcha ¶
type ICaptcha interface { New() (result *pkg.CaptchaData, err error) Reload(id string) (result *pkg.CaptchaData, err error) Draw(id string) (result *pkg.CaptchaData, err error) Verify(id string, digits string) (result bool, err error) }
func NewCaptcha ¶
type IDataBase ¶
type IDataBase interface { GetDB() *gorm.DB GetTransaction(transId string) (result *gorm.DB, err error) Commit(transId string) (err error) Rollback(transId string) (err error) }
func NewDataBase ¶
type IDataLogger ¶
type IDataLogger interface { WriteAddLog(entity base.IDBModel, ctx context.Context, transId string) (err error) WriteDelLog(entity base.IDBModel, ctx context.Context, transId string) (err error) WriteEditLog(oldEntity, newEntity base.IDBModel, ctx context.Context, transId string) (err error) WriteUpdateLog(oldEntity base.IDBModel, newValues map[string]interface{}, ctx context.Context, transId string) (err error) }
func NewDataLogger ¶
func NewDataLogger(db IDataBase) IDataLogger
type IJobCenter ¶
type IJobCenter interface { RegisteJob(job IJob) StartJobs() }
func NewJobCenter ¶
func NewJobCenter() IJobCenter
type IJwtService ¶
type IJwtService interface { // CreateToken 生成Token,默认存入Cookie中 CreateToken(ctx iris.Context, claims interface{}) (token string, err error) // GetClaims 验证Token并返回其中包含的Claims对象指针,需要在Middleware处理后才能获得,如需手动验证,请使用VerifyToken方法,强烈建议使用此方法 GetClaims(ctx iris.Context) (claims interface{}, err error) // VerifyToken 从默认渠道(Cookie)中获取Token信息并验证,验证成功后返回VerifiedToken对象,仅用于手动验证,不建议使用 VerifyToken(ctx iris.Context) (result *jwt.VerifiedToken, err error) // RemoveToken 从Cookie中移除Token信息,一般用于"注销"功能 RemoveToken(ctx iris.Context) // GetMiddleware 获取iris路由中间件,用于验证请求合法性 GetMiddleware() iris.Handler // 获取用户JWT对象 GetExecutorInfo(ctx iris.Context) (result pkg.BaseUserInfo, err error) // 获取用户请求Context GetExecutorContext(ctx iris.Context) context.Context // 获取用户请求Context GetExecutorContextWithInfo(ctx iris.Context) (result context.Context, info *pkg.BaseUserInfo) // 从cookie中获取Token VerifyCookieToken(token string) (result *jwt.VerifiedToken, err error) }
func NewJWT ¶
func NewJWT() IJwtService
type ILogCenter ¶
func NewLogCenter ¶
func NewLogCenter() ILogCenter
type ILruCache ¶
type ILruCache interface { Add(key, value interface{}) (success bool) AddEx(key, value interface{}, expire time.Duration) (success bool) Get(key interface{}) (result interface{}, success bool) Contains(key interface{}) (success bool) Peek(key interface{}) (result interface{}, success bool) ContainsOrAdd(key, value interface{}) (success, evict bool) Remove(key interface{}) RemoveOldest() Keys() (result []interface{}) Len() (result int) Purge() }
func NewLruCache ¶
func NewLruCache() ILruCache
type IMsgCenter ¶
type IMsgCenter interface { OpenChannel(channels []string, onReceiveMsg func(*centrifuge.ClientInfo, *pkg.MsgContent)) (err error) CloseChannel(channels []string) (err error) SendMsg(channel, msgType, msg string) (err error) CreateAppChannelId(channel string) (result string, err error) GetConnToken(user string, exp int64) string GetSubscriptionToken(channel string, user string, exp int64) (channelId string, token string) }
func NewMsgCenter ¶
func NewMsgCenter(logCenter ILogCenter) IMsgCenter
type INsq ¶
type ISessionCache ¶
type ISessionCache interface { Get(ctx iris.Context, key string) (result string, err error) Set(ctx iris.Context, key string, value string, ttl time.Duration) (result string, err error) Del(ctx iris.Context, key string) (result bool, err error) Exists(ctx iris.Context, key string) (result bool, err error) Incr(ctx iris.Context, key string) (result int64, err error) GetCacheKey(ctx iris.Context, key string) string }
func NewSessionCache ¶
func NewSessionCache(cache ICache) ISessionCache
type ISwaggerService ¶
type ISwaggerService interface { }
func NewSwaggerService ¶
func NewSwaggerService(app *iris.Application, spec *swag.Spec) ISwaggerService
type IUnionJD ¶
type IUnionJD interface { BysubunionidPromotion(req common.Request) (result response.PromotionCodeResult, err error) OrderRowQuery(req common.Request) (result response.OrderRowQueryResult, err error) GetJDDeepLink(platform string, sourceUrl string) (result string, err error) }
func NewUnionJD ¶
func NewUnionJD() IUnionJD
type IWxAuth ¶
type IWxAuth interface { GetCurrentUser(ctx iris.Context) (result *pkg.WxAuthInfo) CheckAuth(ctx iris.Context, cak string, customReturnURL string) (result bool) ClearAuth(ctx iris.Context) (err error) DoAuth(ctx iris.Context, afterAuth func(authInfo *pkg.WxAuthInfo, cak string)) GetAuthUrl(cak string) (result string) }
func NewWxAuth ¶
func NewWxAuth(cache ICache, sessionCache ISessionCache, logCenter ILogCenter) IWxAuth
type JWTService ¶
type JWTService struct {
// contains filtered or unexported fields
}
func NewCustomJWT ¶
func NewCustomJWT(header string) *JWTService
func (*JWTService) CreateToken ¶
func (m *JWTService) CreateToken(ctx iris.Context, claims interface{}) (token string, err error)
CreateToken 生成Token,默认存入Cookie中
func (*JWTService) FromCookie ¶
func (m *JWTService) FromCookie(ctx iris.Context) string
func (*JWTService) FromHeader ¶
func (m *JWTService) FromHeader(ctx iris.Context) string
func (*JWTService) GetClaims ¶
func (m *JWTService) GetClaims(ctx iris.Context) (claims interface{}, err error)
GetClaims 验证Token并返回其中包含的Claims对象指针,需要在Middleware处理后才能获得,如需手动验证,请使用VerifyToken方法,强烈建议使用此方法
func (*JWTService) GetExecutorContext ¶
func (m *JWTService) GetExecutorContext(ctx iris.Context) context.Context
func (*JWTService) GetExecutorContextWithInfo ¶
func (m *JWTService) GetExecutorContextWithInfo(ctx iris.Context) (result context.Context, info *pkg.BaseUserInfo)
func (*JWTService) GetExecutorInfo ¶
func (m *JWTService) GetExecutorInfo(ctx iris.Context) (result pkg.BaseUserInfo, err error)
func (*JWTService) GetMiddleware ¶
func (m *JWTService) GetMiddleware() iris.Handler
GetMiddleware 获取iris路由中间件,用于验证请求合法性
func (*JWTService) RemoveToken ¶
func (m *JWTService) RemoveToken(ctx iris.Context)
RemoveToken 从Cookie中移除Token信息,一般用于"注销"功能
func (*JWTService) VerifyCookieToken ¶
func (m *JWTService) VerifyCookieToken(token string) (result *jwt.VerifiedToken, err error)
func (*JWTService) VerifyToken ¶
func (m *JWTService) VerifyToken(ctx iris.Context) (result *jwt.VerifiedToken, err error)
VerifyToken 从默认渠道(Cookie)中获取Token信息并验证,验证成功后返回VerifiedToken对象,仅用于手动验证,不建议使用
type JobCenter ¶
func (*JobCenter) RegisteJob ¶
type LruCache ¶
type LruCache struct {
// contains filtered or unexported fields
}
Cache is a thread-safe fixed size LRU cache.
func NewWithEvict ¶
NewWithEvict constructs a fixed size cache with the given eviction callback.
func NewWithExpire ¶
NewWithExpire constructs a fixed size cache with expire feature
func (*LruCache) Contains ¶
Check if a key is in the cache, without updating the recent-ness or deleting it for being stale.
func (*LruCache) ContainsOrAdd ¶
ContainsOrAdd checks if a key is in the cache without updating the recent-ness or deleting it for being stale, and if not, adds the value. Returns whether found and whether an eviction occurred.
func (*LruCache) Keys ¶
func (c *LruCache) Keys() []interface{}
Keys returns a slice of the keys in the cache, from oldest to newest.
func (*LruCache) Peek ¶
Returns the key value (or undefined if not found) without updating the "recently used"-ness of the key.
func (*LruCache) Remove ¶
func (c *LruCache) Remove(key interface{})
Remove removes the provided key from the cache.
func (*LruCache) RemoveOldest ¶
func (c *LruCache) RemoveOldest()
RemoveOldest removes the oldest item from the cache.
type MsgCenter ¶
type MsgCenter struct { Enable bool // contains filtered or unexported fields }
func (*MsgCenter) CloseChannel ¶
func (*MsgCenter) CreateAppChannelId ¶
func (*MsgCenter) GetSubscriptionToken ¶
func (*MsgCenter) OpenChannel ¶
func (m *MsgCenter) OpenChannel(channels []string, onReceiveMsg func(*centrifuge.ClientInfo, *pkg.MsgContent)) (err error)
type Nsq ¶
type Nsq struct {
// contains filtered or unexported fields
}
func (*Nsq) GetConsumer ¶
func (*Nsq) GetProducer ¶
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
func NewRedisStore ¶
func NewRedisStore(cache ICache) *RedisStore
type SessionCache ¶
type SessionCache struct {
// contains filtered or unexported fields
}
func (*SessionCache) Del ¶
func (m *SessionCache) Del(ctx iris.Context, key string) (result bool, err error)
func (*SessionCache) Exists ¶
func (m *SessionCache) Exists(ctx iris.Context, key string) (result bool, err error)
func (*SessionCache) Get ¶
func (m *SessionCache) Get(ctx iris.Context, key string) (result string, err error)
func (*SessionCache) GetCacheKey ¶
func (m *SessionCache) GetCacheKey(ctx iris.Context, key string) string
type SwaggerService ¶
type SwaggerService struct { }
type UnionJD ¶
type UnionJD struct {
// contains filtered or unexported fields
}
func (*UnionJD) BysubunionidPromotion ¶
func (m *UnionJD) BysubunionidPromotion(req common.Request) (result response.PromotionCodeResult, err error)
社交媒体获取推广链接接口
func (*UnionJD) GetJDDeepLink ¶
生成京东Deeplink
func (*UnionJD) OrderRowQuery ¶
func (m *UnionJD) OrderRowQuery(req common.Request) (result response.OrderRowQueryResult, err error)
查询推广订单及佣金信息
type WxAuth ¶
type WxAuth struct { Enable bool // contains filtered or unexported fields }
func (*WxAuth) DoAuth ¶
func (m *WxAuth) DoAuth(ctx iris.Context, afterAuth func(authInfo *pkg.WxAuthInfo, cak string))
func (*WxAuth) GetAuthUrl ¶
func (*WxAuth) GetCurrentUser ¶
func (m *WxAuth) GetCurrentUser(ctx iris.Context) (result *pkg.WxAuthInfo)