common

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIOEOF used for io.EOF.
	ErrIOEOF = io.EOF
)

Functions

func BytesToString

func BytesToString(b []byte) (s string)

BytesToString casts slice to string without copy

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes casts string to slice without copy

Types

type Buffer

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

Buffer represents the buffer tuple.

func NewBuffer

func NewBuffer(cap int) *Buffer

NewBuffer creates a new buffer.

func ReadBuffer

func ReadBuffer(b []byte) *Buffer

ReadBuffer used to read buffer from datas.

func (*Buffer) Datas

func (b *Buffer) Datas() []byte

Datas returns the datas of the buffer.

func (*Buffer) Length

func (b *Buffer) Length() int

Length returns the last position of the buffer.

func (*Buffer) ReadBytes

func (b *Buffer) ReadBytes(n int) (v []byte, err error)

ReadBytes used to read bytes.

func (*Buffer) ReadBytesEOF

func (b *Buffer) ReadBytesEOF() (v []byte, err error)

ReadBytesEOF reads until the first EOF in the buffer returning a byte slice containing the data up to and not including the EOF

func (*Buffer) ReadBytesNUL

func (b *Buffer) ReadBytesNUL() (v []byte, err error)

ReadBytesNUL reads until the first NUL in the buffer returning a byte slice containing the data up to and not including the NUL

func (*Buffer) ReadEOF

func (b *Buffer) ReadEOF(n int) (err error)

ReadEOF used to read EOF.

func (*Buffer) ReadLenEncode

func (b *Buffer) ReadLenEncode() (v uint64, err error)

ReadLenEncode used to read variable length.

func (*Buffer) ReadLenEncodeBytes

func (b *Buffer) ReadLenEncodeBytes() (v []byte, err error)

ReadLenEncodeBytes used to read variable bytes.

func (*Buffer) ReadLenEncodeString

func (b *Buffer) ReadLenEncodeString() (s string, err error)

ReadLenEncodeString used to read variable string.

func (*Buffer) ReadString

func (b *Buffer) ReadString(n int) (s string, err error)

ReadString used to read string.

func (*Buffer) ReadStringEOF

func (b *Buffer) ReadStringEOF() (s string, err error)

ReadStringEOF reads until the first EOF in the buffer returning a string containing the data up to and not including the EOF

func (*Buffer) ReadStringNUL

func (b *Buffer) ReadStringNUL() (s string, err error)

ReadStringNUL reads until the first NUL in the buffer returning a string containing the data up to and not including the NUL

func (*Buffer) ReadU16

func (b *Buffer) ReadU16() (v uint16, err error)

ReadU16 used to read uint16.

func (*Buffer) ReadU24

func (b *Buffer) ReadU24() (v uint32, err error)

ReadU24 used to read uint24.

func (*Buffer) ReadU32

func (b *Buffer) ReadU32() (v uint32, err error)

ReadU32 used to read uint32.

func (*Buffer) ReadU64

func (b *Buffer) ReadU64() (v uint64, err error)

ReadU64 used to read uint64.

func (*Buffer) ReadU8

func (b *Buffer) ReadU8() (v uint8, err error)

ReadU8 used read uint8.

func (*Buffer) ReadZero

func (b *Buffer) ReadZero(n int) (err error)

ReadZero used to read zero.

func (*Buffer) Reset

func (b *Buffer) Reset(data []byte)

Reset used to reset a buffer.

func (*Buffer) Seek

func (b *Buffer) Seek() int

Seek returns the seek position of the buffer.

func (*Buffer) WriteBytes

func (b *Buffer) WriteBytes(bs []byte)

WriteBytes used to write bytes.

func (*Buffer) WriteEOF

func (b *Buffer) WriteEOF(n int)

WriteEOF used to write EOF.

func (*Buffer) WriteLenEncode

func (b *Buffer) WriteLenEncode(v uint64)

WriteLenEncode used to write variable length. https://dev.mysql.com/doc/internals/en/integer.html#length-encoded-integer

func (*Buffer) WriteLenEncodeBytes

func (b *Buffer) WriteLenEncodeBytes(v []byte)

WriteLenEncodeBytes used to write variable bytes.

func (*Buffer) WriteLenEncodeNUL

func (b *Buffer) WriteLenEncodeNUL()

WriteLenEncodeNUL used to write NUL> 0xfb is represents a NULL in a ProtocolText::ResultsetRow

func (*Buffer) WriteLenEncodeString

func (b *Buffer) WriteLenEncodeString(s string)

WriteLenEncodeString used to write variable string.

func (*Buffer) WriteString

func (b *Buffer) WriteString(s string)

WriteString used to write string.

func (*Buffer) WriteU16

func (b *Buffer) WriteU16(v uint16)

WriteU16 used to write uint16.

func (*Buffer) WriteU24

func (b *Buffer) WriteU24(v uint32)

WriteU24 used to write uint24.

func (*Buffer) WriteU32

func (b *Buffer) WriteU32(v uint32)

WriteU32 used to write uint32.

func (*Buffer) WriteU64

func (b *Buffer) WriteU64(v uint64)

WriteU64 used to write uint64.

func (*Buffer) WriteU8

func (b *Buffer) WriteU8(v uint8)

WriteU8 used to write uint8.

func (*Buffer) WriteZero

func (b *Buffer) WriteZero(n int)

WriteZero used to write zero.

type HashTable

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

HashTable the hash table.

func NewHashTable

func NewHashTable() *HashTable

NewHashTable create hash table.

func (*HashTable) Get

func (h *HashTable) Get(key []byte) (bool, []interface{})

Get gets the values of the "key".

func (*HashTable) Next

func (h *HashTable) Next() Iterator

Next used to iterate the HashTable.

func (*HashTable) Put

func (h *HashTable) Put(key []byte, value interface{})

Put puts the key/value pairs to the HashTable.

func (*HashTable) Size

func (h *HashTable) Size() int

Size used to get the hashtable size.

type Iterator

type Iterator func() (key []byte, value []interface{}, next Iterator)

Iterator used to iterate the HashTable.

Jump to

Keyboard shortcuts

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