helpers

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JWT_SECRET = config.Param("JWT_SECRET")

Functions

func ArrayReverse

func ArrayReverse(s []interface{}) []interface{}

func CreateToken

func CreateToken(claims jwt.MapClaims) (string, string, error)

创建令牌

func Date added in v1.0.3

func Date(format string, timestamp int64) string

func Get added in v1.0.1

func Get(url string) (response string)

func InitExpressReg added in v1.0.3

func InitExpressReg() []map[string]string

func ParseToken

func ParseToken(tokenString string) (jwt.MapClaims, error)

通用解析token

func Post added in v1.0.1

func Post(url string, data interface{}, contentType string) (content string)

func ValidToken

func ValidToken(tokenString string) (t *jwt.Token, e interface{})

校验令牌

Types

type CustomClaims

type CustomClaims struct {
	Openid string `json:"openid"`
	Userid int    `json:"userid"`
	jwt.StandardClaims
}

自定义一个加密token的结构

func CustomerParseToken

func CustomerParseToken(tokenString string) (*CustomClaims, error)

使用自定义结构解析token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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