diff --git a/.CHANGELOG.md b/.CHANGELOG.md index b3d7ca5..4607c1f 100644 --- a/.CHANGELOG.md +++ b/.CHANGELOG.md @@ -29,12 +29,13 @@ - [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) + ## 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 e66d345..539bae6 100644 --- a/sharding_select.go +++ b/sharding_select.go @@ -307,8 +307,9 @@ func (s *ShardingSelector[T]) GetMulti(ctx context.Context) ([]*T, error) { var rowsSlice []rows.Rows var eg errgroup.Group - for _, query := range qs { + for _, query := range sdQs { q := query + //fmt.Println(q.String()) eg.Go(func() error { //s.lock.Lock() //defer s.lock.Unlock() 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{