gh-ost/vendor/github.com/siddontang/go-mysql/cmd/go-binlogparser/main.go
2017-02-12 13:13:54 +02:00

29 lines
429 B
Go

package main
import (
"flag"
"os"
"github.com/siddontang/go-mysql/replication"
)
var name = flag.String("name", "", "binlog file name")
var offset = flag.Int64("offset", 0, "parse start offset")
func main() {
flag.Parse()
p := replication.NewBinlogParser()
f := func(e *replication.BinlogEvent) error {
e.Dump(os.Stdout)
return nil
}
err := p.ParseFile(*name, *offset, f)
if err != nil {
println(err)
}
}