Smalltv.liverpc.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
  2. // source: v0/Smalltv.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/Smalltv.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. // Smalltv Interface
  17. // =================
  18. type Smalltv interface {
  19. // * 开启抽奖的内部接口
  20. // 返回的是广播的内容列表
  21. Start(context.Context, *SmalltvStartReq) (*SmalltvStartResp, error)
  22. }
  23. // =======================
  24. // Smalltv Live Rpc Client
  25. // =======================
  26. type smalltvRpcClient struct {
  27. client *liverpc.Client
  28. }
  29. // NewSmalltvRpcClient creates a Rpc client that implements the Smalltv interface.
  30. // It communicates using Rpc and can be configured with a custom HTTPClient.
  31. func NewSmalltvRpcClient(client *liverpc.Client) Smalltv {
  32. return &smalltvRpcClient{
  33. client: client,
  34. }
  35. }
  36. func (c *smalltvRpcClient) Start(ctx context.Context, in *SmalltvStartReq) (*SmalltvStartResp, error) {
  37. out := new(SmalltvStartResp)
  38. err := doRpcRequest(ctx, c.client, 0, "Smalltv.start", in, out)
  39. if err != nil {
  40. return nil, err
  41. }
  42. return out, nil
  43. }
  44. // =====
  45. // Utils
  46. // =====
  47. func doRpcRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message) (err error) {
  48. err = client.Call(ctx, version, method, in, out)
  49. return
  50. }