dts

package
v2.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const AliyunDtsSchema = `` /* 10904-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type AliDts

type AliDts struct {
	// contains filtered or unexported fields
}

func New

func New() (*AliDts, error)

func (*AliDts) Parse

func (ad *AliDts) Parse(data []byte) (*DtsRecord, error)

Parse 解析DTS的消息记录

type DtsField

type DtsField struct {
	Name     string `mapstructure:"name"`
	DataType int    `mapstructure:"dataTypeNumber"`
}

type DtsFields

type DtsFields struct {
	Items []*DtsField `mapstructure:"array"`
}

type DtsRecord

type DtsRecord struct {
	Version         int                    `mapstructure:"version"`
	Id              int64                  `mapstructure:"id"`
	SourceTimeStamp int64                  `mapstructure:"sourceTimestamp"`
	SourceTxId      string                 `mapstructure:"sourceTxid"`
	ObjectName      map[string]string      `mapstructure:"objectName"` // 数据库名.表名
	Operation       string                 `mapstructure:"operation"`
	Fields          map[string]interface{} `mapstructure:"fields"`       // 字段slice
	BeforeImages    map[string]interface{} `mapstructure:"beforeImages"` // 改变前
	AfterImages     map[string]interface{} `mapstructure:"afterImages"`  // 改变后

	// 额外的字段
	Database    string
	Table       string
	TableFields []*DtsField
}

DtsRecord 原始的记录

func (*DtsRecord) GetAfterColumns

func (r *DtsRecord) GetAfterColumns() map[string]string

func (*DtsRecord) GetBeforeColumns

func (r *DtsRecord) GetBeforeColumns() map[string]string

type DtsTypeBytes

type DtsTypeBytes struct {
	Value []byte `mapstructure:"value"`
}

type DtsTypeDateTime

type DtsTypeDateTime struct {
	Year   map[string]interface{} `mapstructure:"year"`
	Month  map[string]interface{} `mapstructure:"month"`
	Day    map[string]interface{} `mapstructure:"day"`
	Hour   map[string]interface{} `mapstructure:"hour"`
	Minute map[string]interface{} `mapstructure:"minute"`
	Second map[string]interface{} `mapstructure:"second"`
}

type DtsTypeTimestamp

type DtsTypeTimestamp struct {
	Timestamp int64 `mapstructure:"timestamp"`
}

type DtsTypeTimestampWithTimeZone

type DtsTypeTimestampWithTimeZone struct {
	Value DtsTypeDateTime `mapstructure:"value"`
}

type DtsTypeValue

type DtsTypeValue struct {
	Value string `mapstructure:"value"`
}

Jump to

Keyboard shortcuts

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