1
0
Fork 0

Use dep to maintain dependencies

This commit is contained in:
Gregory Eremin 2018-11-09 01:09:25 +01:00
parent a16d6cf75c
commit ac07b6a997
5 changed files with 60 additions and 13 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
vendor

38
Gopkg.lock generated Normal file
View File

@ -0,0 +1,38 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/google/go-cmp"
packages = [
"cmp",
"cmp/internal/diff",
"cmp/internal/function",
"cmp/internal/value"
]
revision = "3af367b6b30c263d47e8895973edcca9a49cf029"
version = "v0.2.0"
[[projects]]
branch = "master"
name = "github.com/juju/errors"
packages = ["."]
revision = "a4583d0a56eac4bdd939e38050d0c69abe0a9b41"
[[projects]]
branch = "bocadillo"
name = "github.com/localhots/mysql"
packages = ["."]
revision = "c2889dfb94f790a6007c23ced2fa3a457d7d9ab0"
[[projects]]
name = "google.golang.org/appengine"
packages = ["cloudsql"]
revision = "4a4468ece617fc8205e99368fa2200e9d1fad421"
version = "v1.3.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "54cc4952aaa2b5e14d9b4cf42c54d933ecff5eb0dd354884dd23c9027630ce82"
solver-name = "gps-cdcl"
solver-version = 1

15
Gopkg.toml Normal file
View File

@ -0,0 +1,15 @@
[[constraint]]
name = "github.com/google/go-cmp"
version = "0.2.0"
[[constraint]]
branch = "master"
name = "github.com/juju/errors"
[[constraint]]
branch = "bocadillo"
name = "github.com/localhots/mysql"
[prune]
go-tests = true
unused-packages = true

View File

@ -1,11 +1,11 @@
package binlog package binlog
import ( import (
"fmt"
"time" "time"
"github.com/localhots/bocadillo/mysql" "github.com/localhots/bocadillo/mysql"
"github.com/localhots/bocadillo/tools" "github.com/localhots/bocadillo/tools"
"github.com/localhots/pretty"
) )
// RowsEvent contains a Rows Event. // RowsEvent contains a Rows Event.
@ -233,10 +233,8 @@ func (e *RowsEvent) decodeValue(buf *tools.Buffer, ct mysql.ColumnType, meta uin
// Too new // Too new
fallthrough fallthrough
default: default:
pretty.Printf("UNSUPPORTED Type %d %s %x %x\n", ct, ct.String(), meta, buf.Cur()) return fmt.Errorf("unsupported type: %d (%s) %x %x", ct, ct.String(), meta, buf.Cur())
} }
return nil
} }
// FIXME: Something is fishy with this whole string decoding. It seems like it // FIXME: Something is fishy with this whole string decoding. It seems like it

View File

@ -8,7 +8,6 @@ import (
"time" "time"
"github.com/localhots/bocadillo/reader" "github.com/localhots/bocadillo/reader"
"github.com/localhots/gobelt/log"
) )
func main() { func main() {
@ -30,12 +29,12 @@ func main() {
conn, err := reader.Connect(*dsn, conf) conn, err := reader.Connect(*dsn, conf)
if err != nil { if err != nil {
log.Fatalf(ctx, "Failed to establish connection: %v", err) log.Fatalf("Failed to establish connection: %v", err)
} }
reader, err := reader.NewReader(conn) reader, err := reader.NewReader(conn)
if err != nil { if err != nil {
log.Fatalf(ctx, "Failed to create reader: %v", err) log.Fatalf( "Failed to create reader: %v", err)
} }
off := conf.Offset off := conf.Offset
@ -43,14 +42,10 @@ func main() {
for { for {
evt, err := reader.ReadEvent() evt, err := reader.ReadEvent()
if err != nil { if err != nil {
log.Fatalf(ctx, "Failed to read event: %v", err) log.Fatalf("Failed to read event: %v", err)
} }
ts := time.Unix(int64(evt.Header.Timestamp), 0).Format(time.RFC3339) ts := time.Unix(int64(evt.Header.Timestamp), 0).Format(time.RFC3339)
log.Info(ctx, "Event received", log.F{ log.Printf("Event received: %s %d, %d\n", evt.Header.Type.String(), ts, off4 })
"type": evt.Header.Type,
"timestamp": ts,
"offset": off,
})
off = evt.Header.NextOffset off = evt.Header.NextOffset
} }
} }