proto/goutils/proto_build/tpls/http_grpc_method_test.tpl
huangsimin@fusen.cn c5df2b6478 修改为纯grpc
2023-12-06 17:13:51 +08:00

29 lines
546 B
Smarty

package test
import (
"context"
"{{.ProjectName}}/gen/go/service"
"{{.ProjectName}}/server/config"
"fusen-basic/env"
)
{{range .GrpcTestStructs}}
var {{.RequestVar}} *service.{{.RequestStruct}}
func {{.MethodName}}RPC() (any, error) {
if fusen == nil {
fusen := env.NewFusenTest[config.Config]()
fusen.StartNacos(nil)
service.AutoGrpcInit(fusen)
}
resp, err := service.Auto{{.ServiceName}}Client(context.TODO()).{{.MethodName}}(context.TODO(), {{.RequestVar}})
if err != nil {
return nil, err
}
return resp, nil
}
{{end}}