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 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 MapAnyToURLValues(m map[string]any) url.Values
- func MapToURLValues(m map[string]string) url.Values
- 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 URLValuesToMap(values url.Values) map[string]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 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 MapAnyToURLValues ¶
MapAnyToURLValues convert map[string]any to url values
func MapToURLValues ¶
MapToURLValues convert map[string]string to url values
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
func URLValuesToMap ¶
URLValuesToMap convert url values to map[string]string
Types ¶
This section is empty.