From 79f86a6dc835b524810eaa1804010cf8d1e0b3d7 Mon Sep 17 00:00:00 2001 From: Starainrt Date: Mon, 6 Nov 2023 13:47:15 +0800 Subject: [PATCH] add only show dml control --- parse.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parse.go b/parse.go index 5d62306..1b512f1 100644 --- a/parse.go +++ b/parse.go @@ -346,6 +346,7 @@ type BinlogFilter struct { BigThan int SmallThan int OnlyShowGtid bool + OnlyShowDML bool } func parseBinlogWithFilter(r io.Reader, parse *replication.BinlogParser, filter BinlogFilter, fn func(Transaction) bool) error { @@ -449,7 +450,7 @@ func parseBinlogWithFilter(r io.Reader, parse *replication.BinlogParser, filter if filter.SmallThan != 0 && filter.SmallThan < tx.Size { return true } - if !filter.OnlyShowGtid && tx.validSchemaCount == 0 { + if !filter.OnlyShowGtid && filter.OnlyShowDML && tx.validSchemaCount == 0 { return true } return fn(tx)