You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
909 B
Go

package binlog
import (
"fmt"
"os"
"testing"
"time"
)
func TestParse(t *testing.T) {
ParseBinlogFile("./test/mysql-bin.000023", func(transaction Transaction) bool {
fmt.Println(transaction)
return true
})
}
func TestParseFilter(t *testing.T) {
ParseBinlogWithFilter("./test/mysql-bin.000023", 0, BinlogFilter{
IncludeGtid: "",
ExcludeGtid: "",
StartPos: 0,
EndPos: 0,
StartDate: time.Time{},
EndDate: time.Time{},
BigThan: 0,
SmallThan: 0,
}, func(transaction Transaction) bool {
fmt.Println(transaction)
return true
})
}
func TestParseExternal(t *testing.T) {
file := `C:\mysql-bin.000001`
if _, err := os.Stat(file); err != nil {
return
}
i := 0
ParseBinlogWithFilter(file, 0, BinlogFilter{
OnlyShowGtid: false,
}, func(transaction Transaction) bool {
fmt.Println(transaction)
i++
if i >= 10 {
return false
}
return true
})
}