Documentation ¶
Index ¶
- Constants
- func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string
- func DateFormat(t time.Time, format string) string
- func DateParse(dateString, format string) (time.Time, error)
- func EncodeMd5(str string) string
- func FileSize(s int64) string
- func GetRandomString(n int, alphabets ...byte) string
- func PBKDF2(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte
- func Subtract(left interface{}, right interface{}) interface{}
- func TimeSince(then time.Time) string
- func TimeSincePro(then time.Time) string
- func ToStr(value interface{}, args ...int) (s string)
- func VerifyTimeLimitCode(data string, minutes int, code string) bool
- type StrTo
Constants ¶
View Source
const ( Minute = 60 Hour = 60 * Minute Day = 24 * Hour Week = 7 * Day Month = 30 * Day Year = 12 * Month )
Seconds-based time units
View Source
const ( Byte = 1 KByte = Byte * 1024 MByte = KByte * 1024 GByte = MByte * 1024 TByte = GByte * 1024 PByte = TByte * 1024 EByte = PByte * 1024 )
View Source
const TimeLimitCodeLength = 12 + 6 + 40
Variables ¶
This section is empty.
Functions ¶
func CreateTimeLimitCode ¶
create a time limit code code format: 12 length date time string + 6 minutes string + 40 sha1 encoded string
func DateFormat ¶
Date takes a PHP like date func to Go's time format.
func GetRandomString ¶
GetRandomString generate random string by specify chars.
func Subtract ¶
func Subtract(left interface{}, right interface{}) interface{}
Subtract deals with subtraction of all types of number.
func TimeSincePro ¶
TimeSincePro calculates the time interval and generate full user-friendly string.
Types ¶
Click to show internal directories.
Click to hide internal directories.