Browse Source

修正错误继承方法引起的故障

master
xyiege 9 months ago
parent
commit
3c4a83691c
  1. 15
      mblog/main.go
  2. BIN
      mblog/mblog

15
mblog/main.go

@ -8,7 +8,6 @@ import (
"github.com/go-mysql-org/go-mysql/canal"
"github.com/go-mysql-org/go-mysql/mysql"
"github.com/go-mysql-org/go-mysql/replication"
)
// 自定义事件处理结构体
@ -79,13 +78,13 @@ func (h *MyEventHandler) OnRow(e *canal.RowsEvent) error {
}
// 处理DDL事件
func (h *MyEventHandler) OnDDL(nextPos mysql.Position, queryEvent *replication.QueryEvent) error {
sql := string(queryEvent.Query)
if sql != "" {
fmt.Println(sql + ";")
}
return nil
}
// func (h *MyEventHandler) OnDDL(nextPos mysql.Position, queryEvent *replication.QueryEvent) error {
// sql := string(queryEvent.Query)
// if sql != "" {
// fmt.Println(sql + ";")
// }
// return nil
// }
// 格式化值为SQL表示形式
func formatValue(value interface{}) string {

BIN
mblog/mblog

Binary file not shown.
Loading…
Cancel
Save