utils

package
v0.0.0-...-1e61551 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePassword

func ComparePassword(hash, password string) bool

func Crypt

func Crypt(password string) (string, error)

func GenerateToken

func GenerateToken(id uint, name string) (string, error)

func IsTokenValid

func IsTokenValid(token string) bool

Types

type JwtCustomClaims

type JwtCustomClaims struct {
	ID   uint
	Name string
	jwt.RegisteredClaims
}

func ParseToken

func ParseToken(token string) (JwtCustomClaims, error)

type RedisClient

type RedisClient struct {
}

func InitRedis

func InitRedis() (*RedisClient, error)

func (*RedisClient) Delete

func (rdc *RedisClient) Delete(key ...string) error

func (*RedisClient) Get

func (rdc *RedisClient) Get(key string) (any, error)

func (*RedisClient) GetExpireTime

func (rdc *RedisClient) GetExpireTime(key string) (time.Duration, error)

func (*RedisClient) Set

func (rdc *RedisClient) Set(key string, value any) error

*RedisClient包装三个方法

Jump to

Keyboard shortcuts

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