Documentation
¶
Index ¶
- Variables
- func BytesFromat(raw uint64) float64
- func Compress(data []byte, algorithm string) ([]byte, error)
- func CompressWithFlate(data []byte) ([]byte, error)
- func CompressWithGzip(data []byte) ([]byte, error)
- func CompressWithLzw(data []byte) ([]byte, error)
- func CompressWithZlib(data []byte) ([]byte, error)
- func CreateDirIFNotExist(dir string) error
- func CreateFileIFNotExist(file string) error
- func Decimal(value float64, precision int) float64
- func Decrypt(secret []byte, raw []byte) ([]byte, error)
- func Encrypt(secret []byte, raw []byte) ([]byte, error)
- func FileAbsolutePath(file string) (string, error)
- func FileIsExist(file string) (path string, err error)
- func FileIsZip(file string) (bool, error)
- func FileWalk(dir string) (dirs []string, files []string, err error)
- func FilesAndDirs(dir string) (dirs []string, files []string, err error)
- func FrequencyFormat(raw float64) float64
- func GetIPv4Address() (ips []string)
- func GetIPv6Address() (ips []string)
- func GetMacAddress() (macs []string)
- func GetNode() (ips []string)
- func GobDecode(raw []byte, object any, algorithm string) error
- func GobEncode(object any, compress bool, algorithm string) ([]byte, error)
- func Int64SliceSegments(raw []int64, number int64) [][]int64
- func IsError(err error) bool
- func JsonDecode(raw []byte, object any, algorithm string) error
- func JsonEncode(object any, escape bool, compress bool, algorithm string) ([]byte, error)
- func MillisecondTimestampFormatDaysHoursMinutesSeconds(timestamp float64) (days int32, hours int32, minutes int32, seconds float64)
- func Number2Float32(value any, precision float32) float32
- func Number2Float64(value any, precision float64) float64
- func Number2Int16(value any, precision int16) int16
- func Number2Int32(value any, precision int32) int32
- func Number2Int64(value any, precision int64) int64
- func Number2Int8(value any, precision int8) int8
- func Number2Uint16(value any, precision uint16) uint16
- func Number2Uint32(value any, precision uint32) uint32
- func Number2Uint64(value any, precision uint64) uint64
- func Number2Uint8(value any, precision uint8) uint8
- func OuiQuery(mac string) (entry *oui.Entry, err error)
- func ParseAddress(address string) (schema string, host string, ips []net.IP, port int, err error)
- func StringSliceSegments(raw []string, number int) [][]string
- func TomlDecode(raw []byte, object any, algorithm string) error
- func TomlEncode(object any, compress bool, algorithm string) ([]byte, error)
- func TrafficbpsFormatKMGTPEZYBbps(trafficbps float64) (result float64, unit string)
- func TrimAllSpace(raw string) string
- func TrimAllSymbol(raw string, symbol string) string
- func TrimBeforeAndAfterBackslash(raw string) string
- func TrimBeforeAndAfterPoint(raw string) string
- func TrimBeforeAndAfterSlash(raw string) string
- func TrimBeforeAndAfterSpace(raw string) string
- func TrimBeforeAndAfterSymbol(raw string, symbol string) string
- func Uint64SliceSegments(raw []uint64, number int64) [][]uint64
- func UnCompress(data []byte, algorithm string) ([]byte, error)
- func UnCompressWithFlate(raw []byte) ([]byte, error)
- func UnCompressWithGzip(raw []byte) ([]byte, error)
- func UnCompressWithLzw(raw []byte) ([]byte, error)
- func UnCompressWithZlib(raw []byte) ([]byte, error)
- func UnitFormat(size uint64) string
- func ValidateNil(object any) bool
- func ValidateStruct(object any, language string) error
- func XmlDecode(raw []byte, object any, algorithm string) error
- func XmlEncode(object any, namespace string, root string, compress bool, algorithm string) ([]byte, error)
- func YamlDecode(raw []byte, object any, algorithm string) error
- func YamlEncode(object any, compress bool, algorithm string) ([]byte, error)
- type Error
Constants ¶
This section is empty.
Variables ¶
var OUIDB oui.StaticDB
Functions ¶
func BytesFromat ¶
字节(GB)单位转换: bit(位)、Byte(字节)、KB(千字节)、MB(兆字节)、GB(吉字节,千兆)、TB(万亿字节,太字节)、PB(千万亿字节,拍字节)、EB(百亿亿字节,艾字节)、ZB(十万亿亿字节,泽字节)、YB(一亿亿亿字节,尧字节)、BB(千亿亿亿字节) 1BB=1024YB=1024^2ZB=1024^3EB=1024^4PB=1024^5TB=1024^6GB=1024^7MB=1024^8KB=1024^9Byte=8*1024^9bit 1YB=1024ZB=1024^2EB=1024^3PB=1024^4TB=1024^5GB=1024^6MB=1024^7KB=1024^8Byte=8*1024^8bit 1ZB=1024EB=1024^2PB=1024^3TB=1024^4GB=1024^5MB=1024^6KB=1024^7Byte=8*1024^7bit 1EB=1024PB=1024^2TB=1024^3GB=1024^4MB=1024^5KB=1024^6Byte=8*1024^6bit 1PB=1024TB=1024^2GB=1024^3MB=1024^4KB=1024^5Byte=8*1024^5bit 1TB=1024GB=1024^2MB=1024^3KB=1024^4Byte=8*1024^4bit 1GB=1024MB=1024^2KB=1024^3Byte=8*1024^3bit 1MB=1024KB=1024^2Byte=8*1024^2bit 1KB=1024Byte=8*1024bit 1Byte=8bit
func FilesAndDirs ¶
获取文件和目录列表
func FrequencyFormat ¶
主频(GHz)单位转换: Hz、KHz、MHz、GHz、THz 1THz=10^3GHz=10^6MHz=10^9KHz=10^12Hz 1GHz=10^3MHz=10^6KHZ=10^9Hz 1MHz=10^3KHz=10^6Hz 1KHz=10^3Hz
func Int64SliceSegments ¶
int64切片分片 raw: 原字符串切片 number: 分片元素大小
func JsonEncode ¶
json 格式序列化
object any : 序列化对象 escape bool : 是否进行转义 compress bool : 是否进行压缩 algorithm string : 压缩算法
func MillisecondTimestampFormatDaysHoursMinutesSeconds ¶
func MillisecondTimestampFormatDaysHoursMinutesSeconds(timestamp float64) (days int32, hours int32, minutes int32, seconds float64)
毫秒时间戳格式化
func Number2Float32 ¶
数值类型转换成float32类型,precision: 精度/倍乘数/倍乘因子
func Number2Float64 ¶
数值类型转换成float64类型,precision: 精度/倍乘数/倍乘因子
func Number2Int16 ¶
数值类型转换成int16类型,precision: 精度/倍乘数/倍乘因子
func Number2Int32 ¶
数值类型转换成int32类型,precision: 精度/倍乘数/倍乘因子
func Number2Int64 ¶
数值类型转换成int64类型,precision: 精度/倍乘数/倍乘因子
func Number2Int8 ¶
数值类型转换成int8类型,precision: 精度/倍乘数/倍乘因子
func Number2Uint16 ¶
数值类型转换成uint16类型,precision: 精度/倍乘数/倍乘因子
func Number2Uint32 ¶
数值类型转换成uint32类型,precision: 精度/倍乘数/倍乘因子
func Number2Uint64 ¶
数值类型转换成uint64类型,precision: 精度/倍乘数/倍乘因子
func Number2Uint8 ¶
数值类型转换成uint8类型,precision: 精度/倍乘数/倍乘因子
func ParseAddress ¶
func StringSliceSegments ¶
字符串切片分片 raw: 原字符串切片 number: 分片元素大小
func TrafficbpsFormatKMGTPEZYBbps ¶
流量单位转换: bps(位/秒)、Kbps(千字节/秒)、Mbps(兆字节/秒)、Gbps(吉字节/秒,千兆/秒)、Tbps(万亿字节/秒,太字节/秒)、Pbps(千万亿字节/秒,拍字节/秒)、Ebps(百亿亿字节/秒,艾字节/秒)、Zbps(十万亿亿字节/秒,泽字节/秒)、Ybps(一亿亿亿字节/秒,尧字节/秒)、Bbps(千亿亿亿字节/秒) 1bps=1bps 1Kbps=1024bps 1Mbps=1024Kbps=1024^2=1024^2bps 1Gbps=1024Mbps=1024^2Kbps=1024^3bps=1024^3bps 1Tbps=1024Gbps=1024^2Mbps=1024^3Kbps=1024^4bps 1Pbps=1024Tbps=1024^2Gbps=1024^3Mbps=1024^4Kbps=1024^5bps 1Ebps=1024Pbps=1024^2Tbps=1024^3Gbps=1024^4Mbps=1024^5Kbps=1024^6bps 1Zbps=1024Ebps=1024^2Pbps=1024^3Tbps=1024^4Gbps=1024^5Mbps=1024^6Kbps=1024^7bps 1Ybps=1024Zbps=1024^2Ebps=1024^3Pbps=1024^4Tbps=1024^5Gbps=1024^6Mbps=1024^7Kbps=1024^8bps 1Bbps=1024Ybps=1024^2Zbps=1024^3Ebps=1024^4Pbps=1024^5Tbps=1024^6Gbps=1024^7Mbps=1024^8Kbps=1024^9bps
func TrimBeforeAndAfterSymbol ¶
去除前后指定符号
func Uint64SliceSegments ¶
uint64切片分片 raw: 原字符串切片 number: 分片元素大小
func UnCompressWithLzw ¶
Lempel-Ziv-Welch (LZW) 解压
func ValidateNil ¶
func ValidateStruct ¶
func XmlEncode ¶
func XmlEncode(object any, namespace string, root string, compress bool, algorithm string) ([]byte, error)
xml 格式序列化
object any : 序列化对象 namespace string : 命名空间 root string : 根节点名称 compress bool : 是否进行压缩 algorithm string : 压缩算法