Documentation ¶
Index ¶
- func NewRedisRingOptions(opts ...map[string]interface{}) *redis.RingOptions
- type AnyGetter
- type CacheItemFunc
- type CacheMarshalHandler
- type CacheService
- func (service *CacheService) Cache(key string, value interface{}, args ...interface{})
- func (service *CacheService) CacheItem(item *cache.Item)
- func (service *CacheService) Delete(key ...string)
- func (service *CacheService) Exists(key string) bool
- func (service *CacheService) Get(key string) (interface{}, error)
- func (service *CacheService) GetAnyType(key string, v interface{}) error
- func (service *CacheService) GetClose() context.CancelFunc
- func (service *CacheService) GetCtx() context.Context
- func (service *CacheService) GetMarshal() CacheMarshalHandler
- func (service *CacheService) GetUnMarshal() CacheUnmarshalHandler
- func (service *CacheService) NewItem(key string, value interface{}, options ...interface{}) *cache.Item
- func (service *CacheService) Set(key, value string, expire ...time.Duration)
- func (service *CacheService) SetCtx(ctx context.Context, close ...context.CancelFunc)
- func (service *CacheService) SetMarshal(fn CacheMarshalHandler) *CacheService
- func (service *CacheService) SetUnMarshal(fn CacheUnmarshalHandler) *CacheService
- type CacheUnmarshalHandler
- type Closer
- type Getter
- type ICacheService
- type ILoginService
- type IStore
- type IStoreManager
- type ITokenOptions
- type ITokenService
- type ITokenType
- type IUserService
- type LoginService
- func (l *LoginService) Auth(string) Base.IReturnAble
- func (l *LoginService) LoginByAccountPassword(username string, password string) Base.IReturnAble
- func (l *LoginService) LoginByEmail(email string, password string) Base.IReturnAble
- func (l *LoginService) LoginByMobile(mobile string, password string) Base.IReturnAble
- func (l *LoginService) LoginByMobileSmsCode(mobile string, code string) Base.IReturnAble
- type MapAny
- type Store
- type StoreManager
- type TokenOptions
- type TokenService
- func (service *TokenService) Data(token string, option ...ITokenOptions) (data map[string]interface{}, err error)
- func (service *TokenService) Delete(key string)
- func (service *TokenService) Exists(token string) bool
- func (service *TokenService) Expired(token string) bool
- func (service *TokenService) Get(key string) (ITokenType, error)
- func (service *TokenService) Store(data string, options ITokenOptions) string
- func (service *TokenService) Token(data interface{}, option ...ITokenOptions) (token ITokenType)
- func (service *TokenService) TransformType(token string, ty interface{}) error
- type TokenType
- func (token *TokenType) CreateAt() time.Time
- func (token *TokenType) Data() (interface{}, bool)
- func (token *TokenType) Domain() []string
- func (token *TokenType) Exists() bool
- func (token *TokenType) Expired() bool
- func (token *TokenType) Identity() string
- func (token *TokenType) Map() (map[string]interface{}, bool)
- func (token *TokenType) Publish() string
- func (token *TokenType) Scope() string
- func (token *TokenType) Set(t string)
- func (token *TokenType) ToString() string
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRedisRingOptions ¶
func NewRedisRingOptions(opts ...map[string]interface{}) *redis.RingOptions
Types ¶
type AnyGetter ¶
type CacheItemFunc ¶
type CacheItemFunc func() (interface{}, error)
type CacheMarshalHandler ¶
type CacheService ¶
type CacheService struct { Close context.CancelFunc // contains filtered or unexported fields }
func GetCacheServices ¶
func GetCacheServices(config map[string]interface{}) *CacheService
func (*CacheService) Cache ¶
func (service *CacheService) Cache(key string, value interface{}, args ...interface{})
func (*CacheService) CacheItem ¶
func (service *CacheService) CacheItem(item *cache.Item)
func (*CacheService) Delete ¶
func (service *CacheService) Delete(key ...string)
func (*CacheService) Exists ¶
func (service *CacheService) Exists(key string) bool
func (*CacheService) Get ¶
func (service *CacheService) Get(key string) (interface{}, error)
func (*CacheService) GetAnyType ¶
func (service *CacheService) GetAnyType(key string, v interface{}) error
func (*CacheService) GetClose ¶
func (service *CacheService) GetClose() context.CancelFunc
func (*CacheService) GetCtx ¶
func (service *CacheService) GetCtx() context.Context
func (*CacheService) GetMarshal ¶
func (service *CacheService) GetMarshal() CacheMarshalHandler
func (*CacheService) GetUnMarshal ¶
func (service *CacheService) GetUnMarshal() CacheUnmarshalHandler
func (*CacheService) NewItem ¶
func (service *CacheService) NewItem(key string, value interface{}, options ...interface{}) *cache.Item
func (*CacheService) Set ¶
func (service *CacheService) Set(key, value string, expire ...time.Duration)
func (*CacheService) SetCtx ¶
func (service *CacheService) SetCtx(ctx context.Context, close ...context.CancelFunc)
func (*CacheService) SetMarshal ¶
func (service *CacheService) SetMarshal(fn CacheMarshalHandler) *CacheService
func (*CacheService) SetUnMarshal ¶
func (service *CacheService) SetUnMarshal(fn CacheUnmarshalHandler) *CacheService
type CacheUnmarshalHandler ¶
type Getter ¶
type ICacheService ¶
type ICacheService interface { Set(key, value string, expire ...time.Duration) Get(key string) (interface{}, error) GetAnyType(string, interface{}) error Delete(key ...string) Exists(key string) bool }
func GetCacheService ¶
func GetCacheService(client ...*redis.Ring) ICacheService
type ILoginService ¶
type ILoginService interface { Auth(string) Base.IReturnAble LoginByEmail(email string, password string) Base.IReturnAble LoginByMobile(mobile string, password string) Base.IReturnAble LoginByMobileSmsCode(mobile string, code string) Base.IReturnAble LoginByAccountPassword(username string, password string) Base.IReturnAble }
type IStore ¶
type IStoreManager ¶
func GetStoreManager ¶
func GetStoreManager() IStoreManager
func NewStoreManager ¶
func NewStoreManager() IStoreManager
type ITokenOptions ¶
type ITokenOptions interface { Expire() time.Duration // 过期时长 Key() []string // 配置主要键生成 key Domain() []string // token 颁发域名列表 Publish() string // token 生成域名 Scope() string // 作用域 IdentityKey() string // 身份 }
func NewTokenOptions ¶
func NewTokenOptions(data ...map[string]interface{}) ITokenOptions
type ITokenService ¶
type ITokenService interface { Token(data interface{}, option ...ITokenOptions) (token ITokenType) // 创建 token Data(token string, option ...ITokenOptions) (data map[string]interface{}, err error) // 输出token 数据对象 Exists(token string) bool // token 是否存在 Expired(token string) bool // token 是否过期 TransformType(token string, ty interface{}) error // token 对应数绑定struct Store(string, ITokenOptions) string // 存储 token对应信息 返回 key Get(string) (ITokenType, error) // 通过 token 获取信息对象 Delete(string) // 删除token }
func GetUserTokenService ¶
func GetUserTokenService() ITokenService
func NewTokenService ¶
func NewTokenService() ITokenService
type ITokenType ¶
type ITokenType interface { ToString() string // 输出 token Exists() bool // token 是否存在 CreateAt() time.Time // 创建时间 Expired() bool // 是否已过期 Data() (interface{}, bool) // 输出token 数据 Map() (map[string]interface{}, bool) // 输出token 数据 Set(string) // 设置 token Domain() []string // token 颁发域名列表 Publish() string // token 生成域名 Scope() string // 作用域 Identity() string // 身份 }
func DecodeToken ¶
func DecodeToken(token string) (ITokenType, error)
func EncodeToken ¶
func EncodeToken(data string, options ITokenOptions) ITokenType
func NewTokenType ¶
func NewTokenType(token string) ITokenType
type IUserService ¶
type IUserService interface {
LoginByAccountPwd(username string, password string) Base.IReturnAble
}
func GetUserService ¶
func GetUserService() IUserService
func NewUserService ¶
func NewUserService(repo repositories.IUserRepository) IUserService
type LoginService ¶
type LoginService struct {
// contains filtered or unexported fields
}
func (*LoginService) Auth ¶
func (l *LoginService) Auth(string) Base.IReturnAble
func (*LoginService) LoginByAccountPassword ¶
func (l *LoginService) LoginByAccountPassword(username string, password string) Base.IReturnAble
func (*LoginService) LoginByEmail ¶
func (l *LoginService) LoginByEmail(email string, password string) Base.IReturnAble
func (*LoginService) LoginByMobile ¶
func (l *LoginService) LoginByMobile(mobile string, password string) Base.IReturnAble
func (*LoginService) LoginByMobileSmsCode ¶
func (l *LoginService) LoginByMobileSmsCode(mobile string, code string) Base.IReturnAble
type StoreManager ¶
type StoreManager struct {
Config Base.ConfigureFace
}
func (*StoreManager) Init ¶
func (manager *StoreManager) Init() *StoreManager
type TokenOptions ¶
type TokenOptions struct {
// contains filtered or unexported fields
}
token 可选项
func (*TokenOptions) Domain ¶
func (opt *TokenOptions) Domain() []string
func (*TokenOptions) Expire ¶
func (opt *TokenOptions) Expire() time.Duration
func (*TokenOptions) IdentityKey ¶
func (opt *TokenOptions) IdentityKey() string
func (*TokenOptions) Key ¶
func (opt *TokenOptions) Key() []string
func (*TokenOptions) Publish ¶
func (opt *TokenOptions) Publish() string
func (*TokenOptions) Scope ¶
func (opt *TokenOptions) Scope() string
type TokenService ¶
type TokenService struct {
S IStore
}
func (*TokenService) Data ¶
func (service *TokenService) Data(token string, option ...ITokenOptions) (data map[string]interface{}, err error)
func (*TokenService) Delete ¶
func (service *TokenService) Delete(key string)
func (*TokenService) Exists ¶
func (service *TokenService) Exists(token string) bool
func (*TokenService) Expired ¶
func (service *TokenService) Expired(token string) bool
func (*TokenService) Get ¶
func (service *TokenService) Get(key string) (ITokenType, error)
func (*TokenService) Store ¶
func (service *TokenService) Store(data string, options ITokenOptions) string
func (*TokenService) Token ¶
func (service *TokenService) Token(data interface{}, option ...ITokenOptions) (token ITokenType)
func (*TokenService) TransformType ¶
func (service *TokenService) TransformType(token string, ty interface{}) error
type TokenType ¶
type TokenType struct { Keys []string PublishDomain string Domains []string StoreKey string ExpiredAt time.Time IdentityStr string ScopeKey string // contains filtered or unexported fields }
token 对象
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func (*UserService) LoginByAccountPwd ¶
func (u *UserService) LoginByAccountPwd(username string, password string) Base.IReturnAble
Click to show internal directories.
Click to hide internal directories.