Documentation ¶
Index ¶
- Constants
- func CompressZLib(src []byte) ([]byte, error)
- func Copy(src interface{}, dst interface{}) error
- func CopySlice[T any](src []T) []T
- func DecryptUnCompressUnpackTo(src []byte, dst interface{}, key, iv string) (err error)
- func DecryptUnpack(src []byte, key, iv string) (dst interface{}, err error)
- func Default[T comparable](value T, defaultValue T) T
- func DefaultSlice[T any](s []T, defaultS []T, notCopy ...int) []T
- func Encrypt(plainText, key, iv string) (dst []byte, err error)
- func EqualSlice[T comparable](a, b []T) bool
- func First[T any](s []T) T
- func IfError(condition bool, i interface{}) error
- func InRange[T Comparable](i, minVal, maxVal T) T
- func IsPointer(value interface{}) error
- func IsUuid(i string) bool
- func Pack(src interface{}) ([]byte, error)
- func PackCompress(src interface{}) ([]byte, error)
- func PackCompressEncrypt(src interface{}, key, iv string) (dst []byte, err error)
- func Round(i float64, digits int) float64
- func Round0(i float64) float64
- func Round1(i float64) float64
- func Round2(i float64) float64
- func Round3(i float64) float64
- func Round4(i float64) float64
- func Round5(i float64) float64
- func Round6(i float64) float64
- func SafeFilename(i string) string
- func Sha1(v interface{}) string
- func Sha3(v interface{}) string
- func Sha3Bytes(v []byte) string
- func Sha3File(path string) (string, error)
- func Sleep(s float64, show ...int)
- func SubStringHan(s string, n int) string
- func T1(title ...string)
- func T2(title ...string) float64
- func UnCompressUnpack(src []byte) (dst interface{}, err error)
- func UnCompressUnpackTo(src []byte, dst interface{}) (err error)
- func UnCompressZLib(src []byte) ([]byte, error)
- func Unpack(src []byte) (dst interface{}, err error)
- func UnpackTo(src []byte, dst interface{}) (err error)
- func Zzz(title ...string)
- type Comparable
- type Ip2LocationRecord
- type PsInfo
- type PsInfoItem
- type PsInfoLoad
Constants ¶
const ( B = 1 KB = 1024 * B MB = 1024 * KB GB = 1024 * MB )
Variables ¶
This section is empty.
Functions ¶
func CompressZLib ¶
func Copy ¶
func Copy(src interface{}, dst interface{}) error
Copy msgpack.Marshal to msgpack.Unmarshal
func CopySlice ¶
func CopySlice[T any](src []T) []T
CopySlice creates and returns a copy of the provided slice.
func DecryptUnpack ¶
func Default ¶
func Default[T comparable](value T, defaultValue T) T
Default provides a default value for various types when the main value is its type's zero value.
func DefaultSlice ¶
DefaultSlice provides a copy of the given slice if it's not empty, or a copy of the default value slice otherwise, based on the copy flag. The copy flag is optional and defaults to false if not provided.
func EqualSlice ¶
func EqualSlice[T comparable](a, b []T) bool
EqualSlice Compare two slices to see if they are the same, in the same order and with the same value.
func First ¶
func First[T any](s []T) T
First returns the first element of a collection or error if empty.
func PackCompress ¶
func PackCompressEncrypt ¶
PackCompressEncrypt Note that the key must be 16/24/32 bit length.
func SafeFilename ¶
func Sha1 ¶
func Sha1(v interface{}) string
Sha1 returns the SHA1 digest of the data. (Result Length: 40 bits)
func Sha3 ¶
func Sha3(v interface{}) string
Sha3 returns the SHA3-256 digest of the data. (Result Length : 64 bits)
func SubStringHan ¶
SubStringHan 返回一个字符串的前 n 个字符,其中中文字符的长度为 2:
func UnCompressUnpack ¶
func UnCompressUnpackTo ¶
func UnCompressZLib ¶
Types ¶
type Comparable ¶
type Ip2LocationRecord ¶
type Ip2LocationRecord struct { CountryShort string Country string Province string // Region Province City string }
func Ip2Location ¶
func Ip2Location(ipList []string) ([]*Ip2LocationRecord, error)
Ip2Location ... Country / CountryShort / Province / City
type PsInfo ¶
type PsInfo struct { Memory PsInfoItem Disk PsInfoItem Load PsInfoLoad Uptime uint64 }