Skip to content

Commit

Permalink
Merge pull request #197 from maxekman/ISSUE-190/change-mongodb-driver
Browse files Browse the repository at this point in the history
ISSUE-190 / Use globalsign/mgo instead of labix/mgo as MongoDB driver
  • Loading branch information
maxekman authored Mar 21, 2018
2 parents a28625f + 8711fd5 commit f2ab4f8
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
26 changes: 13 additions & 13 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
name = "golang.org/x/net"

[[constraint]]
branch = "v2"
name = "gopkg.in/mgo.v2"
branch = "master"
name = "github.com/globalsign/mgo"
4 changes: 2 additions & 2 deletions eventstore/mongodb/eventstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"fmt"
"time"

"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson"

eh "github.com/looplab/eventhorizon"
)
Expand Down
18 changes: 9 additions & 9 deletions examples/todomvc/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestStaticFiles(t *testing.T) {

func TestGetAll(t *testing.T) {
domain.TimeNow = func() time.Time {
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.Local)
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.UTC)
}

h, err := NewHandler()
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestGetAll(t *testing.T) {

func TestCreate(t *testing.T) {
domain.TimeNow = func() time.Time {
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.Local)
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.UTC)
}

h, err := NewHandler()
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestCreate(t *testing.T) {

func TestDelete(t *testing.T) {
domain.TimeNow = func() time.Time {
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.Local)
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.UTC)
}

h, err := NewHandler()
Expand Down Expand Up @@ -187,7 +187,7 @@ func TestDelete(t *testing.T) {

func TestAddItem(t *testing.T) {
domain.TimeNow = func() time.Time {
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.Local)
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.UTC)
}

h, err := NewHandler()
Expand Down Expand Up @@ -248,7 +248,7 @@ func TestAddItem(t *testing.T) {

func TestRemoveItem(t *testing.T) {
domain.TimeNow = func() time.Time {
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.Local)
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.UTC)
}

h, err := NewHandler()
Expand Down Expand Up @@ -310,7 +310,7 @@ func TestRemoveItem(t *testing.T) {

func TestRemoveCompleted(t *testing.T) {
domain.TimeNow = func() time.Time {
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.Local)
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.UTC)
}

h, err := NewHandler()
Expand Down Expand Up @@ -390,7 +390,7 @@ func TestRemoveCompleted(t *testing.T) {

func TestSetItemDesc(t *testing.T) {
domain.TimeNow = func() time.Time {
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.Local)
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.UTC)
}

h, err := NewHandler()
Expand Down Expand Up @@ -457,7 +457,7 @@ func TestSetItemDesc(t *testing.T) {

func TestCheckItem(t *testing.T) {
domain.TimeNow = func() time.Time {
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.Local)
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.UTC)
}

h, err := NewHandler()
Expand Down Expand Up @@ -535,7 +535,7 @@ func TestCheckItem(t *testing.T) {

func TestCheckAllItems(t *testing.T) {
domain.TimeNow = func() time.Time {
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.Local)
return time.Date(2017, time.July, 10, 23, 0, 0, 0, time.UTC)
}

h, err := NewHandler()
Expand Down
2 changes: 1 addition & 1 deletion publisher/gcp/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"time"

"cloud.google.com/go/pubsub"
"gopkg.in/mgo.v2/bson"
"github.com/globalsign/mgo/bson"

eh "github.com/looplab/eventhorizon"
"github.com/looplab/eventhorizon/publisher/local"
Expand Down
2 changes: 1 addition & 1 deletion publisher/redis/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"time"

"github.com/garyburd/redigo/redis"
"github.com/globalsign/mgo/bson"
"github.com/jpillora/backoff"
"gopkg.in/mgo.v2/bson"

eh "github.com/looplab/eventhorizon"
"github.com/looplab/eventhorizon/publisher/local"
Expand Down
2 changes: 1 addition & 1 deletion repo/mongodb/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"context"
"errors"

"gopkg.in/mgo.v2"
"github.com/globalsign/mgo"

eh "github.com/looplab/eventhorizon"
)
Expand Down
6 changes: 3 additions & 3 deletions repo/mongodb/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"testing"
"time"

"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson"

eh "github.com/looplab/eventhorizon"
"github.com/looplab/eventhorizon/mocks"
Expand Down Expand Up @@ -82,7 +82,7 @@ func extraRepoTests(t *testing.T, ctx context.Context, repo *Repo) {
modelCustom := &mocks.Model{
ID: eh.NewUUID(),
Content: "modelCustom",
CreatedAt: time.Now().Round(time.Millisecond),
CreatedAt: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
}
if err := repo.Save(ctx, modelCustom); err != nil {
t.Error("there should be no error:", err)
Expand Down
8 changes: 4 additions & 4 deletions repo/testutil/common_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func RepoCommonTests(t *testing.T, ctx context.Context, repo eh.ReadWriteRepo) {
// Save model without ID.
entityMissingID := &mocks.Model{
Content: "entity1",
CreatedAt: time.Now().Round(time.Millisecond),
CreatedAt: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
}
err = repo.Save(ctx, entityMissingID)
if rrErr, ok := err.(eh.RepoError); !ok || rrErr.BaseErr != eh.ErrMissingEntityID {
Expand All @@ -59,7 +59,7 @@ func RepoCommonTests(t *testing.T, ctx context.Context, repo eh.ReadWriteRepo) {
entity1 := &mocks.Model{
ID: eh.NewUUID(),
Content: "entity1",
CreatedAt: time.Now().Round(time.Millisecond),
CreatedAt: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
}
if err = repo.Save(ctx, entity1); err != nil {
t.Error("there should be no error:", err)
Expand Down Expand Up @@ -88,7 +88,7 @@ func RepoCommonTests(t *testing.T, ctx context.Context, repo eh.ReadWriteRepo) {
entity1Alt := &mocks.Model{
ID: entity1.ID,
Content: "entity1Alt",
CreatedAt: time.Now().Round(time.Millisecond),
CreatedAt: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
}
if err = repo.Save(ctx, entity1Alt); err != nil {
t.Error("there should be no error:", err)
Expand All @@ -105,7 +105,7 @@ func RepoCommonTests(t *testing.T, ctx context.Context, repo eh.ReadWriteRepo) {
entity2 := &mocks.Model{
ID: eh.NewUUID(),
Content: "entity2",
CreatedAt: time.Now().Round(time.Millisecond),
CreatedAt: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
}
if err = repo.Save(ctx, entity2); err != nil {
t.Error("there should be no error:", err)
Expand Down

0 comments on commit f2ab4f8

Please sign in to comment.