fixed doc env vars + mongo v2 migration
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/tech/sendico/pkg/db/transaction"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
ri "github.com/tech/sendico/pkg/db/repository/index"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
rd "github.com/tech/sendico/pkg/db/repository/decoder"
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@@ -84,7 +84,7 @@ func TestCurrencyStoreUpsertUpdate(t *testing.T) {
|
||||
repo := &repoStub{
|
||||
findOneFn: func(_ context.Context, _ builder.Query, result storable.Storable) error {
|
||||
currency := result.(*model.Currency)
|
||||
currency.SetID(primitive.NewObjectID())
|
||||
currency.SetID(bson.NewObjectID())
|
||||
currency.Code = "USD"
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
ri "github.com/tech/sendico/pkg/db/repository/index"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
rd "github.com/tech/sendico/pkg/db/repository/decoder"
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@@ -82,7 +82,7 @@ func TestPairStoreUpsertUpdate(t *testing.T) {
|
||||
repo := &repoStub{
|
||||
findOneFn: func(_ context.Context, _ builder.Query, result storable.Storable) error {
|
||||
pair := result.(*model.Pair)
|
||||
pair.SetID(primitive.NewObjectID())
|
||||
pair.SetID(bson.NewObjectID())
|
||||
return nil
|
||||
},
|
||||
updateFn: func(_ context.Context, obj storable.Storable) error {
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/tech/sendico/pkg/db/transaction"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
ri "github.com/tech/sendico/pkg/db/repository/index"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
rd "github.com/tech/sendico/pkg/db/repository/decoder"
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@@ -40,7 +40,7 @@ func TestRatesStoreUpsertInsert(t *testing.T) {
|
||||
|
||||
func TestRatesStoreUpsertUpdate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
existingID := primitive.NewObjectID()
|
||||
existingID := bson.NewObjectID()
|
||||
var updated *model.RateSnapshot
|
||||
|
||||
repo := &repoStub{
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"github.com/tech/sendico/pkg/db/transaction"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
pmodel "github.com/tech/sendico/pkg/model"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
)
|
||||
|
||||
type repoStub struct {
|
||||
@@ -44,7 +44,7 @@ func (r *repoStub) InsertMany(ctx context.Context, objects []storable.Storable)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *repoStub) Get(ctx context.Context, id primitive.ObjectID, result storable.Storable) error {
|
||||
func (r *repoStub) Get(ctx context.Context, id bson.ObjectID, result storable.Storable) error {
|
||||
return merrors.NotImplemented("Get not used")
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func (r *repoStub) Update(ctx context.Context, obj storable.Storable) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *repoStub) Patch(ctx context.Context, id primitive.ObjectID, patch builder.Patch) error {
|
||||
func (r *repoStub) Patch(ctx context.Context, id bson.ObjectID, patch builder.Patch) error {
|
||||
return merrors.NotImplemented("Patch not used")
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ func (r *repoStub) PatchMany(ctx context.Context, filter builder.Query, patch bu
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (r *repoStub) Delete(ctx context.Context, id primitive.ObjectID) error {
|
||||
func (r *repoStub) Delete(ctx context.Context, id bson.ObjectID) error {
|
||||
return merrors.NotImplemented("Delete not used")
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func (r *repoStub) CreateIndex(def *ri.Definition) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *repoStub) ListIDs(ctx context.Context, query builder.Query) ([]primitive.ObjectID, error) {
|
||||
func (r *repoStub) ListIDs(ctx context.Context, query builder.Query) ([]bson.ObjectID, error) {
|
||||
return nil, merrors.NotImplemented("ListIDs not used")
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/tech/sendico/pkg/db/transaction"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
)
|
||||
|
||||
type mongoTransactionFactory struct {
|
||||
@@ -26,7 +26,7 @@ func (t *mongoTransaction) Execute(ctx context.Context, cb transaction.Callback)
|
||||
}
|
||||
defer session.EndSession(ctx)
|
||||
|
||||
run := func(sessCtx mongo.SessionContext) (any, error) {
|
||||
run := func(sessCtx context.Context) (any, error) {
|
||||
return cb(sessCtx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user