utils

package
v0.0.0-...-0583c98 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BcryptCheck

func BcryptCheck(password, hash string) bool

BcryptCheck 对比明文密码和数据库的哈希值

func BcryptHash

func BcryptHash(password string) string

BcryptHash 使用 bcrypt 对密码进行加密

func ClearToken

func ClearToken(ctx *gin.Context)

func ConvertLangToLangStr

func ConvertLangToLangStr(lang riotmodel.LANG) string

func ConvertLocStrToLocation

func ConvertLocStrToLocation(loCode string) riotmodel.LOCATION

func ConvertLocationToLoHoSTR

func ConvertLocationToLoHoSTR(loc riotmodel.LOCATION) (loCode, hostURL string)

func ConvertLocationToRegionHost

func ConvertLocationToRegionHost(loc riotmodel.LOCATION) string

func ConvertQueToQueSTR

func ConvertQueToQueSTR(que riotmodel.QUECODE) string

func ConvertRegionStrToArea

func ConvertRegionStrToArea(region string) riotmodel.AREA

func ConvertSliceToStr

func ConvertSliceToStr(s []string) string

func ConvertStrToSlice

func ConvertStrToSlice(str string) []string

func ConvertVersionToIdx

func ConvertVersionToIdx(version string) (uint, error)

ConvertVersionToIdx return a 4 digit str xxyy (1401)

func GenerateRandomString

func GenerateRandomString(n int) string

func GenerateRandomUA

func GenerateRandomUA() string

func GetClaims

func GetClaims(ctx *gin.Context) (*request.CustomClaims, error)

func GetCurMajorVersions

func GetCurMajorVersions() []string

func GetIDbyIP

func GetIDbyIP(ip string) uint32

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP 获取本机网卡IP

func GetToken

func GetToken(ctx *gin.Context) string

func GetUserID

func GetUserID(ctx *gin.Context) uint

GetUserID 从Gin的Context中获取从jwt解析出来的用户ID

func GetUserUuid

func GetUserUuid(ctx *gin.Context) uuid.UUID

GetUserUuid 从Gin的Context中获取从jwt解析出来的用户UUID

func RemoveExtraLF

func RemoveExtraLF(str string) string

func RemoveHTMLTags

func RemoveHTMLTags(input string) string

func SetToken

func SetToken(ctx *gin.Context, token string, maxAge int)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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