utils

package
v0.0.0-...-894796f Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckExist

func CheckExist(src string) bool

CheckExist 检测文件是否存在

func CheckImageExt

func CheckImageExt(fileName string, allExt ...string) bool

CheckImageExt 检测图片拓展名是否合法

func CheckImageSize

func CheckImageSize(f multipart.File, maxSize int) bool

CheckImageSize 检测图片大小

func CheckPermission

func CheckPermission(src string) bool

CheckPermission 检测是否具有权限

func GenerateToken

func GenerateToken(username, password string) (token string, err error)

GenerateToken 生成Token

func GetAnnualRange

func GetAnnualRange() (time.Time, time.Time)

func GetMonthRange

func GetMonthRange() (time.Time, time.Time)

func GetProjectRoot

func GetProjectRoot() string

func GetRecentRange

func GetRecentRange() (time.Time, time.Time)

func GetSize

func GetSize(f multipart.File) (int, error)

GetSize 获取文件大小

func GetToday

func GetToday() (time.Time, time.Time)

func GetWeekRang

func GetWeekRang() (time.Time, time.Time)

func IsNotExistMkDir

func IsNotExistMkDir(src string) error

IsNotExistMkDir 不存在则新建目录

func MkDir

func MkDir(src string) error

MkDir 新建目录

func Open

func Open(name string, flag int, perm os.FileMode) (*os.File, error)

Open 打开文件

func SetupJwt

func SetupJwt(jwtSecretStr string)

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	Password string `json:"password"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

ParseToken 解析token

Jump to

Keyboard shortcuts

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