Przeglądaj źródła

cleanup: deprecated field and func (#2416)

* cleanup: deprecated field and func

* fmt import order
jesse.tang 2 lat temu
rodzic
commit
1b344a8851

+ 3 - 3
tools/goctl/model/sql/README.MD

@@ -35,16 +35,16 @@ goctl model 为go-zero下的工具模块中的组件之一,目前支持识别m
     	"fmt"
     	"strings"
     	"time"
-    
+        
+        "github.com/zeromicro/go-zero/core/stores/builder"
     	"github.com/zeromicro/go-zero/core/stores/cache"
     	"github.com/zeromicro/go-zero/core/stores/sqlc"
     	"github.com/zeromicro/go-zero/core/stores/sqlx"
     	"github.com/zeromicro/go-zero/core/stringx"
-    	"github.com/zeromicro/go-zero/tools/goctl/model/sql/builderx"
     )
     
     var (
-    	userFieldNames          = builderx.FieldNames(&User{})
+    	userFieldNames          = builder.FieldNames(&User{})
     	userRows                = strings.Join(userFieldNames, ",")
     	userRowsExpectAutoSet   = strings.Join(stringx.Remove(userFieldNames, "id", "create_time", "update_time"), ",")
     	userRowsWithPlaceHolder = strings.Join(stringx.Remove(userFieldNames, "id", "create_time", "update_time"), "=?,") + "=?"

+ 3 - 3
tools/goctl/model/sql/gen/gen_test.go

@@ -13,11 +13,11 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
+
 	"github.com/zeromicro/go-zero/core/logx"
+	"github.com/zeromicro/go-zero/core/stores/builder"
 	"github.com/zeromicro/go-zero/core/stringx"
-
 	"github.com/zeromicro/go-zero/tools/goctl/config"
-	"github.com/zeromicro/go-zero/tools/goctl/model/sql/builderx"
 	"github.com/zeromicro/go-zero/tools/goctl/model/sql/parser"
 	"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
 )
@@ -158,7 +158,7 @@ func TestFields(t *testing.T) {
 		UpdateTime sql.NullTime    `db:"update_time"`
 	}
 	var (
-		studentFieldNames          = builderx.RawFieldNames(&Student{})
+		studentFieldNames          = builder.RawFieldNames(&Student{})
 		studentRows                = strings.Join(studentFieldNames, ",")
 		studentRowsExpectAutoSet   = strings.Join(stringx.Remove(studentFieldNames, "`id`", "`create_time`", "`update_time`"), ",")
 		studentRowsWithPlaceHolder = strings.Join(stringx.Remove(studentFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?"

+ 2 - 2
tools/goctl/model/sql/test/model/studentmodel.go

@@ -6,15 +6,15 @@ import (
 	"strings"
 	"time"
 
+	"github.com/zeromicro/go-zero/core/stores/builder"
 	"github.com/zeromicro/go-zero/core/stores/cache"
 	"github.com/zeromicro/go-zero/core/stores/sqlc"
 	"github.com/zeromicro/go-zero/core/stores/sqlx"
 	"github.com/zeromicro/go-zero/core/stringx"
-	"github.com/zeromicro/go-zero/tools/goctl/model/sql/builderx"
 )
 
 var (
-	studentFieldNames          = builderx.RawFieldNames(&Student{})
+	studentFieldNames          = builder.RawFieldNames(&Student{})
 	studentRows                = strings.Join(studentFieldNames, ",")
 	studentRowsExpectAutoSet   = strings.Join(stringx.Remove(studentFieldNames, "`id`", "`create_time`", "`update_time`"), ",")
 	studentRowsWithPlaceHolder = strings.Join(stringx.Remove(studentFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?"

+ 2 - 2
tools/goctl/model/sql/test/model/usermodel.go

@@ -6,14 +6,14 @@ import (
 	"strings"
 	"time"
 
+	"github.com/zeromicro/go-zero/core/stores/builder"
 	"github.com/zeromicro/go-zero/core/stores/sqlc"
 	"github.com/zeromicro/go-zero/core/stores/sqlx"
 	"github.com/zeromicro/go-zero/core/stringx"
-	"github.com/zeromicro/go-zero/tools/goctl/model/sql/builderx"
 )
 
 var (
-	userFieldNames          = builderx.RawFieldNames(&User{})
+	userFieldNames          = builder.RawFieldNames(&User{})
 	userRows                = strings.Join(userFieldNames, ",")
 	userRowsExpectAutoSet   = strings.Join(stringx.Remove(userFieldNames, "`id`", "`create_time`", "`update_time`"), ",")
 	userRowsWithPlaceHolder = strings.Join(stringx.Remove(userFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?"