utils

package
v0.0.0-...-14907fc Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserExpireDuration  = time.Hour * 2
	UserSecretKey       = "front_user_token"
	AdminExpireDuration = time.Hour * 48
	AdminSecretKey      = "admin_user_token"
)

Variables

This section is empty.

Functions

func AuthToken

func AuthToken(tokenString string, secret string) (bool, string)

func GenerateToken

func GenerateToken(email string, expireTime time.Duration, secret string) (string, error)

func MapToStr

func MapToStr(m map[string]interface{}) string

func Pic2Base64

func Pic2Base64(picPath string) (string, error)

Pic2Base64 converts a picture to base64 string

func StrToMap

func StrToMap(s string) map[string]interface{}

func VerifyEmailFormat

func VerifyEmailFormat(email string) bool

VerifyEmailFormat verifies if the email address is valid

Types

type UserToken

type UserToken struct {
	jwt.StandardClaims
	Email  string `json:"username"`
	UserId string `json:"user_id"`
}

Jump to

Keyboard shortcuts

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