This commit is contained in:
kesonan
2024-04-01 23:22:29 +08:00
committed by GitHub
parent 8c0bb27136
commit 2d3ebb9b62
3 changed files with 12 additions and 9 deletions

View File

@@ -11,15 +11,17 @@ import (
"github.com/zeromicro/go-zero/tools/goctl/util"
"github.com/zeromicro/go-zero/tools/goctl/util/format"
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
"github.com/zeromicro/go-zero/tools/goctl/util/stringx"
)
//go:embed main.tpl
var mainTemplate string
type MainServiceTemplateData struct {
Service string
ServerPkg string
Pkg string
GRPCService string
Service string
ServerPkg string
Pkg string
}
// GenMain generates the main file of the rpc service, which is an rpc service program call entry
@@ -57,9 +59,10 @@ func (g *Generator) GenMain(ctx DirContext, proto parser.Proto, cfg *conf.Config
}
imports = append(imports, remoteImport)
serviceNames = append(serviceNames, MainServiceTemplateData{
Service: parser.CamelCase(e.Name),
ServerPkg: serverPkg,
Pkg: proto.PbPackage,
GRPCService: parser.CamelCase(e.Name),
Service: stringx.From(e.Name).ToCamel(),
ServerPkg: serverPkg,
Pkg: proto.PbPackage,
})
}