util

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: BSD-3-Clause Imports: 26 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToInt16

func BytesToInt16(bs []byte) (_r int16)

func BytesToInt32

func BytesToInt32(bs []byte) (_r int32)

func BytesToInt64

func BytesToInt64(bs []byte) (_r int64)

func BytesToIntArray

func BytesToIntArray(bs []byte) (data []int64)

func CRC32

func CRC32(bs []byte) uint32

func CRC64

func CRC64(bs []byte) uint64

func CRC8

func CRC8(bs []byte) (_r byte)

func CheckGzipType

func CheckGzipType(bs []byte) (err error)

func Concat

func Concat(ss ...string) string

func Decode

func Decode[T any](buf []byte) (_r *T, err error)

func Encode

func Encode(e any) (by []byte, err error)

func Gzip

func Gzip(bs []byte) (buf bytes.Buffer, err error)

func Hash32 added in v0.1.4

func Hash32(key []byte) uint32

func Hash64 added in v0.1.4

func Hash64(key []byte) uint64

func Int16ToBytes

func Int16ToBytes(n int16) []byte

func Int32ToBytes

func Int32ToBytes(n int32) []byte

func Int64ToBytes

func Int64ToBytes(n int64) []byte

func IntArrayToBytes

func IntArrayToBytes(n []int64) []byte

func IsFileExist

func IsFileExist(path string) (_r bool)

func JsonDecode

func JsonDecode[T any](bs []byte) (_r T, err error)

func JsonEncode

func JsonEncode(v any) (bs []byte)

func MD5

func MD5(bs []byte) []byte

func MatchString

func MatchString(pattern string, s string) bool

func Md5Str

func Md5Str(s string) string

func RandInt64Strict added in v0.1.6

func RandInt64Strict(i int64) (int64, error)

func RandUint added in v0.1.6

func RandUint(i uint) uint

func ReadFile

func ReadFile(path string) (bs []byte, err error)

func SHA1

func SHA1(bs []byte) []byte

func Sha1Str

func Sha1Str(s string) string

func SnappyDecode

func SnappyDecode(bs []byte) (_r []byte)

func SnappyEncode

func SnappyEncode(bs []byte) (_r []byte)

func StrToTimeFormat

func StrToTimeFormat(s string) (t time.Time, err error)

func TDecode

func TDecode[T thrift.TStruct](bs []byte, ts T) (_r T, err error)

func TEncode

func TEncode(ts thrift.TStruct) (_r []byte)

func UUID32 added in v0.1.6

func UUID32() uint32

func UUID64 added in v0.1.6

func UUID64() (rid int64)

func UnGzip

func UnGzip(bs []byte) (_bb bytes.Buffer, err error)

func UnZlib

func UnZlib(bs []byte) (_r []byte, err error)

func Zlib

func Zlib(bs []byte) (_r []byte, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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