zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.

Home Page:https://go-zero.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There is no 'builderx' in this version, maybe it should be 'builder'?

aac3476 opened this issue · comments

Describe the bug
use goctl model command to gen model from sql file

To Reproduce

  1. 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;  
  1. 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:"
)
...
  1. 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.

Screenshots
image
image

Environments (please complete the following information):

  • OS: macOS
  • go-zero version v1.2.3
  • goctl version 1.2.3 darwin/amd64

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

fixed, closing.