2019-04-22 02:59:20 +00:00

26 lines
552 B
Go

package api
import (
"context"
"fmt"
"go-common/library/net/rpc/warden"
"google.golang.org/grpc"
)
// AppID .
const AppID = "community.service.thumbup"
// NewClient new grpc client
func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (ThumbupClient, error) {
client := warden.NewClient(cfg, opts...)
cc, err := client.Dial(context.Background(), fmt.Sprintf("discovery://default/%s", AppID))
if err != nil {
return nil, err
}
return NewThumbupClient(cc), nil
}
//go:generate $GOPATH/src/go-common/app/tool/warden/protoc.sh