Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToStr(b []byte) string
- func CreateCtxWithTimeout(sec uint32) *context.Context
- func GetCurrentMilliSecTimestamp() int64
- func GetRand() *rand.Rand
- func GetRandIdNumber() int64
- func Int64ToStr(n int64) string
- func IntToStr(n int) string
- func RemoveDuplicateUrlSlash(s string) string
- func RemoveDuplicateWhitespace(s string, trim bool) string
- func SetPromMetricsAppName(name string)
- func StrToBytes(s string) []byte
- func TruncateDecimal4(value float64) float64
- func Uint64ToStr(n uint64) string
Constants ¶
View Source
const ( ConstPromAppName = "app" ConstPrometheusNamespace = "ginx" ConstPrometheusSubsystemName = "" ConstHttpRequestIdleConnTimeout = 15 * 1000 ConstGrpcClientPingMinIntervalTime = 5 * 1000 )
Variables ¶
View Source
var ( PromAppName = "default" InvalidIpAddressError = errors.New("invalid IP address") )
Functions ¶
func CreateCtxWithTimeout ¶
CreateCtxWithTimeout 创建 context
func GetCurrentMilliSecTimestamp ¶
func GetCurrentMilliSecTimestamp() int64
func GetRandIdNumber ¶
func GetRandIdNumber() int64
func Int64ToStr ¶
func RemoveDuplicateUrlSlash ¶
RemoveDuplicateUrlSlash 去除 url 中重复的 /
func RemoveDuplicateWhitespace ¶
RemoveDuplicateWhitespace 删除字符串中重复的空白字符,只保留 为单个空白字符 trim: 是否去掉首位空白
func SetPromMetricsAppName ¶
func SetPromMetricsAppName(name string)
func TruncateDecimal4 ¶
TruncateDecimal4 uint 代表小数位数,格式位 0.000001 如果是几位就指定为几位
func Uint64ToStr ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.