utils

package
v0.0.0-...-b858eff Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

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

	DATE_FMT = "2006-01-02"

	TIME_FMT = "15:04:05"

	DATE_TIME_FMT_CN = "2006年01月02日 15时04分05秒"

	DATE_FMT_CN = "2006年01月02日"

	TIME_FMT_CN = "15时04分05秒"
)

FMT_TYPE_NOMAL

View Source
const SecondInNano = 1000 * 1000 * 1000

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password string, hash string) error

func Elapse

func Elapse(f func()) int64

Timing the cost of function call, unix nano was returned

func ElapseString

func ElapseString(f func()) string

Timing the cost of function call, unix nano was returned

func ErrorJSON

func ErrorJSON(c *gin.Context, statusCode int, err error)

func GetCurrentTimeFormat

func GetCurrentTimeFormat(format string) string

format

func GetMonthDays

func GetMonthDays(year, month int) int

GetMonthDays return days of the month/year

func GetTimeFormat

func GetTimeFormat(second int64, format string) string

func GetTimestamp

func GetTimestamp() int64

return 1441006057 in sec

func GetTimestampInMicro

func GetTimestampInMicro() int64

微秒

func GetTimestampInMicroString

func GetTimestampInMicroString() string

微秒

func GetTimestampInMilli

func GetTimestampInMilli() int64

return 1441007112776 in millisecond

func GetTimestampInMilliString

func GetTimestampInMilliString() string

return 1441007112776 in millisecond

func GetTimestampString

func GetTimestampString() string

return 1441006057 in sec

func HashPassword

func HashPassword(password string) (string, error)

func IsLeapYear

func IsLeapYear(year int) bool

IsLeapYear check whether a year is leay

func UnixTimeIsNotExpired

func UnixTimeIsNotExpired(date string) bool

Types

type ErrorMsg

type ErrorMsg struct {
	Key   string `json:"field"`
	Error string `json:"message"`
}

Jump to

Keyboard shortcuts

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