Guard.liverpc.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
  2. // source: v1/Guard.proto
  3. /*
  4. Package v1 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. v1/Guard.proto
  8. v1/Note.proto
  9. v1/RoomAdmin.proto
  10. v1/UserSetting.proto
  11. */
  12. package v1
  13. import context "context"
  14. import proto "github.com/golang/protobuf/proto"
  15. import "go-common/library/net/rpc/liverpc"
  16. var _ proto.Message // generate to suppress unused imports
  17. // Imports only used by utility functions:
  18. // ===============
  19. // Guard Interface
  20. // ===============
  21. type Guard interface {
  22. // * 根据uid获取大航海信息
  23. //
  24. GetByUidTargetId(context.Context, *GuardGetByUidTargetIdReq) (*GuardGetByUidTargetIdResp, error)
  25. // * 根据uid获取大航海信息
  26. //
  27. GetByUid(context.Context, *GuardGetByUidReq) (*GuardGetByUidResp, error)
  28. }
  29. // =====================
  30. // Guard Live Rpc Client
  31. // =====================
  32. type guardRpcClient struct {
  33. client *liverpc.Client
  34. }
  35. // NewGuardRpcClient creates a Rpc client that implements the Guard interface.
  36. // It communicates using Rpc and can be configured with a custom HTTPClient.
  37. func NewGuardRpcClient(client *liverpc.Client) Guard {
  38. return &guardRpcClient{
  39. client: client,
  40. }
  41. }
  42. func (c *guardRpcClient) GetByUidTargetId(ctx context.Context, in *GuardGetByUidTargetIdReq) (*GuardGetByUidTargetIdResp, error) {
  43. out := new(GuardGetByUidTargetIdResp)
  44. err := doRpcRequest(ctx, c.client, 1, "Guard.getByUidTargetId", in, out)
  45. if err != nil {
  46. return nil, err
  47. }
  48. return out, nil
  49. }
  50. func (c *guardRpcClient) GetByUid(ctx context.Context, in *GuardGetByUidReq) (*GuardGetByUidResp, error) {
  51. out := new(GuardGetByUidResp)
  52. err := doRpcRequest(ctx, c.client, 1, "Guard.getByUid", in, out)
  53. if err != nil {
  54. return nil, err
  55. }
  56. return out, nil
  57. }
  58. // =====
  59. // Utils
  60. // =====
  61. func doRpcRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message) (err error) {
  62. err = client.Call(ctx, version, method, in, out)
  63. return
  64. }