Documentation ¶
Index ¶
- Variables
- func CreateDir(dirs ...string) (err error)
- func DeLFile(filePath string) error
- func DecryptPwd(password, hash string) bool
- func EncryptPwd(password string) string
- func FileExist(path string) bool
- func FileMove(src string, dst string) (err error)
- func GetClaims(c *gin.Context) (*request.CustomClaims, error)
- func GetUserID(c *gin.Context) uint
- func GetUserInfo(c *gin.Context) *request.CustomClaims
- func GetUserUuid(c *gin.Context) uuid.UUID
- func Md5Sum(str []byte, b []byte) string
- func ParseDuration(d string) (time.Duration, error)
- func PathExists(path string) (bool, error)
- func TrimSpace(target interface{})
- type Jwt
- func (j *Jwt) CreateClaims(baseClaims request.BaseClaims) request.CustomClaims
- func (j *Jwt) CreateToken(claims request.CustomClaims) (string, error)
- func (j *Jwt) FreshTokenWithToken(oldToken string, claims request.CustomClaims) (string, error)
- func (j *Jwt) ParseToken(tokenString string) (*request.CustomClaims, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func FileMove ¶
@author: [songzhibin97](https://github.com/songzhibin97) @function: FileMove @description: 文件移动供外部调用 @param: src string, dst string(src: 源位置,绝对路径or相对路径, dst: 目标位置,绝对路径or相对路径,必须为文件夹) @return: err error
func GetUserInfo ¶
func GetUserInfo(c *gin.Context) *request.CustomClaims
GetUserInfo 从Gin的Context中获取从jwt解析出来的用户角色id
func GetUserUuid ¶
GetUserUuid 从Gin的Context中获取从jwt解析出来的用户UUID
func PathExists ¶
func TrimSpace ¶
func TrimSpace(target interface{})
@author: [songzhibin97](https://github.com/songzhibin97) @function: TrimSpace @description: 去除结构体空格 @param: target interface (target: 目标结构体,传入必须是指针类型) @return: null
Types ¶
type Jwt ¶
type Jwt struct {
SigningKey []byte
}
func (*Jwt) CreateClaims ¶
func (j *Jwt) CreateClaims(baseClaims request.BaseClaims) request.CustomClaims
func (*Jwt) CreateToken ¶
func (j *Jwt) CreateToken(claims request.CustomClaims) (string, error)
CreateToken create jwt token
func (*Jwt) FreshTokenWithToken ¶
FreshTokenWithToken get newer token via older token
func (*Jwt) ParseToken ¶
func (j *Jwt) ParseToken(tokenString string) (*request.CustomClaims, error)
ParseToken parse token
Click to show internal directories.
Click to hide internal directories.