commonexternal

package
v0.0.0-...-09c63dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     = errors.New("Token is expired")
	TokenNotValidYet = errors.New("Token not active yet")
	TokenMalformed   = errors.New("That's not even a token")
	TokenInvalid     = errors.New("Couldn't handle this token:")
)
View Source
var CustomizeMap = make(map[string]Rules)
View Source
var (
	GVA_Concurrency_Control = &singleflight.Group{}
)

Functions

func Eq

func Eq(mark string) string

func Ge

func Ge(mark string) string

func Gt

func Gt(mark string) string

func Le

func Le(mark string) string

func Lt

func Lt(mark string) string

func MD5V

func MD5V(str []byte, b ...byte) string

func Md5ByBytes

func Md5ByBytes(b []byte) string

func Md5ByString

func Md5ByString(str string) string

func Ne

func Ne(mark string) string

func NotEmpty

func NotEmpty() string

func RegexpMatch

func RegexpMatch(rule string) string

@author: [zooqkl](https://github.com/zooqkl) @function: RegexpMatch @description: 正则校验 校验输入项是否满足正则表达式 @param: rule string @return: string

func RegisterRule

func RegisterRule(key string, rule Rules) (err error)

func Verify

func Verify(st interface{}, roleMap Rules) (err error)

Types

type BaseClaims

type BaseClaims struct {
	UUID        uuid.UUID
	ID          uint
	Username    string
	NickName    string
	AuthorityId string
}

type CustomClaims

type CustomClaims struct {
	BaseClaims
	BufferTime int64
	jwt.StandardClaims
}

Custom claims structure

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT(signiingKey string) *JWT

func (*JWT) CreateClaims

func (j *JWT) CreateClaims(baseClaims BaseClaims, bufferTime int64, expireTime int64, issure string) CustomClaims

func (*JWT) CreateToken

func (j *JWT) CreateToken(claims CustomClaims) (string, error)

创建一个token

func (*JWT) CreateTokenByOldToken

func (j *JWT) CreateTokenByOldToken(oldToken string, claims CustomClaims) (string, error)

CreateTokenByOldToken 旧token 换新token 使用归并回源避免并发问题

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)

解析 token

type Rules

type Rules map[string][]string

type RulesMap

type RulesMap map[string]Rules

type SnowFlake

type SnowFlake struct {
	// contains filtered or unexported fields
}

SnowFlake SnowFlake算法结构体

var (
	SFlake *SnowFlake
)

func NewSnowFlake

func NewSnowFlake() *SnowFlake

func (*SnowFlake) GetID

func (s *SnowFlake) GetID() (uint64, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL