Repository: zeromicro/go-zero
Pull request #3768 (2023-12-09 01:14:05)

feat: add dbtest to facility db test


Patch:
diff --git a/tools/goctl/model/sql/README.MD b/tools/goctl/model/sql/README.MD
index db92d715..4bfe9598 100644
--- a/tools/goctl/model/sql/README.MD
+++ b/tools/goctl/model/sql/README.MD
@@ -379,3 +379,4 @@ OPTIONS:
 | enum           | string          | sql.NullString                         |
 | set            | string          | sql.NullString                         |
 | json           | string          | sql.NullString                         |
+


Test patch:
diff --git a/internal/dbtest/sql.go b/core/stores/dbtest/sql.go
similarity index 100%
rename from internal/dbtest/sql.go
rename to core/stores/dbtest/sql.go
diff --git a/core/stores/sqlc/cachedsql_test.go b/core/stores/sqlc/cachedsql_test.go
index c71ddcb5..84b04402 100644
--- a/core/stores/sqlc/cachedsql_test.go
+++ b/core/stores/sqlc/cachedsql_test.go
@@ -22,11 +22,11 @@ import (
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/stat"
 	"github.com/zeromicro/go-zero/core/stores/cache"
+	"github.com/zeromicro/go-zero/core/stores/dbtest"
 	"github.com/zeromicro/go-zero/core/stores/redis"
 	"github.com/zeromicro/go-zero/core/stores/redis/redistest"
 	"github.com/zeromicro/go-zero/core/stores/sqlx"
 	"github.com/zeromicro/go-zero/core/syncx"
-	"github.com/zeromicro/go-zero/internal/dbtest"
 )
 
 func init() {
diff --git a/core/stores/sqlx/bulkinserter_test.go b/core/stores/sqlx/bulkinserter_test.go
index 6ffa349e..73d3508e 100644
--- a/core/stores/sqlx/bulkinserter_test.go
+++ b/core/stores/sqlx/bulkinserter_test.go
@@ -12,7 +12,7 @@ import (
 
 	"github.com/DATA-DOG/go-sqlmock"
 	"github.com/stretchr/testify/assert"
-	"github.com/zeromicro/go-zero/internal/dbtest"
+	"github.com/zeromicro/go-zero/core/stores/dbtest"
 )
 
 type mockedConn struct {
diff --git a/core/stores/sqlx/orm_test.go b/core/stores/sqlx/orm_test.go
index 7aa82d13..264a5ff1 100644
--- a/core/stores/sqlx/orm_test.go
+++ b/core/stores/sqlx/orm_test.go
@@ -8,7 +8,7 @@ import (
 
 	"github.com/DATA-DOG/go-sqlmock"
 	"github.com/stretchr/testify/assert"
-	"github.com/zeromicro/go-zero/internal/dbtest"
+	"github.com/zeromicro/go-zero/core/stores/dbtest"
 )
 
 func TestUnmarshalRowBool(t *testing.T) {
diff --git a/core/stores/sqlx/sqlconn_test.go b/core/stores/sqlx/sqlconn_test.go
index c05af3cf..339d30cc 100644
--- a/core/stores/sqlx/sqlconn_test.go
+++ b/core/stores/sqlx/sqlconn_test.go
@@ -10,8 +10,8 @@ import (
 	"github.com/stretchr/testify/assert"
 	"github.com/zeromicro/go-zero/core/breaker"
 	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/core/stores/dbtest"
 	"github.com/zeromicro/go-zero/core/trace/tracetest"
-	"github.com/zeromicro/go-zero/internal/dbtest"
 )
 
 const mockedDatasource = "sqlmock"
diff --git a/core/stores/sqlx/tx_test.go b/core/stores/sqlx/tx_test.go
index 685f4494..a7c87f1a 100644
--- a/core/stores/sqlx/tx_test.go
+++ b/core/stores/sqlx/tx_test.go
@@ -9,7 +9,7 @@ import (
 	"github.com/DATA-DOG/go-sqlmock"
 	"github.com/stretchr/testify/assert"
 	"github.com/zeromicro/go-zero/core/breaker"
-	"github.com/zeromicro/go-zero/internal/dbtest"
+	"github.com/zeromicro/go-zero/core/stores/dbtest"
 )
 
 const (