Skip to content

Commit

Permalink
Merge branch 'main' into dev-new
Browse files Browse the repository at this point in the history
  • Loading branch information
Stone-afk authored Sep 7, 2023
2 parents 07dc416 + ae91a74 commit 043bd0d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions internal/integration/sharding_select_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion sharding_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Check failure on line 310 in sharding_select.go

View workflow job for this annotation

GitHub Actions / build

undefined: sdQs

Check failure on line 310 in sharding_select.go

View workflow job for this annotation

GitHub Actions / build

undefined: sdQs
q := query
//fmt.Println(q.String())
eg.Go(func() error {
//s.lock.Lock()
//defer s.lock.Unlock()
Expand Down
8 changes: 5 additions & 3 deletions sharding_select_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 043bd0d

Please sign in to comment.