rank.go 898 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package rank
  2. import (
  3. "context"
  4. "go-common/app/service/main/rank/model"
  5. "go-common/library/net/rpc"
  6. )
  7. const (
  8. _mget = "RPC.Mget"
  9. _sort = "RPC.Sort"
  10. _group = "RPC.Group"
  11. )
  12. const (
  13. _appid = "main.search.rank-service"
  14. )
  15. // Service .
  16. type Service struct {
  17. client *rpc.Client2
  18. }
  19. // New .
  20. func New(c *rpc.ClientConfig) (s *Service) {
  21. s = &Service{}
  22. s.client = rpc.NewDiscoveryCli(_appid, c)
  23. return
  24. }
  25. // Mget .
  26. func (s *Service) Mget(c context.Context, arg *model.MgetReq) (res *model.MgetResp, err error) {
  27. err = s.client.Call(c, _mget, arg, &res)
  28. return
  29. }
  30. // Sort .
  31. func (s *Service) Sort(c context.Context, arg *model.SortReq) (res *model.SortResp, err error) {
  32. err = s.client.Call(c, _sort, arg, &res)
  33. return
  34. }
  35. // Group .
  36. func (s *Service) Group(c context.Context, arg *model.GroupReq) (res *model.GroupResp, err error) {
  37. err = s.client.Call(c, _group, arg, &res)
  38. return
  39. }