base

package
v0.0.0-...-982e07a Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConvertToDataType = errors.New("error on converting to data type")

ErrConvertToDataType error that indicates if data type conversion was failed

View Source
var ErrMalformPacket = errors.New("malform packet error")

ErrMalformPacket if packet parsing failed

View Source
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 Uint16ToBytes

func Uint16ToBytes(n uint16) []byte

Uint16ToBytes returns bytes

func Uint32ToBytes

func Uint32ToBytes(n uint32) []byte

Uint32ToBytes returns bytes

func Uint64ToBytes

func Uint64ToBytes(n uint64) []byte

Uint64ToBytes returns bytes

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

func (t Type) IsBinaryType() bool

IsBinaryType true if field type is binary

Jump to

Keyboard shortcuts

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