utils

package
v0.0.0-...-a3cb3ec Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Date

func Date() string

Date returns current date in string like "2006-01-02".

func Datetime

func Datetime() string

Datetime returns current datetime in string like "2006-01-02 15:04:05".

func ISO8601

func ISO8601() string

ISO8601 returns current datetime in ISO8601 format like "2006-01-02T15:04:05-07:00".

func JsonToMarshal

func JsonToMarshal(data interface{}) string

func Md5

func Md5(str []byte, b ...byte) string

Md5 加密

func RFC822

func RFC822() string

RFC822 returns current datetime in RFC822 format like "Mon, 02 Jan 06 15:04 MST".

func RandInt

func RandInt(n int) int

RandInt 生成随机数

func RandString

func RandString(n int) string

RandString 生成随机字符串 值可能为: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ 0123456789

func SetTimeZone

func SetTimeZone(zone string) error

SetTimeZone 设置地区时间 eg: Asia/Shanghai

func Sha3

func Sha3(str []byte, b ...byte) string

Sha3 sha3-256加密

func StrToTime

func StrToTime(str string, layout string) time.Time

the time in string as time like "2022-01-02 18:04:05".

func TimeToStr

func TimeToStr(t time.Time, layout string) string

the t in time as string like "2022-01-02 18:04:05".

func Timestamp

func Timestamp() int64

Timestamp returns the timestamp in seconds(秒).

func TimestampMicro

func TimestampMicro() int64

TimestampMicro returns the timestamp in microseconds(微秒).

func TimestampMilli

func TimestampMilli() int64

TimestampMilli returns the timestamp in milliseconds(毫秒).

func TimestampMilliStr

func TimestampMilliStr() string

the timestamp in milliseconds as string.

func TimestampNano

func TimestampNano() int64

TimestampNano returns the timestamp in nanoseconds(纳秒).

func TimestampStr

func TimestampStr() string

the timestamp in seconds as string.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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