Update readme
This commit is contained in:
parent
4caf572811
commit
77a97a8020
46
README.md
46
README.md
@ -1,24 +1,42 @@
|
||||
# BLT
|
||||
# Bocadillo
|
||||
|
||||
MySQL binary log parser.
|
||||
Bocadillo is a parser for MySQL binary log. It can connect to a server, register
|
||||
as a slave and process binary log.
|
||||
|
||||
### Usage
|
||||
|
||||
```go
|
||||
// import "github.com/localhots/bocadillo/reader"
|
||||
|
||||
reader, _ := reader.New("root@(127.0.0.1:3306)/testdb", slave.Config{
|
||||
ServerID: 1000, // Arbitrary unique ID
|
||||
File: "mysql-bin.000035", // Log file name
|
||||
Offset: 4, // Log file offset
|
||||
})
|
||||
|
||||
for {
|
||||
evt, err := reader.ReadEvent()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to read event: %v", err)
|
||||
}
|
||||
|
||||
log.Println("Event received:", evt.Header.Type.String())
|
||||
if evt.Table != nil {
|
||||
rows, err := evt.DecodeRows()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to parse rows event: %v", err)
|
||||
}
|
||||
log.Println("Table:", evt.Table.TableName, "Changes:", rows.Rows)
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### WIP
|
||||
|
||||
Work in progress, some events are not fully supported.
|
||||
|
||||
A fork of [go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) is used
|
||||
to provide underlying connection and basic packet exchange.
|
||||
|
||||
**TODO:**
|
||||
|
||||
* [x] FormatDescriptionEvent
|
||||
* [x] TableMapEvent
|
||||
* [x] RotateEvent
|
||||
* [x] RowsEvent
|
||||
* [ ] XIDEvent
|
||||
* [ ] GTIDEvent
|
||||
* [ ] QueryEvent
|
||||
|
||||
### Licence
|
||||
|
||||
MIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user