utils

package
v0.0.0-...-9b663ca Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateHashID

func GenerateHashID(id uint, salt string, length int) string

GenerateHashID ..

func GenerateSecretKey

func GenerateSecretKey(length int) string

GenerateSecretKey ..

func GetPreloads

func GetPreloads(ctx context.Context) []string

GetPreloads ..

func GetRawID

func GetRawID(id string, salt string, length int) uint

GetRawID ..

func JWT

func JWT(signingKey []byte, uid int64, username, avatar string, gender int, tokenExpire time.Duration, issuer string) string

JWT 生成jwt字符串

func ParseJWT

func ParseJWT(signingKey []byte, token string) (*jwt.Token, error)

ParseJWT 解析jwt字符串

func RandString

func RandString(len int) string

RandString 生成随机字符串

Types

type MyCustomClaims

type MyCustomClaims struct {
	UID      int64  `json:"uid"` //用户id
	Username string `json:"username"`
	Avatar   string `json:"avatar"`
	Gender   int    `json:"gender"`
	jwt.StandardClaims
}

MyCustomClaims jwt自定义内容

Jump to

Keyboard shortcuts

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