utils

package
v0.0.0-...-d5b2ec4 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Byte2Int

func Byte2Int(data []byte) int

Byte2Int ...

func Byte2IntLittleEndian

func Byte2IntLittleEndian(data []byte) int

Byte2IntLittleEndian ...

func ByteToFloat32

func ByteToFloat32(bytes []byte) float32

ByteToFloat32 convert byte to float32

func ByteToFloat64

func ByteToFloat64(bytes []byte) float64

ByteToFloat64 convert byte to float32

func Float32ToByte

func Float32ToByte(float float32) []byte

Float32ToByte convert float32 to byte

func Float64ToByte

func Float64ToByte(float float64) []byte

Float64ToByte convert float64 to byte

func FreePort

func FreePort(network string) (int, error)

func GenerateRequestID

func GenerateRequestID() string

GenerateRequestID generate request id

func GetUUID1

func GetUUID1() (string, error)

GetUUID1 get uuid v1 NewV1 returns UUID based on current timestamp and MAC address

func GetUUID4

func GetUUID4() (string, error)

GetUUID4 get uuid v4 NewV4 returns random generated UUID.

func Int2Byte

func Int2Byte(data int) []byte

Int2Byte ...

func Int2ByteLittleEndian

func Int2ByteLittleEndian(data int) []byte

Int2ByteLittleEndian ...

func LocalIP

func LocalIP() (ipAddr string)

LocalIP get local ip

func LocalIPByTCP

func LocalIPByTCP() string

LocalIPByTCP 有外网的情况下, 通过tcp访问获得本机 IP 地址

func LocalIPWithVal

func LocalIPWithVal(defaultVal string) string

LocalIPWithVal if local IP is "", return defaultVal

func PublicIP

func PublicIP() (string, error)

PublicIP get public ip

func RandomInt

func RandomInt(num int) int

RandomInt 随机数 int

func Round

func Round(f float64, n int) float64

Round round

func SubString

func SubString(str string, begin, length int) string

SubString sub string include chinese character

func SubStringFromEnd

func SubStringFromEnd(str string, begin, end int) string

SubStringFromEnd sub string include chinese character

Types

This section is empty.

Jump to

Keyboard shortcuts

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