1
0
Fork 0

Fix readme indentation

This commit is contained in:
Gregory Eremin 2018-11-11 16:17:41 +01:00
parent a8dd324474
commit 9e62446755
1 changed files with 6 additions and 5 deletions

View File

@ -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)
} }
} }
``` ```