helper

package
v0.0.0-...-ac0283c Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MulanPSL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaimsFromHeader

func ClaimsFromHeader(ctx context.Context) (*casdoor.Claims, error)

func ComparePasswords

func ComparePasswords(hashedPassword, password string) error

ComparePasswords 验证密码是否匹配哈希值

func DownloadAudioFileToTmp

func DownloadAudioFileToTmp(urlStr string) (string, error)

func EventIdStr

func EventIdStr(eventId string) string

func GenerateToken

func GenerateToken(identity, name string) (string, error)

GenerateToken 生成 token

func GetMd5

func GetMd5(s string) string

GetMd5 生成 md5

func GetMp3UrlDuration

func GetMp3UrlDuration(url string) (int64, error)

func GetRand

func GetRand() string

GetRand 生成验证码

func GetUUID

func GetUUID() string

GetUUID 生成唯一码

func HashPassword

func HashPassword(password string) (string, error)

HashPassword 使用 bcrypt 对密码进行哈希处理

func Int32SliceToString

func Int32SliceToString(sli []int32, sep string) string

func Int64SliceToString

func Int64SliceToString(sli []int64, sep string) string

func NanoTimestampStr

func NanoTimestampStr() string

func ParseFileDuration

func ParseFileDuration(filePath string) (int64, error)

ParseFileDuration 解析音频文件时长 原生go的方式

func ReceiveEmail

func ReceiveEmail(str string) string

func ReceiveWebhook

func ReceiveWebhook(str string) string

func S2M

func S2M(inter interface{}) map[string]interface{}

S2M convert struct to map

func TenantIDFromHeader

func TenantIDFromHeader(ctx context.Context) (string, error)

func Uint32SliceToString

func Uint32SliceToString(sli []uint32, sep string) string

func Uint64SliceToString

func Uint64SliceToString(sli []uint64, sep string) string

func Uint64SliceToStringSlice

func Uint64SliceToStringSlice(sli []uint64) []string

func UnixSecondToInt64

func UnixSecondToInt64() int64

func UnixSecondToStr

func UnixSecondToStr(second int64) string

func UnixSecondToTime

func UnixSecondToTime(second int64) time.Time

func UserFromHeader

func UserFromHeader(ctx context.Context) (*casdoor.User, error)

Types

type UserClaims

type UserClaims struct {
	Identity string `json:"identity"`
	Name     string `json:"name"`
	jwt.StandardClaims
}

func AnalyseToken

func AnalyseToken(tokenString string) (*UserClaims, error)

AnalyseToken 解析 token

Jump to

Keyboard shortcuts

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