Skip to content

Commit

Permalink
Support Canal Json Protocol (Draft) (pingcap#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyunyan authored Oct 24, 2024
1 parent 8e5c5ef commit 2168025
Show file tree
Hide file tree
Showing 8 changed files with 402 additions and 741 deletions.
17 changes: 17 additions & 0 deletions pkg/common/event/row_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,20 @@ func (e *RowEvent) GetRows() *chunk.Row {
func (e *RowEvent) GetPreRows() *chunk.Row {
return &e.Event.PreRow
}

// PrimaryKeyColumnNames return all primary key's name
// TODO: need a test for delete / insert / update event
// 但理论上应该没区别,没有 ddl 没有发生 schema 变化的
func (e *RowEvent) PrimaryKeyColumnNames() []string {
var result []string

result = make([]string, 0)
tableInfo := e.TableInfo
columns := e.TableInfo.Columns
for _, col := range columns {
if col != nil && tableInfo.ForceGetColumnFlagType(col.ID).IsPrimaryKey() {
result = append(result, tableInfo.ForceGetColumnName(col.ID))
}
}
return result
}
176 changes: 0 additions & 176 deletions pkg/sink/codec/canal/canal_encoder.go

This file was deleted.

Loading

0 comments on commit 2168025

Please sign in to comment.