client.go 445 B

1234567891011121314151617181920
  1. package api
  2. import (
  3. "context"
  4. "fmt"
  5. "go-common/library/net/rpc/warden"
  6. "google.golang.org/grpc"
  7. )
  8. // AppID .
  9. const AppID = "community.service.favorite"
  10. // New fav service client
  11. func New(c *warden.ClientConfig, opts ...grpc.DialOption) (FavoriteClient, error) {
  12. client := warden.NewClient(c, opts...)
  13. conn, err := client.Dial(context.Background(), fmt.Sprintf("discovery://default/%s", AppID))
  14. return NewFavoriteClient(conn), err
  15. }