Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 642 Bytes

README.md

File metadata and controls

35 lines (26 loc) · 642 Bytes

grpcli

A generic grpc client based on grpcurl.

Prerequisites:

  1. 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    
}

Usage:

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