schema

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLockKey

func BuildLockKey(lockKeyRecords *TableRecords) string

Types

type ColumnMeta

type ColumnMeta struct {
	TableCat        string
	TableSchemeName string
	TableName       string
	ColumnName      string
	DataType        int32
	DataTypeName    string
	ColumnSize      int64
	DecimalDigits   int64
	NumPrecRadix    int64
	Nullable        int32
	Remarks         string
	ColumnDef       string
	SqlDataType     int32
	SqlDatetimeSub  int32
	CharOctetLength int64
	OrdinalPosition int64
	IsNullable      string
	IsAutoIncrement string
}

type Field

type Field struct {
	Name    string
	KeyType KeyType
	Type    int32
	Value   interface{}
}

type IndexMeta

type IndexMeta struct {
	Values          []ColumnMeta
	NonUnique       bool
	IndexQualifier  string
	IndexName       string
	ColumnName      string
	Type            int16
	IndexType       IndexType
	AscOrDesc       string
	Cardinality     int32
	OrdinalPosition int32
}

type IndexType

type IndexType byte
const (
	IndexTypePrimary IndexType = iota
	IndexTypeNormal
	IndexTypeUnique
	IndexTypeFullText
)

type KeyType

type KeyType byte
const (
	Null KeyType = iota
	PrimaryKey
)

type Row

type Row struct {
	Fields []*Field
}

func (*Row) NonPrimaryKeys

func (row *Row) NonPrimaryKeys() []*Field

func (*Row) PrimaryKeys

func (row *Row) PrimaryKeys() []*Field

type RowLock

type RowLock struct {
	XID      string
	BranchID int64
	RowKey   string
}

type TableMeta

type TableMeta struct {
	SchemaName string
	TableName  string
	Columns    []string
	AllColumns map[string]ColumnMeta
	AllIndexes map[string]IndexMeta
}

func (TableMeta) GetPKName

func (meta TableMeta) GetPKName() string

func (TableMeta) GetPrimaryKeyMap

func (meta TableMeta) GetPrimaryKeyMap() map[string]ColumnMeta

func (TableMeta) GetPrimaryKeyOnlyName

func (meta TableMeta) GetPrimaryKeyOnlyName() []string

type TableRecords

type TableRecords struct {
	TableMeta TableMeta `json:"-"`
	TableName string
	Rows      []*Row
}

func BuildBinaryRecords added in v0.1.1

func BuildBinaryRecords(meta TableMeta, result *mysql.Result) *TableRecords

func BuildTextRecords added in v0.1.1

func BuildTextRecords(meta TableMeta, result *mysql.Result) *TableRecords

func NewTableRecords

func NewTableRecords(meta TableMeta) *TableRecords

func (*TableRecords) PKFields

func (records *TableRecords) PKFields() []*Field

Jump to

Keyboard shortcuts

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