Message.liverpc.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
  2. // source: v0/Message.proto
  3. /*
  4. Package v0 is a generated liverpc stub package.
  5. This code was generated with go-common/app/tool/liverpc/protoc-gen-liverpc v0.1.
  6. It is generated from these files:
  7. v0/Message.proto
  8. */
  9. package v0
  10. import context "context"
  11. import proto "github.com/golang/protobuf/proto"
  12. import "go-common/library/net/rpc/liverpc"
  13. var _ proto.Message // generate to suppress unused imports
  14. // Imports only used by utility functions:
  15. // =================
  16. // Message Interface
  17. // =================
  18. type Message interface {
  19. // * 监控队列: topic:RoomStatusNotify-T
  20. //
  21. LiveNotify(context.Context, *MessageLiveNotifyReq) (*MessageLiveNotifyResp, error)
  22. // * 监控队列: topic:OneLiveRoomAreaChange-T
  23. //
  24. AreaNotify(context.Context, *MessageAreaNotifyReq) (*MessageAreaNotifyResp, error)
  25. }
  26. // =======================
  27. // Message Live Rpc Client
  28. // =======================
  29. type messageRpcClient struct {
  30. client *liverpc.Client
  31. }
  32. // NewMessageRpcClient creates a Rpc client that implements the Message interface.
  33. // It communicates using Rpc and can be configured with a custom HTTPClient.
  34. func NewMessageRpcClient(client *liverpc.Client) Message {
  35. return &messageRpcClient{
  36. client: client,
  37. }
  38. }
  39. func (c *messageRpcClient) LiveNotify(ctx context.Context, in *MessageLiveNotifyReq) (*MessageLiveNotifyResp, error) {
  40. out := new(MessageLiveNotifyResp)
  41. err := doRpcRequest(ctx, c.client, 0, "Message.liveNotify", in, out)
  42. if err != nil {
  43. return nil, err
  44. }
  45. return out, nil
  46. }
  47. func (c *messageRpcClient) AreaNotify(ctx context.Context, in *MessageAreaNotifyReq) (*MessageAreaNotifyResp, error) {
  48. out := new(MessageAreaNotifyResp)
  49. err := doRpcRequest(ctx, c.client, 0, "Message.areaNotify", in, out)
  50. if err != nil {
  51. return nil, err
  52. }
  53. return out, nil
  54. }
  55. // =====
  56. // Utils
  57. // =====
  58. func doRpcRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message) (err error) {
  59. err = client.Call(ctx, version, method, in, out)
  60. return
  61. }