client.go 814 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package client
  2. import (
  3. "context"
  4. "go-common/library/net/rpc"
  5. )
  6. var (
  7. _noRes = &struct{}{}
  8. )
  9. const (
  10. // token
  11. _delTokenCache = "RPC.DelTokenCache"
  12. // cookie
  13. _delCookieCache = "RPC.DelCookieCache"
  14. )
  15. // Service is a question service.
  16. type Service struct {
  17. client *rpc.Client2
  18. }
  19. // New new a question service.
  20. func New(c *rpc.ClientConfig) (s *Service) {
  21. s = &Service{
  22. client: rpc.NewDiscoveryCli("passport.service.auth", c),
  23. }
  24. return
  25. }
  26. // DelTokenCache query token.
  27. func (s *Service) DelTokenCache(c context.Context, token string) (err error) {
  28. err = s.client.Call(c, _delTokenCache, token, &_noRes)
  29. return
  30. }
  31. // DelCookieCookie del cookie.
  32. func (s *Service) DelCookieCookie(c context.Context, session string) (err error) {
  33. err = s.client.Call(c, _delCookieCache, session, &_noRes)
  34. return
  35. }