utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The 'MAIN TYPE' of a column
	// missing column
	DATA_MISSING uint64 = iota

	// character varying of the latin1_swedish_ci charset-collation;
	// note that the MySQL format for this, DATA_BINARY, DATA_VARMYSQL,
	// is also affected by whether the 'precise type' contains DATA_MYSQL_TRUE_VARCHAR
	DATA_VARCHAR

	// fixed length character of the latin1_swedish_ci charset-collation
	DATA_CHAR

	// binary string of fixed length
	DATA_FIXBINARY

	// binary string
	DATA_BINARY

	// binary large object, or a TEXT type; if prtype & DATA_BINARY_TYPE == 0,
	// then this is actually a TEXT column (or a BLOB created with < 4.0.14;
	// since column prefix indexes came only in 4.0.14,
	// the missing flag in BLOBs created before that does not cause any harm)
	DATA_BLOB

	// integer: can be any size 1 - 8 bytes
	DATA_INT

	// address of the child page in node pointer
	DATA_SYS_CHILD

	// system column Data types >= DATA_FLOAT
	// must be compared using the whole field, not as binary strings
	DATA_SYS
	DATA_FLOAT
	DATA_DOUBLE

	// decimal number stored as an ASCII string
	DATA_DECIMAL

	// any charset varying length char
	DATA_VARMYSQL

	// any charset fixed length char NOTE that 4.1.1 used DATA_MYSQL and
	// DATA_VARMYSQL for all character sets, and the charset-collation for
	// tables created with it can also be latin1_swedish_ci
	DATA_MYSQL

	// dtype_store_for_order_and_null_size()
	DATA_MTYPE_MAX
)

The MySQL InnoDB data type

View Source
const (
	MYSQL_TYPE_DECIMAL uint64 = iota
	MYSQL_TYPE_TINY
	MYSQL_TYPE_SHORT
	MYSQL_TYPE_LONG
	MYSQL_TYPE_FLOAT
	MYSQL_TYPE_DOUBLE
	MYSQL_TYPE_NULL
	MYSQL_TYPE_TIMESTAMP
	MYSQL_TYPE_LONGLONG
	MYSQL_TYPE_INT24
	MYSQL_TYPE_DATE
	MYSQL_TYPE_TIME
	MYSQL_TYPE_DATETIME
	MYSQL_TYPE_YEAR
	MYSQL_TYPE_NEWDATE
	MYSQL_TYPE_VARCHAR
	MYSQL_TYPE_BIT
	MYSQL_TYPE_TIMESTAMP2
	MYSQL_TYPE_DATETIME2
	MYSQL_TYPE_TIME2
	MYSQL_TYPE_NEWDECIMAL  = 246
	MYSQL_TYPE_ENUM        = 247
	MYSQL_TYPE_SET         = 248
	MYSQL_TYPE_TINY_BLOB   = 249
	MYSQL_TYPE_MEDIUM_BLOB = 250
	MYSQL_TYPE_LONG_BLOB   = 251
	MYSQL_TYPE_BLOB        = 252
	MYSQL_TYPE_VAR_STRING  = 253
	MYSQL_TYPE_STRING      = 254
	MYSQL_TYPE_GEOMETRY    = 255
)

The MySQL Server type

View Source
const (
	TinyIntRange  = 128 * 2
	SmallIntRange = 32768 * 2
	IntRange      = 2147483648 * 2
)

The MySQL integer data type range.

View Source
const (
	MySQLVersion = 5.6
)

Variables

This section is empty.

Functions

func EscapeValue

func EscapeValue(colValue string) string

func FixedLengthInt

func FixedLengthInt(buf []byte) uint64

FixedLengthInt: little endian

func GetFilesFromOS

func GetFilesFromOS(FilePath string) ([]string, error)

func GetFixedLength

func GetFixedLength(DataType uint64, FieldLen uint64) uint64

func GetFixedLengthByMySQLType

func GetFixedLengthByMySQLType(MySQLType uint64, FieldLen uint64) uint64

func GetIntValue

func GetIntValue(FixLength int, value []byte) interface{}

func GetMaxLength

func GetMaxLength(MySQLType uint64)

func GetTimeFormat

func GetTimeFormat(data []byte) int

func GetUintValue

func GetUintValue(FixLength int, value []byte) uint64

func MachUllGetMuchCompressedSize

func MachUllGetMuchCompressedSize(num uint64) uint64

func MatchGetCompressedSize

func MatchGetCompressedSize(n uint64) (uint64, error)

func MatchParseCompressed

func MatchParseCompressed(data []byte, pos uint64) (uint64, uint64, error)

func MatchReadFrom1

func MatchReadFrom1(b []byte) uint64

func MatchReadFrom2

func MatchReadFrom2(b []byte) uint64

func MatchReadFrom3

func MatchReadFrom3(b []byte) uint64

func MatchReadFrom4

func MatchReadFrom4(b []byte) uint64

func MatchReadFrom7

func MatchReadFrom7(b []byte) uint64

func MatchReadFrom8

func MatchReadFrom8(b []byte) uint64

func MatchUllReadComPressed

func MatchUllReadComPressed(b []byte, pos *uint64) uint64

func MatchUllReadMuchCompressed

func MatchUllReadMuchCompressed(b []byte) (uint64, error)

func PageHeaderGetField

func PageHeaderGetField(b []byte, field uint64) uint64

func PageIsComp

func PageIsComp(b []byte) uint64

func ParseBinaryFloat32

func ParseBinaryFloat32(data []byte) float32

func ParseBinaryFloat64

func ParseBinaryFloat64(data []byte) float64

func ParseBinaryInt16

func ParseBinaryInt16(data []byte) int16

func ParseBinaryInt24

func ParseBinaryInt24(data []byte) int32

func ParseBinaryInt32

func ParseBinaryInt32(data []byte) int32

func ParseBinaryInt64

func ParseBinaryInt64(data []byte) int64

func ParseBinaryInt8

func ParseBinaryInt8(data []byte) int8

func ParseBinaryUint16

func ParseBinaryUint16(data []byte) uint16

func ParseBinaryUint24

func ParseBinaryUint24(data []byte) uint32

func ParseBinaryUint32

func ParseBinaryUint32(data []byte) uint32

func ParseBinaryUint64

func ParseBinaryUint64(data []byte) uint64

func ParseBinaryUint8

func ParseBinaryUint8(data []byte) uint8

func ParseBlob

func ParseBlob(data []byte) string

func ParseData

func ParseData(DataType uint64, MySQLType uint64,
	data []byte, FieldLen uint64, FixLength int,
	IsUnsigned bool, IsBinary *bool) (interface{}, error)

TODO: deal with chinese, many character, should provide solutions.

func ParseDate

func ParseDate(data []byte) string

func ParseDateTime

func ParseDateTime(data []byte) string

func ParseDouble

func ParseDouble(data []byte) float64

func ParseFloat

func ParseFloat(data []byte) float32

func ParseIndex

func ParseIndex(comp bool, data []byte, pos uint64) (error, uint64)

func ParseInsertRecord

func ParseInsertRecord(IsShort bool, data []byte, pos uint64) (error, uint64)

func ParseTime

func ParseTime(data []byte) string

func ParseTimeStamp

func ParseTimeStamp(data []byte) string

func ReadIntoStruct

func ReadIntoStruct(file *os.File, dest interface{}, size int) error

func ReadNextBytes

func ReadNextBytes(file *os.File, number int) ([]byte, error)

func Rec1GetFieldEndInfo

func Rec1GetFieldEndInfo(d []byte, offset uint64, n uint64) uint64

Reference MySQL rec_1_get_field_end_info method.

func Rec2GetFieldEndInfo

func Rec2GetFieldEndInfo(d []byte, offset uint64, n uint64) uint64

Reference MySQL rec_2_get_field_end_info method.

func RecGet1byteOffsFlag

func RecGet1byteOffsFlag(rec []byte, offset uint64) uint64

Reference MySQL rec_get_1byte_offs_flag

func RecGetBitField1

func RecGetBitField1(rec []byte, offset uint64, offs uint64, mask uint64, shift uint64) uint64

func RecGetNthField

func RecGetNthField(rec []byte, offsets []uint64, n int, length *uint64) []byte

#define rec_get_nth_field(rec, offsets, n, len) \ ((rec) + rec_get_nth_field_offs(offsets, n, len))

func RecGetNthFieldOffs

func RecGetNthFieldOffs(offsets []uint64, n int, len *uint64) uint64

func RecGetStatus

func RecGetStatus(rec []byte, offset uint64) uint64

Reference MySQL rec_get_status method

func RecOffNFields

func RecOffNFields(offsets *[]uint64) uint64

Reference MySQL rec_offs_n_fields method.

func RecOffsDataSize

func RecOffsDataSize(offsets *[]uint64) uint64

Reference MySQL rec_offs_data_size method.

func RecOffsExtraSize

func RecOffsExtraSize(offsets *[]uint64) uint64

Reference MySQL rec_offs_extra_size method.

func RecOffsNthSize

func RecOffsNthSize(offsets *[]uint64, n int) uint64

Reference MySQL rec_offs_nth_size method.

func RecOffsSize

func RecOffsSize(offsets *[]uint64) uint64

Reference MySQL rec_offs_size method.

func UtAlignOffset

func UtAlignOffset(rec []byte, AlignNo uint64) uint64

Reference MySQL ut_align_offset method

func UtUllCreate

func UtUllCreate(high uint64, low uint64) uint64

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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