30 lines
562 B
Smarty
30 lines
562 B
Smarty
|
package test
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"net/http"
|
||
|
"{{.ProjectName}}/gen/go/service"
|
||
|
"{{.ProjectName}}/server/config"
|
||
|
"fusen-basic/env"
|
||
|
)
|
||
|
|
||
|
{{range .HttpGrpcTestStructs}}
|
||
|
|
||
|
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}}
|