https://github.com/obgnail/binlog-parser
mysql binlog 文件解析 SDK
https://github.com/obgnail/binlog-parser
binlog binlog-parser golang mysql
Last synced: about 1 month ago
JSON representation
mysql binlog 文件解析 SDK
- Host: GitHub
- URL: https://github.com/obgnail/binlog-parser
- Owner: obgnail
- Created: 2022-06-22T06:53:03.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-22T06:58:43.000Z (about 4 years ago)
- Last Synced: 2025-07-13T07:37:01.352Z (12 months ago)
- Topics: binlog, binlog-parser, golang, mysql
- Language: Go
- Homepage:
- Size: 28.1 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# binlog-parser
mysql binlog 文件解析SDK(只解析了部分event)
## Usage
```go
func main() {
decoder, err := binlog.NewBinFileDecoder("./testdata/mysql-bin.000004")
if err != nil {
panic(err)
}
err = decoder.WalkEvent(func(event *binlog.BinEvent) (isContinue bool, err error) {
eventType, _ := event.GetType()
fmt.Printf("Got %s\n", eventType)
fmt.Println(event.Header)
if event.Body != nil {
fmt.Println(event.Body)
}
fmt.Println(strings.Repeat("=", 100))
return true, nil
})
if err != nil {
panic(err)
}
}
```