Bocadillo
This commit is contained in:
parent
5ef0642499
commit
aa2b3ad7b1
|
@ -5,7 +5,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/localhots/blt/tools"
|
"github.com/localhots/bocadillo/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FormatDescription is a description of binary log format.
|
// FormatDescription is a description of binary log format.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package binlog
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/localhots/blt/tools"
|
"github.com/localhots/bocadillo/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package binlog
|
package binlog
|
||||||
|
|
||||||
import "github.com/localhots/blt/tools"
|
import "github.com/localhots/bocadillo/tools"
|
||||||
|
|
||||||
// Position ...
|
// Position ...
|
||||||
type Position struct {
|
type Position struct {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package binlog
|
package binlog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/localhots/blt/mysql"
|
"github.com/localhots/bocadillo/mysql"
|
||||||
"github.com/localhots/blt/tools"
|
"github.com/localhots/bocadillo/tools"
|
||||||
"github.com/localhots/pretty"
|
"github.com/localhots/pretty"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -79,19 +79,17 @@ func (e *RowsEvent) decodeRows(buf *tools.Buffer, td TableDescription, bm []byte
|
||||||
count = (count + 7) / 8
|
count = (count + 7) / 8
|
||||||
|
|
||||||
nullBM := buf.ReadStringVarLen(count)
|
nullBM := buf.ReadStringVarLen(count)
|
||||||
nullCnt := 0
|
nullIdx := 0
|
||||||
row := make([]interface{}, e.ColumnCount)
|
row := make([]interface{}, e.ColumnCount)
|
||||||
|
|
||||||
pretty.Println(count, nullBM)
|
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
for i := 0; i < int(e.ColumnCount); i++ {
|
for i := 0; i < int(e.ColumnCount); i++ {
|
||||||
if !isBitSet(bm, i) {
|
if !isBitSet(bm, i) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
isNull := (uint32(nullBM[nullCnt/8]) >> uint32(nullCnt%8)) & 0x01
|
isNull := (uint32(nullBM[nullIdx/8]) >> uint32(nullIdx%8)) & 1
|
||||||
nullCnt++
|
nullIdx++
|
||||||
if isNull > 0 {
|
if isNull > 0 {
|
||||||
row[i] = nil
|
row[i] = nil
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package binlog
|
package binlog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/localhots/blt/mysql"
|
"github.com/localhots/bocadillo/mysql"
|
||||||
"github.com/localhots/blt/tools"
|
"github.com/localhots/bocadillo/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TableDescription contains table details required to process rows events.
|
// TableDescription contains table details required to process rows events.
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/localhots/blt/reader"
|
"github.com/localhots/bocadillo/reader"
|
||||||
"github.com/localhots/gobelt/log"
|
"github.com/localhots/gobelt/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ package reader
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/juju/errors"
|
"github.com/juju/errors"
|
||||||
"github.com/localhots/blt/binlog"
|
"github.com/localhots/bocadillo/binlog"
|
||||||
"github.com/localhots/blt/schema"
|
"github.com/localhots/bocadillo/schema"
|
||||||
"github.com/localhots/pretty"
|
"github.com/localhots/pretty"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/localhots/blt/tools"
|
"github.com/localhots/bocadillo/tools"
|
||||||
"github.com/localhots/mysql"
|
"github.com/localhots/mysql"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package tools
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"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
|
// Buffer is a simple wrapper over a slice of bytes with a cursor. It allows for
|
||||||
|
|
Loading…
Reference in New Issue