|
|
@ -23,7 +23,7 @@ package {{.filePackage}}
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
{{.package}}
|
|
|
|
{{.package}}
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/tal-tech/go-zero/zrpc"
|
|
|
|
"github.com/tal-tech/go-zero/zrpc"
|
|
|
@ -51,13 +51,13 @@ func New{{.serviceName}}(cli zrpc.Client) {{.serviceName}} {
|
|
|
|
`
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
|
|
callInterfaceFunctionTemplate = `{{if .hasComment}}{{.comment}}
|
|
|
|
callInterfaceFunctionTemplate = `{{if .hasComment}}{{.comment}}
|
|
|
|
{{end}}{{.method}}(ctx context.Context{{if .hasReq}},in *{{.pbRequest}}{{end}}) ({{if .notStream}}*{{.pbResponse}}, {{else}}{{.streamBody}},{{end}} error)`
|
|
|
|
{{end}}{{.method}}(ctx context.Context{{if .hasReq}}, in *{{.pbRequest}}{{end}}, opts ...grpc.CallOption) ({{if .notStream}}*{{.pbResponse}}, {{else}}{{.streamBody}},{{end}} error)`
|
|
|
|
|
|
|
|
|
|
|
|
callFunctionTemplate = `
|
|
|
|
callFunctionTemplate = `
|
|
|
|
{{if .hasComment}}{{.comment}}{{end}}
|
|
|
|
{{if .hasComment}}{{.comment}}{{end}}
|
|
|
|
func (m *default{{.serviceName}}) {{.method}}(ctx context.Context{{if .hasReq}},in *{{.pbRequest}}{{end}}) ({{if .notStream}}*{{.pbResponse}}, {{else}}{{.streamBody}},{{end}} error) {
|
|
|
|
func (m *default{{.serviceName}}) {{.method}}(ctx context.Context{{if .hasReq}}, in *{{.pbRequest}}{{end}}, opts ...grpc.CallOption) ({{if .notStream}}*{{.pbResponse}}, {{else}}{{.streamBody}},{{end}} error) {
|
|
|
|
client := {{.package}}.New{{.rpcServiceName}}Client(m.cli.Conn())
|
|
|
|
client := {{.package}}.New{{.rpcServiceName}}Client(m.cli.Conn())
|
|
|
|
return client.{{.method}}(ctx,{{if .hasReq}} in{{end}})
|
|
|
|
return client.{{.method}}(ctx{{if .hasReq}}, in{{end}}, opts...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
`
|
|
|
|
)
|
|
|
|
)
|
|
|
|