util

package
v0.0.0-...-d224df5 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendByte

func AppendByte(size int) []byte

func ByteReverse

func ByteReverse(buff []byte) []byte

func CheckError

func CheckError(err error)

func ConvertAsciiToByte

func ConvertAsciiToByte(ascii uint8) byte

func ConvertBits2Byte

func ConvertBits2Byte(data string) byte

func ConvertBits2Bytes

func ConvertBits2Bytes(data string) []byte

func ConvertBool2Byte

func ConvertBool2Byte(boolValue bool) byte

func ConvertByte2Bits

func ConvertByte2Bits(data byte) string

func ConvertByte2BitsString

func ConvertByte2BitsString(data byte) []string

func ConvertBytes2BitStrings

func ConvertBytes2BitStrings(data []byte) []string

注意BigEndian和littleEndian

func ConvertInt2Bytes

func ConvertInt2Bytes(i int32) []byte

func ConvertInt3Bytes

func ConvertInt3Bytes(i int32) []byte

func ConvertInt4Bytes

func ConvertInt4Bytes(i int32) []byte

func ConvertLong8Bytes

func ConvertLong8Bytes(i int64) []byte

func ConvertString2Byte

func ConvertString2Byte(data string) byte

func ConvertStringArrays2Bytes

func ConvertStringArrays2Bytes(data []string) []byte

func ConvertStringArrays2BytesArrays

func ConvertStringArrays2BytesArrays(bitString []string) []byte

func ConvertUInt2Bytes

func ConvertUInt2Bytes(i uint16) []byte

func ConvertUInt4Bytes

func ConvertUInt4Bytes(i uint32) []byte

func ConvertULong8Bytes

func ConvertULong8Bytes(i uint64) []byte

func ConvertValueOfBitsInBytes

func ConvertValueOfBitsInBytes(byte byte, index int, value int) byte

将某个字节的第几位bit置换,value0,1

func CreateDataBaseDir

func CreateDataBaseDir(Path string, folderName string) bool

func CreateFile

func CreateFile(filePath string, fileName string) error

func CreateFileBySize

func CreateFileBySize(filePath string, fileName string, size int64) error

func CreateFileWithPath

func CreateFileWithPath(filePath string) error

func GetBytes

func GetBytes(key interface{}) ([]byte, error)

func GetDBRowId

func GetDBRowId()

生成UUID

func GetLength

func GetLength(length int64) int

func GetLengthBytes

func GetLengthBytes(buff []byte) int

func GetPassword

func GetPassword(pass []byte, seed []byte, restOfScrambleBuff []byte) []byte

stage1_hash = SHA1(password), using the password that the user has entered. token = SHA1(SHA1(stage1_hash), scramble) XOR stage1_hash

func GetRollPointer

func GetRollPointer()

func GetTrxId

func GetTrxId()

func Goid

func Goid() int

func HashCode

func HashCode(key []byte) uint64

将一个键进行Hash

func IsNil

func IsNil(i interface{}) bool

func LeftPaddleBitString

func LeftPaddleBitString(bitstring string, leftPaddleSize int) byte

func ListFileDirByPath

func ListFileDirByPath(path string) map[string]string

func Log

func Log(v ...interface{})

func LogDebug

func LogDebug(v ...interface{})

func LogErr

func LogErr(v ...interface{})

func PathExists

func PathExists(path string) (bool, error)

func RandomBytes

func RandomBytes(size int) []byte

func ReadBitSet

func ReadBitSet(buff []byte, cursor int, length int, bigEndian bool) (int, []int)

func ReadByte

func ReadByte(buff []byte, cursor int) (int, byte)

func ReadBytes

func ReadBytes(buff []byte, cursor int, offset int) (int, []byte)

func ReadBytesByIndexBit

func ReadBytesByIndexBit(byte byte, index int) string

func ReadBytesByIndexBitByStart

func ReadBytesByIndexBitByStart(byte byte, start int, end int) string

func ReadBytesWithNull

func ReadBytesWithNull(buff []byte, cursor int) (int, []byte)

func ReadFileBySeekStart

func ReadFileBySeekStart(filePath string, offset uint64) []byte

func ReadFileBySeekStartWithSize

func ReadFileBySeekStartWithSize(filePath string, offset uint64, size int) []byte

func ReadFileContent

func ReadFileContent(filepath string, fileName string) ([]byte, error)

func ReadLength

func ReadLength(buff []byte, cursor int) (int, uint64)

func ReadLengthString

func ReadLengthString(buff []byte, cursor int) (int, string)

func ReadString

func ReadString(buff []byte, cursor int) (int, string)

func ReadStringWithNull

func ReadStringWithNull(buff []byte, cursor int) (int, string)

func ReadUB2

func ReadUB2(buff []byte, cursor int) (int, uint16)

func ReadUB2Byte2Int

func ReadUB2Byte2Int(buff []byte) uint16

func ReadUB3

func ReadUB3(buff []byte, cursor int) (int, uint32)

func ReadUB4

func ReadUB4(buff []byte, cursor int) (int, uint32)

func ReadUB4Byte2Int

func ReadUB4Byte2Int(buff []byte) int

func ReadUB4Byte2UInt32

func ReadUB4Byte2UInt32(buff []byte) uint32

func ReadUB4ByteInt

func ReadUB4ByteInt(buff [4]byte) int

func ReadUB6

func ReadUB6(buff []byte, cursor int) (int, uint64)

func ReadUB8

func ReadUB8(buff []byte, cursor int) (int, uint64)

func ReadUB8Byte2Long

func ReadUB8Byte2Long(buff []byte) uint64

func ReadUB8Bytes2Long

func ReadUB8Bytes2Long(buff []byte) int64

func ReadUB8Long

func ReadUB8Long(buff []byte, cursor int) (int, int64)

func ReadWithNull

func ReadWithNull(buff []byte, cursor int) (int, []byte)

func StringArrays2Bytes

func StringArrays2Bytes(values []string) []byte

func Substr

func Substr(str string, start int, end int) string

func ToBinaryString

func ToBinaryString(data byte) string

func TrimLeftPaddleBitString

func TrimLeftPaddleBitString(bitData byte, leftPaddleStart int) []string

func WriteBitsByStart

func WriteBitsByStart(byte byte, bitsString []string, start int, end int) string

func WriteByte

func WriteByte(buf []byte, b byte) []byte

func WriteBytes

func WriteBytes(buf []byte, from []byte) []byte

func WriteErrorLog

func WriteErrorLog(log string)

func WriteFileBySeekStart

func WriteFileBySeekStart(filePath string, offset uint64, data []byte)

func WriteInt32WithNull

func WriteInt32WithNull(buf []byte, data uint32) []byte

func WriteLength

func WriteLength(buf []byte, length int64) []byte

func WriteNoticeLog

func WriteNoticeLog(log string)

func WriteToFileByAppendBytes

func WriteToFileByAppendBytes(filepath string, fileName string, content []byte)

func WriteUB2

func WriteUB2(buf []byte, i uint16) []byte

func WriteUB3

func WriteUB3(buf []byte, i uint32) []byte

func WriteUB4

func WriteUB4(buf []byte, i uint32) []byte

func WriteUB6

func WriteUB6(buf []byte, i uint64) []byte

func WriteUB8

func WriteUB8(buf []byte, i uint64) []byte

func WriteWithLength

func WriteWithLength(buf []byte, from []byte) []byte

func WriteWithLengthWithNullValue

func WriteWithLengthWithNullValue(buf []byte, from []byte, nullValue byte) []byte

func WriteWithNull

func WriteWithNull(buf []byte, from []byte) []byte

Types

type IniParser

type IniParser struct {
	// contains filtered or unexported fields
}

func (*IniParser) GetFloat32

func (this *IniParser) GetFloat32(section string, key string) float32

func (*IniParser) GetFloat64

func (this *IniParser) GetFloat64(section string, key string) float64

func (*IniParser) GetInt32

func (this *IniParser) GetInt32(section string, key string) int32

func (*IniParser) GetInt64

func (this *IniParser) GetInt64(section string, key string) int64

func (*IniParser) GetString

func (this *IniParser) GetString(section string, key string) string

func (*IniParser) GetUint32

func (this *IniParser) GetUint32(section string, key string) uint32

func (*IniParser) GetUint64

func (this *IniParser) GetUint64(section string, key string) uint64

func (*IniParser) Load

func (this *IniParser) Load(config_file_name string) error

type IniParserError

type IniParserError struct {
	// contains filtered or unexported fields
}

func (*IniParserError) Error

func (e *IniParserError) Error() string

Jump to

Keyboard shortcuts

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