diff --git a/tools/goctl/goctl.go b/tools/goctl/goctl.go index 96ac1b29..ed7163bd 100644 --- a/tools/goctl/goctl.go +++ b/tools/goctl/goctl.go @@ -32,7 +32,7 @@ import ( ) var ( - buildVersion = "1.1.11-beta" + buildVersion = "1.1.11-beta-1" commands = []cli.Command{ { Name: "upgrade", diff --git a/tools/goctl/model/sql/converter/types.go b/tools/goctl/model/sql/converter/types.go index d9d405f7..47171d76 100644 --- a/tools/goctl/model/sql/converter/types.go +++ b/tools/goctl/model/sql/converter/types.go @@ -85,6 +85,7 @@ var commonMysqlDataTypeMap2 = map[string]string{ "enum": "string", "set": "string", "json": "string", + "jsonb": "string", "blob": "string", "longblob": "string", "mediumblob": "string", diff --git a/tools/goctl/rpc/generator/gen.go b/tools/goctl/rpc/generator/gen.go index 8725a095..e5d56e98 100644 --- a/tools/goctl/rpc/generator/gen.go +++ b/tools/goctl/rpc/generator/gen.go @@ -63,7 +63,7 @@ func (g *RPCGenerator) Generate(src, target string, protoImportPath []string, go return err } - dirCtx, err := mkdir(projectCtx, proto) + dirCtx, err := mkdir(projectCtx, proto,g.cfg) if err != nil { return err } diff --git a/tools/goctl/rpc/generator/mkdir.go b/tools/goctl/rpc/generator/mkdir.go index aa7b72e2..09ae622a 100644 --- a/tools/goctl/rpc/generator/mkdir.go +++ b/tools/goctl/rpc/generator/mkdir.go @@ -1,6 +1,8 @@ package generator import ( + conf "github.com/tal-tech/go-zero/tools/goctl/config" + "github.com/tal-tech/go-zero/tools/goctl/util/format" "path/filepath" "strings" @@ -50,7 +52,7 @@ type ( } ) -func mkdir(ctx *ctx.ProjectContext, proto parser.Proto) (DirContext, error) { +func mkdir(ctx *ctx.ProjectContext, proto parser.Proto, cfg *conf.Config) (DirContext, error) { inner := make(map[string]Dir) etcDir := filepath.Join(ctx.WorkDir, "etc") internalDir := filepath.Join(ctx.WorkDir, "internal") @@ -59,9 +61,19 @@ func mkdir(ctx *ctx.ProjectContext, proto parser.Proto) (DirContext, error) { serverDir := filepath.Join(internalDir, "server") svcDir := filepath.Join(internalDir, "svc") pbDir := filepath.Join(ctx.WorkDir, proto.GoPackage) - callDir := filepath.Join(ctx.WorkDir, strings.ToLower(stringx.From(proto.Service.Name).ToCamel())) + sName,err:=format.FileNamingFormat(cfg.NamingFormat,proto.Service.Name) + if err != nil { + return nil, err + } + + callDir := filepath.Join(ctx.WorkDir, sName) if strings.EqualFold(proto.Service.Name, proto.GoPackage) { - callDir = filepath.Join(ctx.WorkDir, strings.ToLower(stringx.From(proto.Service.Name+"_client").ToCamel())) + clientDir, err := format.FileNamingFormat(cfg.NamingFormat, proto.Service.Name+"_client") + if err != nil { + return nil, err + } + + callDir = filepath.Join(ctx.WorkDir, clientDir) } inner[wd] = Dir{