translator

package
v0.0.0-...-6fba4f8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatumToColumn

func DatumToColumn(colInfo *model.ColumnInfo, datum types.Datum) (col *obinlog.Column)

DatumToColumn convert types.Datum to obinlog.Column

func DecodeOldAndNewRow

func DecodeOldAndNewRow(b []byte,
	cols map[int64]*model.ColumnInfo,
	loc *time.Location,
	canAppendDefaultValue bool,
	pinfo *model.TableInfo,
) (map[int64]types.Datum, map[int64]types.Datum, error)

DecodeOldAndNewRow decodes a byte slice into datums with a existing row map. Row layout: colID1, value1, colID2, value2, .....

func SetSQLMode

func SetSQLMode(mode mysql.SQLMode)

SetSQLMode set the sql mode of parser

func TiBinlogToOracleTxn

func TiBinlogToOracleTxn(infoGetter TableInfoGetter, schema string, table string, tiBinlog *tipb.Binlog, pv *tipb.PrewriteValue, shouldSkip bool, tableRouter *router.Table) (txn *loader.Txn, err error)

TiBinlogToOracleTxn translate the format to loader.Txn

func TiBinlogToPbBinlog

func TiBinlogToPbBinlog(infoGetter TableInfoGetter, schema string, table string, tiBinlog *tipb.Binlog, pv *tipb.PrewriteValue) (pbBinlog *pb.Binlog, err error)

TiBinlogToPbBinlog translate the binlog format

func TiBinlogToSecondaryBinlog

func TiBinlogToSecondaryBinlog(
	infoGetter TableInfoGetter,
	schema string,
	table string,
	tiBinlog *pb.Binlog,
	pv *pb.PrewriteValue,
) (*obinlog.Binlog, error)

TiBinlogToSecondaryBinlog translates the format to secondary binlog

func TiBinlogToTxn

func TiBinlogToTxn(infoGetter TableInfoGetter, schema string, table string, tiBinlog *tipb.Binlog, pv *tipb.PrewriteValue, shouldSkip bool, loc *time.Location) (txn *loader.Txn, err error)

TiBinlogToTxn translate the format to loader.Txn

Types

type BinlogGenerator

type BinlogGenerator struct {
	TiBinlog *ti.Binlog
	PV       *ti.PrewriteValue
	Schema   string
	Table    string
	// contains filtered or unexported fields
}

BinlogGenerator is a test helper for generating some binlog.

func (*BinlogGenerator) CanAppendDefaultValue

func (g *BinlogGenerator) CanAppendDefaultValue(id int64, schemaVersion int64) bool

CanAppendDefaultValue implements TableInfoGetter interface

func (*BinlogGenerator) IsDroppingColumn

func (g *BinlogGenerator) IsDroppingColumn(id int64) bool

IsDroppingColumn implements TableInfoGetter interface

func (*BinlogGenerator) SchemaAndTableName

func (g *BinlogGenerator) SchemaAndTableName(id int64) (schema string, table string, ok bool)

SchemaAndTableName implements TableInfoGetter interface

func (*BinlogGenerator) SetAllDML

func (g *BinlogGenerator) SetAllDML(c *check.C)

SetAllDML one insert/update/delete/update in one txn.

func (*BinlogGenerator) SetDDL

func (g *BinlogGenerator) SetDDL()

SetDDL set up a ddl binlog.

func (*BinlogGenerator) SetDelete

func (g *BinlogGenerator) SetDelete(c *check.C)

SetDelete set the info to be a delete event

func (*BinlogGenerator) SetInsert

func (g *BinlogGenerator) SetInsert(c *check.C)

SetInsert set up a insert event binlog.

func (*BinlogGenerator) SetUpdate

func (g *BinlogGenerator) SetUpdate(c *check.C)

SetUpdate set up a update event binlog.

func (*BinlogGenerator) TableByID

func (g *BinlogGenerator) TableByID(id int64) (info *model.TableInfo, ok bool)

TableByID implements TableInfoGetter interface

func (*BinlogGenerator) TableBySchemaVersion

func (g *BinlogGenerator) TableBySchemaVersion(id int64, schemaVersion int64) (info *model.TableInfo, ok bool)

TableBySchemaVersion implements TableInfoGetter interface

type TableInfoGetter

type TableInfoGetter interface {
	TableByID(id int64) (info *model.TableInfo, ok bool)
	SchemaAndTableName(id int64) (string, string, bool)
	CanAppendDefaultValue(id int64, schemaVersion int64) bool
	// IsDroppingColumn(id int64) bool
	TableBySchemaVersion(id int64, schemaVersion int64) (info *model.TableInfo, ok bool)
}

TableInfoGetter is used to get table info by table id of TiDB

Jump to

Keyboard shortcuts

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