util

package
v0.0.0-...-03f4900 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     error  = errors.New("Token is expired")
	TokenNotValidYet error  = errors.New("Token not active yet")
	TokenMalformed   error  = errors.New("That's not even a token")
	TokenInvalid     error  = errors.New("Couldn't handle this token:")
	SignKey          string = "cfun"
)

Functions

func AliWriteRedis

func AliWriteRedis(cloud string, rlist model.AliRedis)

func CreateToken

func CreateToken(claims Claims) (string, error)

CreateToken 生成一个token

func GenerateToken

func GenerateToken(Username string, Password string) (string, string, error)

func GetPage

func GetPage(c *gin.Context) (int, int)

GetPage get page parameters

func RefreshToken

func RefreshToken(tokenString string) (string, error)

func ReturnDefaultModel

func ReturnDefaultModel(val string, list map[string]string) string

func TxWriteRedis

func TxWriteRedis(cloud string, rlist model.TxL)

func VerifyEmailFormat

func VerifyEmailFormat(email string) bool

email verify

Types

type Claims

type Claims struct {
	UserId   int    `json:"userid"`
	UserName string `json:"username"`
	UserType string `json:"usertype"`
	// UserPhone    int64     `json:"UserPhone"`
	// Password string    `json:"Password"`
	// CreaTime time.Time `json:"CreaTime"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

type UserInfo

type UserInfo struct {
	Uid      int
	UserName string
	Identity string
	// UserPhone int64
	AvatarUrl string
	CreatedAt time.Time
}

user info tbale

type UserJWTInfo

type UserJWTInfo struct {
	Uid      int
	UserName string
	UserType string
}

user info tbale

func GetUserInfo

func GetUserInfo(tokenString string) (UserJWTInfo, error)

Jump to

Keyboard shortcuts

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