Conf.liverpc.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
  2. // source: v0/Conf.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/Conf.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. // Conf Interface
  17. // ==============
  18. type ConfRPCClient interface {
  19. // * 设置配置仓库
  20. //
  21. Set(ctx context.Context, req *ConfSetReq, opts ...liverpc.CallOption) (resp *ConfSetResp, err error)
  22. // * 查看用户配置
  23. //
  24. Get(ctx context.Context, req *ConfGetReq, opts ...liverpc.CallOption) (resp *ConfGetResp, err error)
  25. }
  26. // ====================
  27. // Conf Live Rpc Client
  28. // ====================
  29. type confRPCClient struct {
  30. client *liverpc.Client
  31. }
  32. // NewConfRPCClient creates a client that implements the ConfRPCClient interface.
  33. func NewConfRPCClient(client *liverpc.Client) ConfRPCClient {
  34. return &confRPCClient{
  35. client: client,
  36. }
  37. }
  38. func (c *confRPCClient) Set(ctx context.Context, in *ConfSetReq, opts ...liverpc.CallOption) (*ConfSetResp, error) {
  39. out := new(ConfSetResp)
  40. err := doRPCRequest(ctx, c.client, 0, "Conf.set", in, out, opts)
  41. if err != nil {
  42. return nil, err
  43. }
  44. return out, nil
  45. }
  46. func (c *confRPCClient) Get(ctx context.Context, in *ConfGetReq, opts ...liverpc.CallOption) (*ConfGetResp, error) {
  47. out := new(ConfGetResp)
  48. err := doRPCRequest(ctx, c.client, 0, "Conf.get", in, out, opts)
  49. if err != nil {
  50. return nil, err
  51. }
  52. return out, nil
  53. }
  54. // =====
  55. // Utils
  56. // =====
  57. func doRPCRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message, opts []liverpc.CallOption) (err error) {
  58. err = client.Call(ctx, version, method, in, out, opts...)
  59. return
  60. }