fixed tests and compilation
This commit is contained in:
@@ -200,7 +200,7 @@ type repositoryStub struct {
|
||||
|
||||
func (r *repositoryStub) Ping(context.Context) error { return nil }
|
||||
func (r *repositoryStub) Rates() storage.RatesStore { return r.rates }
|
||||
func (r *repositoryStub) Quotes() quotestorage.QuotesStore { return nil }
|
||||
func (r *repositoryStub) Quotes() storage.QuotesStore { return nil }
|
||||
func (r *repositoryStub) Pairs() storage.PairStore { return nil }
|
||||
func (r *repositoryStub) Currencies() storage.CurrencyStore { return nil }
|
||||
|
||||
|
||||
@@ -19,16 +19,16 @@ import (
|
||||
|
||||
type repositoryStub struct {
|
||||
rates storage.RatesStore
|
||||
quotes quotestorage.QuotesStore
|
||||
quotes storage.QuotesStore
|
||||
pairs storage.PairStore
|
||||
currencies storage.CurrencyStore
|
||||
pingErr error
|
||||
}
|
||||
|
||||
func (r *repositoryStub) Ping(ctx context.Context) error { return r.pingErr }
|
||||
func (r *repositoryStub) Rates() storage.RatesStore { return r.rates }
|
||||
func (r *repositoryStub) Quotes() quotestorage.QuotesStore { return r.quotes }
|
||||
func (r *repositoryStub) Pairs() storage.PairStore { return r.pairs }
|
||||
func (r *repositoryStub) Ping(ctx context.Context) error { return r.pingErr }
|
||||
func (r *repositoryStub) Rates() storage.RatesStore { return r.rates }
|
||||
func (r *repositoryStub) Quotes() storage.QuotesStore { return r.quotes }
|
||||
func (r *repositoryStub) Pairs() storage.PairStore { return r.pairs }
|
||||
func (r *repositoryStub) Currencies() storage.CurrencyStore {
|
||||
return r.currencies
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ type Store struct {
|
||||
txFactory transaction.Factory
|
||||
|
||||
rates storage.RatesStore
|
||||
quotes quotestorage.QuotesStore
|
||||
quotes storage.QuotesStore
|
||||
pairs storage.PairStore
|
||||
currencies storage.CurrencyStore
|
||||
}
|
||||
@@ -92,7 +92,7 @@ func (s *Store) Rates() storage.RatesStore {
|
||||
return s.rates
|
||||
}
|
||||
|
||||
func (s *Store) Quotes() quotestorage.QuotesStore {
|
||||
func (s *Store) Quotes() storage.QuotesStore {
|
||||
return s.quotes
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ type quotesStore struct {
|
||||
txFactory transaction.Factory
|
||||
}
|
||||
|
||||
func NewQuotes(logger mlogger.Logger, db *mongo.Database, txFactory transaction.Factory) (quotestorage.QuotesStore, error) {
|
||||
func NewQuotes(logger mlogger.Logger, db *mongo.Database, txFactory transaction.Factory) (storage.QuotesStore, error) {
|
||||
repo := repository.CreateMongoRepository(db, model.QuotesCollection)
|
||||
indexes := []*ri.Definition{
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ type repoStub struct {
|
||||
findOneFn func(ctx context.Context, query builder.Query, result storable.Storable) error
|
||||
findManyFn func(ctx context.Context, query builder.Query, decoder rd.DecodingFunc) error
|
||||
updateFn func(ctx context.Context, obj storable.Storable) error
|
||||
upsertFn func(ctx context.Context, obj storable.Storable) error
|
||||
patchManyFn func(ctx context.Context, filter builder.Query, patch builder.Patch) (int, error)
|
||||
createIdxFn func(def *ri.Definition) error
|
||||
}
|
||||
@@ -69,6 +70,13 @@ func (r *repoStub) Update(ctx context.Context, obj storable.Storable) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *repoStub) Upsert(ctx context.Context, obj storable.Storable) error {
|
||||
if r.upsertFn != nil {
|
||||
return r.upsertFn(ctx, obj)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *repoStub) Patch(ctx context.Context, id bson.ObjectID, patch builder.Patch) error {
|
||||
return merrors.NotImplemented("Patch not used")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user