diff --git a/cmd/compose/benchmark/benchmark_test.go b/cmd/compose/benchmark/benchmark_test.go index 49a20e3..f9e23ee 100644 --- a/cmd/compose/benchmark/benchmark_test.go +++ b/cmd/compose/benchmark/benchmark_test.go @@ -13,12 +13,12 @@ import ( "github.com/Goboolean/fetch-server/internal/domain/service/relay" "github.com/Goboolean/fetch-server/internal/domain/service/transmission" grpc_infra "github.com/Goboolean/fetch-server/internal/infrastructure/grpc" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/fetch-server/internal/infrastructure/rdbms" "github.com/Goboolean/fetch-server/internal/infrastructure/redis" mock_infra "github.com/Goboolean/fetch-server/internal/infrastructure/ws/mock" _ "github.com/Goboolean/fetch-server/internal/util/env" "github.com/Goboolean/shared/pkg/broker" - "github.com/Goboolean/shared/pkg/mongo" ) // This package is for bemchmark test diff --git a/cmd/compose/develop/develop.go b/cmd/compose/develop/develop.go index fa8dbd5..b6b0943 100644 --- a/cmd/compose/develop/develop.go +++ b/cmd/compose/develop/develop.go @@ -9,9 +9,9 @@ import ( "github.com/Goboolean/fetch-server/cmd/inject" "github.com/Goboolean/fetch-server/internal/domain/service/persistence" "github.com/Goboolean/fetch-server/internal/domain/service/transmission" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/fetch-server/internal/infrastructure/rdbms" "github.com/Goboolean/fetch-server/internal/infrastructure/redis" - "github.com/Goboolean/shared/pkg/mongo" "github.com/joho/godotenv" ) diff --git a/cmd/compose/develop/develop_test.go b/cmd/compose/develop/develop_test.go index 9c9738d..d7bf52d 100644 --- a/cmd/compose/develop/develop_test.go +++ b/cmd/compose/develop/develop_test.go @@ -15,12 +15,12 @@ import ( "github.com/Goboolean/fetch-server/internal/domain/service/relay" "github.com/Goboolean/fetch-server/internal/domain/service/transmission" grpc_infra "github.com/Goboolean/fetch-server/internal/infrastructure/grpc" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/fetch-server/internal/infrastructure/rdbms" "github.com/Goboolean/fetch-server/internal/infrastructure/redis" mock_infra "github.com/Goboolean/fetch-server/internal/infrastructure/ws/mock" _ "github.com/Goboolean/fetch-server/internal/util/env" "github.com/Goboolean/shared/pkg/broker" - "github.com/Goboolean/shared/pkg/mongo" "github.com/stretchr/testify/assert" ) diff --git a/cmd/compose/released/released.go b/cmd/compose/released/released.go index b242187..f577845 100644 --- a/cmd/compose/released/released.go +++ b/cmd/compose/released/released.go @@ -10,9 +10,9 @@ import ( "github.com/Goboolean/fetch-server/cmd/inject" "github.com/Goboolean/fetch-server/internal/domain/service/persistence" "github.com/Goboolean/fetch-server/internal/domain/service/transmission" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/fetch-server/internal/infrastructure/rdbms" "github.com/Goboolean/fetch-server/internal/infrastructure/redis" - "github.com/Goboolean/shared/pkg/mongo" "github.com/joho/godotenv" ) diff --git a/cmd/compose/withmockdata.go b/cmd/compose/withmockdata.go index eb3ea27..01daed9 100644 --- a/cmd/compose/withmockdata.go +++ b/cmd/compose/withmockdata.go @@ -10,10 +10,10 @@ import ( "github.com/Goboolean/fetch-server/cmd/inject" "github.com/Goboolean/fetch-server/internal/domain/service/persistence" "github.com/Goboolean/fetch-server/internal/domain/service/transmission" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/fetch-server/internal/infrastructure/rdbms" "github.com/Goboolean/fetch-server/internal/infrastructure/redis" "github.com/Goboolean/fetch-server/internal/infrastructure/ws/mock" - "github.com/Goboolean/shared/pkg/mongo" "github.com/joho/godotenv" ) diff --git a/cmd/inject/infrastructure.go b/cmd/inject/infrastructure.go index 0ad624f..ecfe56e 100644 --- a/cmd/inject/infrastructure.go +++ b/cmd/inject/infrastructure.go @@ -10,6 +10,7 @@ import ( "github.com/Goboolean/fetch-server/internal/domain/port/in" "github.com/Goboolean/fetch-server/internal/infrastructure/grpc" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/fetch-server/internal/infrastructure/rdbms" "github.com/Goboolean/fetch-server/internal/infrastructure/redis" "github.com/Goboolean/fetch-server/internal/infrastructure/ws" @@ -19,7 +20,6 @@ import ( "github.com/Goboolean/fetch-server/internal/infrastructure/ws/polygon" "github.com/Goboolean/fetch-server/internal/util/prometheus" "github.com/Goboolean/shared/pkg/broker" - "github.com/Goboolean/shared/pkg/mongo" "github.com/Goboolean/shared/pkg/resolver" "github.com/google/wire" ) diff --git a/cmd/inject/service.go b/cmd/inject/service.go index 6b42db0..4740037 100644 --- a/cmd/inject/service.go +++ b/cmd/inject/service.go @@ -11,9 +11,9 @@ import ( persistence_adapter "github.com/Goboolean/fetch-server/internal/adapter/persistence" "github.com/Goboolean/fetch-server/internal/adapter/transaction" "github.com/Goboolean/fetch-server/internal/adapter/websocket" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/fetch-server/internal/infrastructure/rdbms" "github.com/Goboolean/shared/pkg/broker" - "github.com/Goboolean/shared/pkg/mongo" "github.com/Goboolean/fetch-server/internal/domain/port" "github.com/Goboolean/fetch-server/internal/domain/port/in" diff --git a/cmd/inject/wire_gen.go b/cmd/inject/wire_gen.go index 8cf7ed6..16dcad2 100644 --- a/cmd/inject/wire_gen.go +++ b/cmd/inject/wire_gen.go @@ -31,7 +31,7 @@ import ( "github.com/Goboolean/fetch-server/internal/infrastructure/ws/polygon" "github.com/Goboolean/fetch-server/internal/util/prometheus" "github.com/Goboolean/shared/pkg/broker" - "github.com/Goboolean/shared/pkg/mongo" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/shared/pkg/resolver" "github.com/google/wire" "os" diff --git a/internal/adapter/persistence/persistence.go b/internal/adapter/persistence/persistence.go index 4881413..188ccf3 100644 --- a/internal/adapter/persistence/persistence.go +++ b/internal/adapter/persistence/persistence.go @@ -6,9 +6,9 @@ import ( "github.com/Goboolean/fetch-server/internal/domain/port" "github.com/Goboolean/fetch-server/internal/domain/port/out" "github.com/Goboolean/fetch-server/internal/domain/vo" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/fetch-server/internal/infrastructure/rdbms" "github.com/Goboolean/fetch-server/internal/util/prometheus" - "github.com/Goboolean/shared/pkg/mongo" ) type Adapter struct { diff --git a/internal/adapter/transaction/constructor.go b/internal/adapter/transaction/constructor.go index ea0f653..08a0257 100644 --- a/internal/adapter/transaction/constructor.go +++ b/internal/adapter/transaction/constructor.go @@ -4,8 +4,8 @@ import ( "context" "github.com/Goboolean/fetch-server/internal/domain/port" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/fetch-server/internal/infrastructure/rdbms" - "github.com/Goboolean/shared/pkg/mongo" ) type Tx struct { diff --git a/internal/infrastructure/mongo/constructor_test.go b/internal/infrastructure/mongo/constructor_test.go index 79bc881..cac4cdb 100644 --- a/internal/infrastructure/mongo/constructor_test.go +++ b/internal/infrastructure/mongo/constructor_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/Goboolean/shared/pkg/mongo" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" "github.com/Goboolean/shared/pkg/resolver" "github.com/joho/godotenv" ) diff --git a/internal/infrastructure/mongo/query_test.go b/internal/infrastructure/mongo/query_test.go index 3390bfe..4c58b8a 100644 --- a/internal/infrastructure/mongo/query_test.go +++ b/internal/infrastructure/mongo/query_test.go @@ -6,19 +6,16 @@ import ( "testing" "time" - "github.com/Goboolean/shared/pkg/mongo" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" ) - - func Test_InsertStockBatch(t *testing.T) { var ( - stockId = "stock.goboolean.test" - stockBatch = []*mongo.StockAggregate{{},{},{}} + stockId = "stock.goboolean.test" + stockBatch = []*mongo.StockAggregate{{}, {}, {}} ) - tx, err := instance.NewTx(context.Background()) if err != nil { t.Errorf("failed to start transaction: %v", err) @@ -45,8 +42,6 @@ func isEqual(send, received []*mongo.StockAggregate) bool { return true } - - func Test_FetchAllStockBatch(t *testing.T) { var stockId = "stock.goboolean.test" @@ -74,13 +69,11 @@ func Test_FetchAllStockBatch(t *testing.T) { } } - - func Test_FetchAllStockBatchMassive(t *testing.T) { var ( - stockId = "stock.goboolean.test" - stockBatch = []*mongo.StockAggregate{{},{},{}} + stockId = "stock.goboolean.test" + stockBatch = []*mongo.StockAggregate{{}, {}, {}} ) ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) @@ -99,7 +92,7 @@ func Test_FetchAllStockBatchMassive(t *testing.T) { received := make([]*mongo.StockAggregate, 0) - loop: +loop: for { select { case <-ctx.Done(): @@ -117,5 +110,3 @@ func Test_FetchAllStockBatchMassive(t *testing.T) { t.Errorf("FetchAllStockBatchMassive() failed: send and received are not equal") } } - - diff --git a/internal/infrastructure/mongo/transaction_test.go b/internal/infrastructure/mongo/transaction_test.go index 1c0cba6..a13a403 100644 --- a/internal/infrastructure/mongo/transaction_test.go +++ b/internal/infrastructure/mongo/transaction_test.go @@ -4,11 +4,9 @@ import ( "context" "testing" - "github.com/Goboolean/shared/pkg/mongo" + "github.com/Goboolean/fetch-server/internal/infrastructure/mongo" ) - - func Test_Commit(t *testing.T) { var stockId = "stock.goboolean.test" @@ -32,13 +30,11 @@ func Test_Commit(t *testing.T) { } - - func Test_Rollback(t *testing.T) { var ( - stockId = "stock.goboolean.test" - stockBatch = []*mongo.StockAggregate{{},{},{}} + stockId = "stock.goboolean.test" + stockBatch = []*mongo.StockAggregate{{}, {}, {}} ) tx, err := instance.NewTx(context.Background()) @@ -77,8 +73,6 @@ func Test_Rollback(t *testing.T) { } } - - func Test_CommitAfterRollback(t *testing.T) { tx, err := instance.NewTx(context.Background()) @@ -99,8 +93,6 @@ func Test_CommitAfterRollback(t *testing.T) { } - - func Test_CommitWithoutExec(t *testing.T) { tx, err := instance.NewTx(context.Background()) @@ -114,4 +106,4 @@ func Test_CommitWithoutExec(t *testing.T) { return } -} \ No newline at end of file +}