From aa2b3ad7b1545991d39d7a638e1c0fa9b1d4f9e9 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Tue, 6 Nov 2018 23:17:48 +0100 Subject: [PATCH] Bocadillo --- binlog/event_format_description.go | 2 +- binlog/event_header.go | 2 +- binlog/event_rotate.go | 2 +- binlog/event_rows.go | 12 +++++------- binlog/event_table_map.go | 4 ++-- cmd/main.go | 2 +- reader/reader.go | 4 ++-- reader/slave_conn.go | 2 +- tools/buffer.go | 2 +- 9 files changed, 15 insertions(+), 17 deletions(-) diff --git a/binlog/event_format_description.go b/binlog/event_format_description.go index 71331e1..35d3f37 100644 --- a/binlog/event_format_description.go +++ b/binlog/event_format_description.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/localhots/blt/tools" + "github.com/localhots/bocadillo/tools" ) // FormatDescription is a description of binary log format. diff --git a/binlog/event_header.go b/binlog/event_header.go index 4e9bb95..05f6436 100644 --- a/binlog/event_header.go +++ b/binlog/event_header.go @@ -3,7 +3,7 @@ package binlog import ( "errors" - "github.com/localhots/blt/tools" + "github.com/localhots/bocadillo/tools" ) var ( diff --git a/binlog/event_rotate.go b/binlog/event_rotate.go index 2b2e389..4400ad3 100644 --- a/binlog/event_rotate.go +++ b/binlog/event_rotate.go @@ -1,6 +1,6 @@ package binlog -import "github.com/localhots/blt/tools" +import "github.com/localhots/bocadillo/tools" // Position ... type Position struct { diff --git a/binlog/event_rows.go b/binlog/event_rows.go index 153c97e..5210855 100644 --- a/binlog/event_rows.go +++ b/binlog/event_rows.go @@ -1,8 +1,8 @@ package binlog import ( - "github.com/localhots/blt/mysql" - "github.com/localhots/blt/tools" + "github.com/localhots/bocadillo/mysql" + "github.com/localhots/bocadillo/tools" "github.com/localhots/pretty" ) @@ -79,19 +79,17 @@ func (e *RowsEvent) decodeRows(buf *tools.Buffer, td TableDescription, bm []byte count = (count + 7) / 8 nullBM := buf.ReadStringVarLen(count) - nullCnt := 0 + nullIdx := 0 row := make([]interface{}, e.ColumnCount) - pretty.Println(count, nullBM) - var err error for i := 0; i < int(e.ColumnCount); i++ { if !isBitSet(bm, i) { continue } - isNull := (uint32(nullBM[nullCnt/8]) >> uint32(nullCnt%8)) & 0x01 - nullCnt++ + isNull := (uint32(nullBM[nullIdx/8]) >> uint32(nullIdx%8)) & 1 + nullIdx++ if isNull > 0 { row[i] = nil continue diff --git a/binlog/event_table_map.go b/binlog/event_table_map.go index 81c1446..8968039 100644 --- a/binlog/event_table_map.go +++ b/binlog/event_table_map.go @@ -1,8 +1,8 @@ package binlog import ( - "github.com/localhots/blt/mysql" - "github.com/localhots/blt/tools" + "github.com/localhots/bocadillo/mysql" + "github.com/localhots/bocadillo/tools" ) // TableDescription contains table details required to process rows events. diff --git a/cmd/main.go b/cmd/main.go index a387465..5e8204c 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -7,7 +7,7 @@ import ( "os" "time" - "github.com/localhots/blt/reader" + "github.com/localhots/bocadillo/reader" "github.com/localhots/gobelt/log" ) diff --git a/reader/reader.go b/reader/reader.go index 57f0a0f..85f54a0 100644 --- a/reader/reader.go +++ b/reader/reader.go @@ -2,8 +2,8 @@ package reader import ( "github.com/juju/errors" - "github.com/localhots/blt/binlog" - "github.com/localhots/blt/schema" + "github.com/localhots/bocadillo/binlog" + "github.com/localhots/bocadillo/schema" "github.com/localhots/pretty" ) diff --git a/reader/slave_conn.go b/reader/slave_conn.go index a341781..fd93a2e 100644 --- a/reader/slave_conn.go +++ b/reader/slave_conn.go @@ -7,7 +7,7 @@ import ( "io" "os" - "github.com/localhots/blt/tools" + "github.com/localhots/bocadillo/tools" "github.com/localhots/mysql" ) diff --git a/tools/buffer.go b/tools/buffer.go index c94d41b..182877c 100644 --- a/tools/buffer.go +++ b/tools/buffer.go @@ -3,7 +3,7 @@ package tools import ( "encoding/binary" - "github.com/localhots/blt/mysql" + "github.com/localhots/bocadillo/mysql" ) // Buffer is a simple wrapper over a slice of bytes with a cursor. It allows for