client.go 747 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package client
  2. import (
  3. "context"
  4. "go-common/app/service/main/seq-server/model"
  5. "go-common/library/net/rpc"
  6. )
  7. const (
  8. _ID = "RPC.ID"
  9. _IDInt32 = "RPC.ID32"
  10. )
  11. const (
  12. _appid = "seq.server"
  13. )
  14. // Service2 is seq rpc client.
  15. type Service2 struct {
  16. client *rpc.Client2
  17. }
  18. // New2 new a seq rpc client.
  19. func New2(c *rpc.ClientConfig) (s *Service2) {
  20. s = &Service2{}
  21. s.client = rpc.NewDiscoveryCli(_appid, c)
  22. return
  23. }
  24. // ID get id.
  25. func (s *Service2) ID(c context.Context, arg *model.ArgBusiness) (id int64, err error) {
  26. err = s.client.Call(c, _ID, arg, &id)
  27. return
  28. }
  29. // ID32 get id32.
  30. func (s *Service2) ID32(c context.Context, arg *model.ArgBusiness) (id int32, err error) {
  31. err = s.client.Call(c, _IDInt32, arg, &id)
  32. return
  33. }