19 lines
373 B
Go
19 lines
373 B
Go
package cdc
|
|
|
|
import (
|
|
"github.com/go-mysql-org/go-mysql/canal"
|
|
|
|
"dashboard-cdc-worker/internal/dashboard"
|
|
)
|
|
|
|
func rowMap(e *canal.RowsEvent, row []interface{}) dashboard.Row {
|
|
mapped := make(dashboard.Row, len(e.Table.Columns))
|
|
for index, column := range e.Table.Columns {
|
|
if index >= len(row) {
|
|
continue
|
|
}
|
|
mapped[column.Name] = row[index]
|
|
}
|
|
return mapped
|
|
}
|