table

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: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompactRowType      = 0
	MySQLFrmMagicHeader = 0xFE
	MySQLVersionId      = 50732
)

Variables

View Source
var RefTypeName = map[int]string{
	0:     "NULL_TYPE",
	257:   "INT8",
	770:   "UINT8",
	259:   "INT16",
	772:   "UINT16",
	261:   "INT24",
	774:   "UINT24",
	263:   "INT32",
	776:   "UINT32",
	265:   "INT64",
	778:   "UINT64",
	1035:  "FLOAT32",
	1036:  "FLOAT64",
	2061:  "TIMESTAMP",
	2062:  "DATE",
	2063:  "TIME",
	2064:  "DATETIME",
	785:   "YEAR",
	18:    "DECIMAL",
	6163:  "TEXT",
	10260: "BLOB",
	6165:  "VARCHAR",
	10262: "VARBINARY",
	6167:  "CHAR",
	10264: "BINARY",
	2073:  "BIT",
	2074:  "ENUM",
	2075:  "SET",
	28:    "TUPLE",
	2077:  "GEOMETRY",
	2078:  "JSON",
	31:    "EXPRESSION",
}
View Source
var RefTypeValue = map[string]int{
	"NULL_TYPE":  0,
	"INT8":       257,
	"UINT8":      770,
	"INT16":      259,
	"UINT16":     772,
	"INT24":      261,
	"UINT24":     774,
	"INT32":      263,
	"UINT32":     776,
	"INT64":      265,
	"UINT64":     778,
	"FLOAT32":    1035,
	"FLOAT64":    1036,
	"TIMESTAMP":  2061,
	"DATE":       2062,
	"TIME":       2063,
	"DATETIME":   2064,
	"YEAR":       785,
	"DECIMAL":    18,
	"TEXT":       6163,
	"BLOB":       10260,
	"VARCHAR":    6165,
	"VARBINARY":  10262,
	"CHAR":       6167,
	"BINARY":     10264,
	"BIT":        2073,
	"ENUM":       2074,
	"SET":        2075,
	"TUPLE":      28,
	"GEOMETRY":   2077,
	"JSON":       2078,
	"EXPRESSION": 31,
}

Functions

This section is empty.

Types

type FieldBytes

type FieldBytes struct {
	FieldColumnsOffset  []byte //列存储偏移量
	FieldColumnsContent []byte //实质内容	//FormColumns 数组
}

func (FieldBytes) ToBytes

func (i FieldBytes) ToBytes() []byte

type FieldBytesArray

type FieldBytesArray []FieldBytes

func (FieldBytesArray) ToBytes

func (i FieldBytesArray) ToBytes() []byte

type Form

type Form struct {
	FormMagicHeader    byte   //0xFE           1
	MySQLVersionId     []byte //50732			 4
	RowType            byte   //row_type_compact 1
	TableNameOffSet    []byte //				 4
	TableName          []byte //		不定长
	DataBaseNameOffSet []byte //		4
	DataBaseName       []byte //     不定长

	ColumnsLength         []byte //列长度		2byte
	FieldBytes            FieldBytesArray
	ClusterIndexOffSet    []byte //4
	ClusterIndex          []byte //不定长
	SecondaryIndexesCount byte
	SecondaryIndexes      SecondaryIndexesArray
}

func NewForm

func NewForm(dataBaseName string, tableName string) *Form

func NewFormWithBytes

func NewFormWithBytes(content []byte) *Form

func (*Form) InitForm

func (frm *Form) InitForm()

func (*Form) ToBytes

func (frm *Form) ToBytes() []byte

type FormColumns

type FormColumns struct {
	IsHidden                byte   //是否是隐藏列 0true,1false
	Type                    []byte //列类型4
	KeyType                 byte   // 0,1,2,3,4,5,6
	AutoIncrement           byte   //0,1 0 true,1 false
	NotNull                 byte   //0,1 0 true,1 false
	ZeroFill                byte
	AutoIncrementVal        []byte //2 auto_increment_offset 65535
	FieldNameOffSet         []byte //长度为4 列名偏移量
	FieldNameContent        []byte //不定长
	FieldEnumValuesOffSet   []byte //长度为4	枚举值偏移量
	FieldEnumValue          []byte //不定长
	FieldDefaultValueOffSet []byte //长度为4 默认值不定长
	FieldDefaultValueType   byte   //默认值类型 4
	FieldDefaultValue       []byte //默认值不定长
	FieldCommentValueOffSet []byte //长度为4
	FieldCommentValue       []byte //comment不定长
	FieldLength             []byte //字段长度,长度为2
}

* * 0x0100 auto_increment_offset表示自增长字段从那个数开始,他的取值范围是1 .. 65535 auto_increment_increment表示自增长字段每次递增的量,其默认值是1,取值范围是1 .. 65535

type SecondaryIndexes

type SecondaryIndexes struct {
	SecondaryIndexesOffset []byte //4
	SecondaryIndexes       []byte
}

func (SecondaryIndexes) ToBytes

func (i SecondaryIndexes) ToBytes() []byte

type SecondaryIndexesArray

type SecondaryIndexesArray []SecondaryIndexes

func (SecondaryIndexesArray) ToBytes

func (i SecondaryIndexesArray) ToBytes() []byte

Jump to

Keyboard shortcuts

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