Documentation ¶
Index ¶
- Variables
- func LengthEncodedInt(data []byte) (num uint64, isNull bool, n int, err error)
- func LengthEncodedString(data []byte) ([]byte, int, error)
- func PutLengthEncodedInt(n uint64) []byte
- func PutLengthEncodedString(b []byte) []byte
- func SkipLengthEncodedString(data []byte) (int, error)
- func Uint16ToBytes(n uint16) []byte
- func Uint32ToBytes(n uint32) []byte
- func Uint64ToBytes(n uint64) []byte
- type StorageByte
- type Type
Constants ¶
This section is empty.
Variables ¶
var ErrConvertToDataType = errors.New("error on converting to data type")
ErrConvertToDataType error that indicates if data type conversion was failed
var ErrMalformPacket = errors.New("malform packet error")
ErrMalformPacket if packet parsing failed
var NumericTypesStorageBytes = map[Type]StorageByte{ TypeTiny: StorageByte(1), TypeShort: StorageByte(2), TypeYear: StorageByte(2), TypeLong: StorageByte(4), TypeFloat: StorageByte(4), TypeInt24: StorageByte(4), TypeDouble: StorageByte(8), TypeLongLong: StorageByte(8), TypeNull: StorageByte(0), }
NumericTypesStorageBytes return association between numeric types and amount of bytes used for their storing
Functions ¶
func LengthEncodedInt ¶
LengthEncodedInt https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::LengthEncodedInteger
func LengthEncodedString ¶
LengthEncodedString https://dev.mysql.com/doc/internals/en/string.html#packet-Protocol::LengthEncodedString
func PutLengthEncodedInt ¶
PutLengthEncodedInt https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::LengthEncodedInteger
func PutLengthEncodedString ¶
PutLengthEncodedString https://dev.mysql.com/doc/internals/en/string.html#packet-Protocol::LengthEncodedString
func SkipLengthEncodedString ¶
SkipLengthEncodedString https://dev.mysql.com/doc/internals/en/string.html#packet-Protocol::LengthEncodedString
Types ¶
type StorageByte ¶
type StorageByte int
StorageByte represent amount of bytes need to store MySQL type
func (StorageByte) Bits ¶
func (s StorageByte) Bits() int
Bits return number of bits of the StorageByte
type Type ¶
type Type byte
Type used for defining MySQL types
const ( TypeDecimal Type = iota TypeTiny TypeShort TypeLong TypeFloat TypeDouble TypeNull TypeTimestamp TypeLongLong TypeInt24 TypeDate TypeTime TypeDatetime TypeYear TypeNewDate TypeVarchar TypeBit )
Binary ColumnTypes https://dev.mysql.com/doc/dev/mysql-server/latest/namespaceclassic__protocol_1_1field__type.html
const ( TypeNewDecimal Type = iota + 0xf6 TypeEnum TypeSet TypeTinyBlob TypeMediumBlob TypeLongBlob TypeBlob TypeVarString TypeString TypeGeometry )
MySQL types
func (Type) IsBinaryType ¶
IsBinaryType true if field type is binary