There is no 'builderx' in this version, maybe it should be 'builder'?
aac3476 opened this issue · comments
ywxisky commented
Describe the bug
use goctl model command to gen model from sql file
To Reproduce
- The sql file is
CREATE TABLE `user` (
`id` int NOT NULL AUTO_INCREMENT,
`nickname` varchar(255) NOT NULL,
`salt` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(100) NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
KEY `mail` (`email`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT;
- The code that goctl gen is
package model
import (
"database/sql"
"fmt"
"strings"
"github.com/tal-tech/go-zero/core/stores/builderx"
"github.com/tal-tech/go-zero/core/stores/cache"
"github.com/tal-tech/go-zero/core/stores/sqlc"
"github.com/tal-tech/go-zero/core/stores/sqlx"
"github.com/tal-tech/go-zero/core/stringx"
)
var (
userFieldNames = builderx.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`"), "=?,") + "=?"
cacheUserIdPrefix = "cache:user:id:"
)
...
-
The error is
Cannot resolve symbol 'builderx'
Expected behavior
This is no 'builderx' in /core/stores
I change it to 'builder', everything seems to be ok.
Environments (please complete the following information):
- OS: macOS
- go-zero version v1.2.3
- goctl version 1.2.3 darwin/amd64
Kevin Wan commented
Thanks for reporting! It's fixed. Use the following command to update your goctl:
GOPROXY=https://goproxy.cn/,direct go install github.com/tal-tech/go-zero/tools/goctl@cli
Kevin Wan commented
fixed, closing.