package
0.0.0-20220320054816-510583427c69
Repository: https://github.com/vicanso/tiny-site.git
Documentation: pkg.go.dev
# Functions
AlmostEqual returns true is abs(a - b) < 1e-6.
ChinaNow 获取中国时间.
ChinaToday 获取中国时间当天的起始时间.
ChinaYesterday 获取中国时间昨天的起始时间.
ContainsAny 判断该字符串数据是否包含其中任意一个字符串.
ContainsString 判断字符串数组是否包含该字符串.
CutRune 按rune截断字符串.
Decrypt 数据解密 https://stackoverflow.com/questions/18817336/golang-encrypting-a-string-with-aes-and-base64.
Encrypt 数据加密 https://stackoverflow.com/questions/18817336/golang-encrypting-a-string-with-aes-and-base64.
FormatTime 格式化时间为字符串RFC3339.
GenXID 生成xid.
GetAccount gets account from context.
GetDeviceID gets device is from context.
GetFirstLetter 获取字符串首字母.
GetMockTime 获取mock的时间.
GetSessionID 获取session id.
GetStack 获取调用信息.
GetTraceID gets trace id from context.
GetTrackID 获取track id.
IsBetween 判断当前时间是否在开始与结束时间之间.
IsDevelopment 判断是否开发环境.
IsProduction 判断是否生产环境.
IsTest 判断是否测试环境.
No description provided by the author
MergeMapStringInterface 合并map[string]interface{}.
NewTimeWithRandomNS 根据timestamp并添加随机的ns生成时间.
Now 获取当前时间(测试环境允许使用mock的时间).
NowString 获取当前时间字符串RFC3339.
ParseTime 字符串转换为时间,字符串为RFC3339格式.
RandomDigit 创建指定长度的数字字符串.
RandomString 创建指定长度的字符串.
SetAccount sets account to context.
SetDeviceID sets device id to context.
SetMockTime 设置mock的时间.
SetTraceID sets trace id to context.
Sha256 对字符串做sha256后返回base64字符串.
ToFixed formats float64 to string.
UTCNow 获取UTC的时间.
UTCNowString 获取UTC时间字符串RFC3339.