Skip to content

Commit

Permalink
Update encoder.go
Browse files Browse the repository at this point in the history
  • Loading branch information
wk989898 authored Feb 18, 2025
1 parent 6cd203d commit 99300a1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/sink/codec/canal/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,14 +601,17 @@ type JSONTxnEventEncoder struct {
txnCommitTs uint64
txnSchema *string
txnTable *string

columnSelector columnselector.Selector
}

// NewJSONTxnEventEncoderBuilder creates a new JSONTxnEventEncoder
func NewJSONTxnEventEncoderBuilder(config *common.Config) common.TxnEventEncoder {
return &JSONTxnEventEncoder{
valueBuf: &bytes.Buffer{},
terminator: []byte(config.Terminator),
config: config,
valueBuf: &bytes.Buffer{},
terminator: []byte(config.Terminator),
columnSelector: columnselector.NewDefaultColumnSelector(),
config: config,
}
}

Expand All @@ -620,9 +623,10 @@ func (j *JSONTxnEventEncoder) AppendTxnEvent(event *commonEvent.DMLEvent) error
break
}
value, err := newJSONMessageForDML(&commonEvent.RowEvent{
TableInfo: event.TableInfo,
CommitTs: event.CommitTs,
Event: row,
TableInfo: event.TableInfo,
CommitTs: event.CommitTs,
Event: row,
ColumnSelector: j.columnSelector,
}, j.config, false, "")
if err != nil {
return err
Expand Down

0 comments on commit 99300a1

Please sign in to comment.