update shorturl doc

This commit is contained in:
kevin
2020-08-29 00:28:57 +08:00
parent 0734bbcab3
commit 3affe62ae4
3 changed files with 90 additions and 36 deletions

View File

@@ -82,7 +82,7 @@ $ goctl rpc proto -h
```shell script
NAME:
goctl rpc proto - generate rpc from proto"
goctl rpc proto - generate rpc from proto
USAGE:
goctl rpc proto [command options] [arguments...]

View File

@@ -61,7 +61,6 @@ var errJsonConvert = errors.New("json convert error")
sharedFunctionTemplate = `
{{if .hasComment}}{{.comment}}{{end}}
func (m *default{{.rpcServiceName}}Model) {{.method}}(ctx context.Context,in *{{.pbRequest}}) {{if .hasResponse}}(*{{.pbResponse}},{{end}} error{{if .hasResponse}}){{end}} {
client := {{.package}}.New{{.rpcServiceName}}Client(m.cli.Conn())
var request {{.package}}.{{.pbRequest}}
bts, err := jsonx.Marshal(in)
if err != nil {
@@ -73,6 +72,7 @@ func (m *default{{.rpcServiceName}}Model) {{.method}}(ctx context.Context,in *{{
return {{if .hasResponse}}nil, {{end}}errJsonConvert
}
client := {{.package}}.New{{.rpcServiceName}}Client(m.cli.Conn())
{{if .hasResponse}}resp, err := {{else}}_, err = {{end}}client.{{.method}}(ctx, &request)
{{if .hasResponse}}if err != nil{
return nil, err