utils

package
v0.0.0-...-d07672d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConstDefaultPrometheusNamespace     = "okboost"
	ConstDefaultPrometheusSubsystemName = ""
)

Variables

View Source
var ApplicationName = "default"

Functions

func BoolToString

func BoolToString(b bool) string

func BytesToString

func BytesToString(b []byte) string

BytesToString 字节转字符串

func CreateRand

func CreateRand() *rand.Rand

func CreateRandomBytes

func CreateRandomBytes(n uint32) []byte

CreateRandomBytes 用于创建随机字节切片

func CreateRandomString

func CreateRandomString(n uint32) string

func CustomCobraHelp

func CustomCobraHelp() func(*cobra.Command, []string)

func CustomCobraUsage

func CustomCobraUsage() func(*cobra.Command) error

func Float64ToString

func Float64ToString(f float64) string

func GetRandIdBase64

func GetRandIdBase64() string

func GetRandIdBytes

func GetRandIdBytes() []byte

func GetRandIdInt64

func GetRandIdInt64() int64

func GetRandIdIntBytes

func GetRandIdIntBytes() [8]byte

func GetRandIdString

func GetRandIdString() string

func Int64ToString

func Int64ToString(n int64) string

func Int64ToTimeDuration

func Int64ToTimeDuration(value int64) time.Duration

func PrettyCobraHelpAndUsage

func PrettyCobraHelpAndUsage(c *cobra.Command)

func RemoveDuplicatesAndEmptyS

func RemoveDuplicatesAndEmptyS(o []string) (ret []string)

[]string 内元素 Remove Duplicate

func SetApplicationName

func SetApplicationName(name string)

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes 字符串转字节

func StringToFloat64

func StringToFloat64(s string) (float64, error)

func StringToInt64

func StringToInt64(s string) (int64, error)

func StringToUint64

func StringToUint64(s string) (uint64, error)

func TimeDurationToInt64

func TimeDurationToInt64(duration time.Duration) int64

func TruncateDecimal

func TruncateDecimal(value float64, n uint16) float64

func TruncateDecimal4

func TruncateDecimal4(value float64) float64

TruncateDecimal4 uint 代表小数位数,格式位 0.000001 如果是几位就指定为几位

func Uint64ToString

func Uint64ToString(n uint64) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL