Documentation ¶
Index ¶
- func AlmostEqual(a, b float64) bool
- func ChinaNow() (time.Time, error)
- func ChinaToday() (time.Time, error)
- func ChinaYesterday() (time.Time, error)
- func ContainsAny(targets []string, checkArr []string) bool
- func ContainsString(arr []string, str string) (found bool)
- func CutRune(str string, max int) string
- func Decrypt(key, text []byte) ([]byte, error)
- func Encrypt(key, text []byte) ([]byte, error)
- func FormatTime(t time.Time) string
- func GenXID() string
- func GetAccount(ctx context.Context) string
- func GetDeviceID(ctx context.Context) string
- func GetFirstLetter(str string) string
- func GetMockTime() string
- func GetSessionID(c *elton.Context) string
- func GetStack(max int) []string
- func GetTraceID(ctx context.Context) string
- func GetTrackID(c *elton.Context) string
- func IsBetween(begin, end time.Time) bool
- func IsDevelopment() bool
- func IsProduction() bool
- func IsTest() bool
- func MergeMapString(target map[string]string, sources ...map[string]string) map[string]string
- func MergeMapStringInterface(target map[string]interface{}, sources ...map[string]interface{}) map[string]interface{}
- func NewTimeWithRandomNS(timestamp int64) time.Time
- func Now() time.Time
- func NowString() string
- func ParseTime(str string) (time.Time, error)
- func RandomDigit(n int) string
- func RandomString(n int) string
- func SetAccount(ctx context.Context, account string) context.Context
- func SetDeviceID(ctx context.Context, deviceID string) context.Context
- func SetMockTime(v string)
- func SetTraceID(ctx context.Context, traceID string) context.Context
- func Sha256(str string) string
- func ToFixed(value float64, precision int) string
- func UTCNow() time.Time
- func UTCNowString() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlmostEqual ¶
AlmostEqual returns true is abs(a - b) < 1e-6
func ContainsAny ¶
ContainsAny 判断该字符串数据是否包含其中任意一个字符串
func ContainsString ¶
ContainsString 判断字符串数组是否包含该字符串
func Decrypt ¶
Decrypt 数据解密 https://stackoverflow.com/questions/18817336/golang-encrypting-a-string-with-aes-and-base64
func Encrypt ¶
Encrypt 数据加密 https://stackoverflow.com/questions/18817336/golang-encrypting-a-string-with-aes-and-base64
func GetDeviceID ¶
GetDeviceID gets device is from context
func MergeMapString ¶
func MergeMapStringInterface ¶
func MergeMapStringInterface(target map[string]interface{}, sources ...map[string]interface{}) map[string]interface{}
MergeMapStringInterface 合并map[string]interface{}
func NewTimeWithRandomNS ¶
NewTimeWithRandomNS 根据timestamp并添加随机的ns生成时间
func SetAccount ¶
SetAccount sets account to context
func SetDeviceID ¶
SetDeviceID sets device id to context
func SetTraceID ¶
SetTraceID sets trace id to context
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.