Feature rpc protoc (#1251)
* code generation by protoc * generate pb by protoc direct * support: grpc code generation by protoc directly * format code * check --go_out & --go-grpc_out * fix typo * Update version * fix typo * optimize: remove deprecated unit test * format code Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
type {{.server}}Server struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
{{.unimplementedServer}}
|
||||
}
|
||||
|
||||
func New{{.server}}Server(svcCtx *svc.ServiceContext) *{{.server}}Server {
|
||||
@@ -83,11 +84,12 @@ func (g *DefaultGenerator) GenServer(ctx DirContext, proto parser.Proto, cfg *co
|
||||
}
|
||||
|
||||
err = util.With("server").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
"head": head,
|
||||
"server": stringx.From(service.Name).ToCamel(),
|
||||
"imports": strings.Join(imports.KeysStr(), pathx.NL),
|
||||
"funcs": strings.Join(funcList, pathx.NL),
|
||||
"notStream": notStream,
|
||||
"head": head,
|
||||
"unimplementedServer": fmt.Sprintf("%s.Unimplemented%sServer", proto.PbPackage, stringx.From(service.Name).ToCamel()),
|
||||
"server": stringx.From(service.Name).ToCamel(),
|
||||
"imports": strings.Join(imports.KeysStr(), pathx.NL),
|
||||
"funcs": strings.Join(funcList, pathx.NL),
|
||||
"notStream": notStream,
|
||||
}, serverFile, true)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user