client.go 488 B

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