A generic grpc client based on grpcurl.
- Start a GRPC server and enable reflection like below:
import "google.golang.org/grpc/reflection"
func main(){
server := grpc.NewServer()
reflection.Register(server)
// start server listening
}
import "github.com/gogoods/grpcli"
func main(){
cli := grpcli.NewClient()
reply, cost, err := cli.Invoke(context.Background(),
"10.40.212.34:40004",
"Account",
"DescUserInfo",
`{"UserID":1532}`,
)
}
or see: client_test.go