Fix issues (#965)

master
anqiansong 3 years ago committed by GitHub
parent b71ac2042a
commit 3203f8e06b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,7 +32,7 @@ import (
)
var (
buildVersion = "1.1.11-beta"
buildVersion = "1.1.11-beta-1"
commands = []cli.Command{
{
Name: "upgrade",

@ -85,6 +85,7 @@ var commonMysqlDataTypeMap2 = map[string]string{
"enum": "string",
"set": "string",
"json": "string",
"jsonb": "string",
"blob": "string",
"longblob": "string",
"mediumblob": "string",

@ -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
}

@ -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{

Loading…
Cancel
Save