Fix the error stream method name (#826)

master
neosu 3 years ago committed by GitHub
parent e47079f0f4
commit e481b63b21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -115,14 +115,7 @@ func (g *DefaultGenerator) genFunction(goPackage string, service parser.Service)
} }
comment := parser.GetComment(rpc.Doc()) comment := parser.GetComment(rpc.Doc())
var streamServer string streamServer := fmt.Sprintf("%s.%s_%s%s", goPackage, parser.CamelCase(service.Name), parser.CamelCase(rpc.Name), "Client")
if rpc.StreamsRequest && rpc.StreamsReturns {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(service.Name)+"_StreamClient")
} else if rpc.StreamsRequest {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(service.Name)+"_ClientStreamClient")
} else {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(service.Name)+"_ServerStreamClient")
}
buffer, err := util.With("sharedFn").Parse(text).Execute(map[string]interface{}{ buffer, err := util.With("sharedFn").Parse(text).Execute(map[string]interface{}{
"serviceName": stringx.From(service.Name).ToCamel(), "serviceName": stringx.From(service.Name).ToCamel(),
"rpcServiceName": parser.CamelCase(service.Name), "rpcServiceName": parser.CamelCase(service.Name),
@ -155,15 +148,7 @@ func (g *DefaultGenerator) getInterfaceFuncs(goPackage string, service parser.Se
} }
comment := parser.GetComment(rpc.Doc()) comment := parser.GetComment(rpc.Doc())
var streamServer string streamServer := fmt.Sprintf("%s.%s_%s%s", goPackage, parser.CamelCase(service.Name), parser.CamelCase(rpc.Name), "Client")
if rpc.StreamsRequest && rpc.StreamsReturns {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(service.Name)+"_StreamClient")
} else if rpc.StreamsRequest {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(service.Name)+"_ClientStreamClient")
} else {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(service.Name)+"_ServerStreamClient")
}
buffer, err := util.With("interfaceFn").Parse(text).Execute( buffer, err := util.With("interfaceFn").Parse(text).Execute(
map[string]interface{}{ map[string]interface{}{
"hasComment": len(comment) > 0, "hasComment": len(comment) > 0,

@ -92,14 +92,7 @@ func (g *DefaultGenerator) genLogicFunction(serviceName, goPackage string, rpc *
logicName := stringx.From(rpc.Name + "_logic").ToCamel() logicName := stringx.From(rpc.Name + "_logic").ToCamel()
comment := parser.GetComment(rpc.Doc()) comment := parser.GetComment(rpc.Doc())
var streamServer string streamServer := fmt.Sprintf("%s.%s_%s%s", goPackage, parser.CamelCase(serviceName), parser.CamelCase(rpc.Name), "Server")
if rpc.StreamsRequest && rpc.StreamsReturns {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(serviceName)+"_StreamServer")
} else if rpc.StreamsRequest {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(serviceName)+"_ClientStreamServer")
} else {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(serviceName)+"_ServerStreamServer")
}
buffer, err := util.With("fun").Parse(text).Execute(map[string]interface{}{ buffer, err := util.With("fun").Parse(text).Execute(map[string]interface{}{
"logicName": logicName, "logicName": logicName,
"method": parser.CamelCase(rpc.Name), "method": parser.CamelCase(rpc.Name),

@ -91,15 +91,7 @@ func (g *DefaultGenerator) genFunctions(goPackage string, service parser.Service
} }
comment := parser.GetComment(rpc.Doc()) comment := parser.GetComment(rpc.Doc())
var streamServer string streamServer := fmt.Sprintf("%s.%s_%s%s", goPackage, parser.CamelCase(service.Name), parser.CamelCase(rpc.Name), "Server")
if rpc.StreamsRequest && rpc.StreamsReturns {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(service.Name)+"_StreamServer")
} else if rpc.StreamsRequest {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(service.Name)+"_ClientStreamServer")
} else {
streamServer = fmt.Sprintf("%s.%s", goPackage, parser.CamelCase(service.Name)+"_ServerStreamServer")
}
buffer, err := util.With("func").Parse(text).Execute(map[string]interface{}{ buffer, err := util.With("func").Parse(text).Execute(map[string]interface{}{
"server": stringx.From(service.Name).ToCamel(), "server": stringx.From(service.Name).ToCamel(),
"logicName": fmt.Sprintf("%sLogic", stringx.From(rpc.Name).ToCamel()), "logicName": fmt.Sprintf("%sLogic", stringx.From(rpc.Name).ToCamel()),

Loading…
Cancel
Save