Fix readme indentation
This commit is contained in:
parent
a8dd324474
commit
9e62446755
11
README.md
11
README.md
|
@ -7,6 +7,7 @@ as a slave and process binary log.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// import "github.com/localhots/bocadillo/reader"
|
// import "github.com/localhots/bocadillo/reader"
|
||||||
|
// import "github.com/localhots/bocadillo/reader/slave"
|
||||||
|
|
||||||
reader, _ := reader.New("root@(127.0.0.1:3306)/testdb", slave.Config{
|
reader, _ := reader.New("root@(127.0.0.1:3306)/testdb", slave.Config{
|
||||||
ServerID: 1000, // Arbitrary unique ID
|
ServerID: 1000, // Arbitrary unique ID
|
||||||
|
@ -18,16 +19,16 @@ for {
|
||||||
evt, err := reader.ReadEvent()
|
evt, err := reader.ReadEvent()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to read event: %v", err)
|
log.Fatalf("Failed to read event: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Event received:", evt.Header.Type.String())
|
log.Println("Event received:", evt.Header.Type.String())
|
||||||
if evt.Table != nil {
|
if evt.Table != nil {
|
||||||
rows, err := evt.DecodeRows()
|
rows, err := evt.DecodeRows()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to parse rows event: %v", err)
|
log.Fatalf("Failed to parse rows event: %v", err)
|
||||||
}
|
}
|
||||||
log.Println("Table:", evt.Table.TableName, "Changes:", rows.Rows)
|
log.Println("Table:", evt.Table.TableName, "Changes:", rows.Rows)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue