Documentation ¶
Index ¶
- Variables
- func AnyInSlice[T AnyInSliceType](v T, slice []T) bool
- func AnyPtr[T any](v T) *T
- func AnySet[T AnyInSliceType](list []T) []T
- func AnyString(o any) string
- func EnumInSlice[T EnumInSliceType](v T, slice []T) bool
- func GetPodIp() string
- func Md5(s string) string
- func Md516(s string) string
- func Md5Bytes(b []byte) string
- type AnyInSliceType
- type EnumInSliceType
- type Jwt
- func (x *Jwt) GenerateToken(userId string, uniqueKey string, status int, extra string, scope []string) *TokenObject
- func (x *Jwt) RevokeToken(ctx context.Context, userId string, uniqueKey string) error
- func (x *Jwt) SetToken(ctx context.Context, tokenObject *TokenObject) error
- func (x *Jwt) VerifyToken(ctx context.Context, tokenString string, uniqueKey string) (*TokenObject, error)
- type JwtConfig
- type SSM
- type TokenObject
Constants ¶
This section is empty.
Variables ¶
View Source
var Aes = &xAes{}
View Source
var Bytes = &xBytes{}
View Source
var DecryptError = errors.New("aes decrypt error")
View Source
var Error = &xError{}
View Source
var File = &xFile{}
View Source
var Http = &xHttp{}
View Source
var Json = &xJson{}
View Source
var Map = &xMap{}
View Source
var Number = &xNumber{}
View Source
var Pwd = &xPwd{}
View Source
var Random = &xRandom{}
View Source
var Regex = &xRegex{}
View Source
var Retry = xRetry{}
View Source
var SetTokenLockError = fmt.Errorf("set token lock error")
View Source
var Snowflake *xSnowflake
View Source
var String = &xString{}
View Source
var Time = &xTime{}
View Source
var TokenExpiredError = fmt.Errorf("token expired error")
View Source
var TokenInvalidError = fmt.Errorf("token invalid error")
View Source
var TokenReplaceError = fmt.Errorf("token replace error")
View Source
var Trace = &xTrace{}
Functions ¶
func AnyInSlice ¶
func AnyInSlice[T AnyInSliceType](v T, slice []T) bool
func AnySet ¶
func AnySet[T AnyInSliceType](list []T) []T
func EnumInSlice ¶
func EnumInSlice[T EnumInSliceType](v T, slice []T) bool
Types ¶
type AnyInSliceType ¶
type EnumInSliceType ¶
type EnumInSliceType interface {
String() string
}
type Jwt ¶
type Jwt struct { Config JwtConfig // contains filtered or unexported fields }
func (*Jwt) GenerateToken ¶
func (*Jwt) RevokeToken ¶
func (*Jwt) SetToken ¶
func (x *Jwt) SetToken( ctx context.Context, tokenObject *TokenObject, ) error
func (*Jwt) VerifyToken ¶
type SSM ¶
func NewSSMFromBsonM ¶
type TokenObject ¶
type TokenObject struct { UserId string `json:"userId"` // 用户id UniqueKey string `json:"uniqueKey"` // 唯一标识 比如设备id/平台id 就可以实现单点登录/单平台登录/任意登录 Status int `json:"status"` // 状态 用户自行定义 Token string `json:"token"` // token Extra string `json:"extra"` // 额外信息 用户自行定义 AliveTime int64 `json:"aliveTime"` // 存活时间 ExpiredAt int64 `json:"expiredAt"` // 过期时间 Scope []string `json:"scope"` // 权限 Scene string `json:"scene"` // 场景 }
func (*TokenObject) Marshal ¶
func (o *TokenObject) Marshal() string
Click to show internal directories.
Click to hide internal directories.