client.go 482 B

12345678910111213141516171819202122
  1. package api
  2. import (
  3. "context"
  4. "google.golang.org/grpc"
  5. "go-common/library/net/rpc/warden"
  6. )
  7. // AppID AppID
  8. const AppID = "account.service.relation"
  9. // NewClient new member grpc client
  10. func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (RelationClient, error) {
  11. client := warden.NewClient(cfg, opts...)
  12. conn, err := client.Dial(context.Background(), "discovery://default/"+AppID)
  13. if err != nil {
  14. return nil, err
  15. }
  16. return NewRelationClient(conn), nil
  17. }