Documentation ¶
Overview ¶
Package utils is a library of commonly used utility functions.
Index ¶
- func GetAvailablePort() (int, error)
- func GetHostname() string
- func GetLocalHTTPAddrPairs() (serverAddr string, requestAddr string)
- func Int64ToStr(v int64) string
- func IntToStr(v int) string
- func SafeRun(ctx context.Context, fn func(ctx context.Context))
- func SafeRunWithTimeout(d time.Duration, fn func(cancel context.CancelFunc))
- func StrToFloat32(str string) float32
- func StrToFloat32E(str string) (float32, error)
- func StrToFloat64(str string) float64
- func StrToFloat64E(str string) (float64, error)
- func StrToInt(str string) int
- func StrToIntE(str string) (int, error)
- func StrToUint32(str string) uint32
- func StrToUint32E(str string) (uint32, error)
- func StrToUint64(str string) uint64
- func StrToUint64E(str string) (uint64, error)
- func Uint64ToStr(v uint64) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLocalHTTPAddrPairs ¶
GetLocalHTTPAddrPairs get available http server and request address
func SafeRunWithTimeout ¶ added in v1.2.0
func SafeRunWithTimeout(d time.Duration, fn func(cancel context.CancelFunc))
SafeRunWithTimeout safe run with limit timeouts
func StrToFloat32E ¶
StrToFloat32E string to float32 with error
func StrToFloat64E ¶
StrToFloat64E string to float64 with error
func StrToUint32E ¶
StrToUint32E string to uint32 with error
func StrToUint64E ¶
StrToUint64E string to uint64 with error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.