diff --git a/.CHANGELOG.md b/.CHANGELOG.md index 018e55d..bd62033 100644 --- a/.CHANGELOG.md +++ b/.CHANGELOG.md @@ -29,12 +29,14 @@ - [eorm: 补充 NULL 语义和基本类型之间转化的测试用例](https://github.com/ecodeclub/eorm/pull/198) - [eorm: 分库分表: ShardingSelector GetMulti 使用 merge](https://github.com/ecodeclub/eorm/pull/199) - [eorm: 分库分表:Inserter 支持分库分表](https://github.com/ecodeclub/eorm/pull/200) -- [eorm: ShardingInserter 修改为表维度执行](https://github.com/ecodeclub/eorm/pull/211) - [eorm: 分库分表:ShardingUpdater 实现](https://github.com/ecodeclub/eorm/pull/201) - [eorm: 分库分表:datasource-简单的分布式事务方案支持](https://github.com/ecodeclub/eorm/pull/204) +- [eorm: ShardingInserter 修改为表维度执行](https://github.com/ecodeclub/eorm/pull/211) - [merger: 使用 sqlx.Scanner 来读取数据](https://github.com/ecodeclub/eorm/pull/216) - [rows, merger: 使用 sqlx.Rows 作为接口,并重构 merger 包 ](https://github.com/ecodeclub/eorm/pull/217) - [rows: 同库事务语句合并执行,提前读取所有数据](https://github.com/ecodeclub/eorm/pull/219) + + ## v0.0.1: - [Init Project](https://github.com/ecodeclub/eorm/pull/1) - [Selector Definition](https://github.com/ecodeclub/eorm/pull/2) diff --git a/internal/integration/sharding_select_test.go b/internal/integration/sharding_select_test.go index 79c5301..b4ed378 100644 --- a/internal/integration/sharding_select_test.go +++ b/internal/integration/sharding_select_test.go @@ -20,6 +20,9 @@ import ( "context" "testing" + "github.com/ecodeclub/eorm" + "github.com/ecodeclub/eorm/internal/datasource/masterslave" + "github.com/ecodeclub/eorm" "github.com/ecodeclub/eorm/internal/datasource/masterslave" "github.com/ecodeclub/eorm/internal/model" diff --git a/middleware_test.go b/middleware_test.go index 25bae44..c3b8f6d 100644 --- a/middleware_test.go +++ b/middleware_test.go @@ -19,9 +19,8 @@ import ( "errors" "testing" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func Test_Middleware(t *testing.T) { diff --git a/sharding_select.go b/sharding_select.go index 2ec5d66..13a9de7 100644 --- a/sharding_select.go +++ b/sharding_select.go @@ -301,7 +301,6 @@ func (s *ShardingSelector[T]) GetMulti(ctx context.Context) ([]*T, error) { if err != nil { return nil, err } - mgr := batchmerger.NewMerger() rowsList, err := s.db.queryMulti(ctx, qs) if err != nil { diff --git a/sharding_select_test.go b/sharding_select_test.go index e61d4f2..4da5289 100644 --- a/sharding_select_test.go +++ b/sharding_select_test.go @@ -20,10 +20,11 @@ import ( "fmt" "testing" + "github.com/ecodeclub/eorm/internal/datasource/masterslave/slaves" + "github.com/ecodeclub/eorm/internal/datasource/masterslave/slaves/roundrobin" "github.com/ecodeclub/eorm/internal/datasource/masterslave" - "github.com/ecodeclub/eorm/internal/datasource/masterslave/slaves" "github.com/ecodeclub/eorm/internal/datasource/shardingsource" @@ -6099,6 +6100,7 @@ func TestShardingSelector_Get(t *testing.T) { } func TestShardingSelector_GetMulti(t *testing.T) { + t.Parallel() r := model.NewMetaRegistry() _, err := r.Register(&test.OrderDetail{}, model.WithTableShardingAlgorithm(&hash.Hash{ @@ -6129,10 +6131,10 @@ func TestShardingSelector_GetMulti(t *testing.T) { } defer func() { _ = mockDB2.Close() }() - rbSlaves2, err := roundrobin.NewSlaves(mockDB2) + rbslaves, err := roundrobin.NewSlaves(mockDB2) require.NoError(t, err) masterSlaveDB2 := masterslave.NewMasterSlavesDB( - mockDB2, masterslave.MasterSlavesWithSlaves(newMockSlaveNameGet(rbSlaves2))) + mockDB2, masterslave.MasterSlavesWithSlaves(newMockSlaveNameGet(rbslaves))) require.NoError(t, err) clusterDB := cluster.NewClusterDB(map[string]*masterslave.MasterSlavesDB{