utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const TimeFormat = "2006-01-02 15:04:05"

https://www.jianshu.com/p/206199a3edae

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(userId string, secretString string) string

func EncodePassword

func EncodePassword(password string) string

加密密码

func FileIsExisted

func FileIsExisted(filename string) bool

func Get16MD5Encode

func Get16MD5Encode(data string) string

func GetMD5Encode

func GetMD5Encode(data string) string

返回一个32位md5加密后的字符串

func GetRandomString

func GetRandomString(n int) string

letters + numbers + other visible ascii chars

func GetUuid

func GetUuid() string

获取uuid

func GetUuidV4

func GetUuidV4() string

获取uuid

func IsDir

func IsDir(name string) bool

func MakeDir

func MakeDir(dir string) error

func ParseToken

func ParseToken(tokenString string, secretString string) (string, error)

func VerifyPassword

func VerifyPassword(plainPwd string, hashedPwd string) bool

验证密码

func VerifyToken

func VerifyToken(tokenString string, secretString string) bool

Types

type LocalTime

type LocalTime struct {
	time.Time
}

func (LocalTime) MarshalJSON

func (t LocalTime) MarshalJSON() ([]byte, error)

MarshalJSON on JSONTime format Time field with Y-m-d H:i:s

func (*LocalTime) Scan

func (t *LocalTime) Scan(v interface{}) error

Scan value of time.Time

func (*LocalTime) UnmarshalJSON

func (t *LocalTime) UnmarshalJSON(data []byte) (err error)

func (LocalTime) Value

func (t LocalTime) Value() (driver.Value, error)

Value insert timestamp into mysql need this function.

Jump to

Keyboard shortcuts

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