util

package
v0.0.0-...-9495e6b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CreateDir

func CreateDir(dirs ...string) (err error)

func GenerateFilenameByUploadDatetime

func GenerateFilenameByUploadDatetime(filename string) (string, error)

func GenerateRedisKey

func GenerateRedisKey()

func GetCover

func GetCover(videoPath string, imgPath string, time string) error

func GetCoverURLByFilename

func GetCoverURLByFilename(filename string) string

func GetIntersection

func GetIntersection(slice1 []int64, slice2 []int64) []int64

func GetPlayURLByFilename

func GetPlayURLByFilename(filename string) string

func GetSysDatetime

func GetSysDatetime() string

func ParseDuration

func ParseDuration(d string) (time.Duration, error)

func PathExists

func PathExists(path string) (bool, error)

Types

type CustomClaims

type CustomClaims struct {
	UserInfo model.UserInfo
	jwt.StandardClaims
}

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT() *JWT

func (*JWT) CreateToken

func (j *JWT) CreateToken(userInfo model.UserInfo) (string, error)

CreateToken 创建 token

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)

ParseToken 解析 token

Jump to

Keyboard shortcuts

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