2.0订单rpc数据结构
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
5.9 KiB

2 years ago
2 years ago
2 years ago
  1. // Code generated by protoc-gen-go.
  2. // source: order.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package orderrpcv2 is a generated protocol buffer package.
  6. It is generated from these files:
  7. order.proto
  8. It has these top-level messages:
  9. Request
  10. Response
  11. */
  12. package orderrpcv2
  13. import proto "github.com/chai2010/protorpc/proto"
  14. import math "math"
  15. import "io"
  16. import "log"
  17. import "net"
  18. import "net/rpc"
  19. import "time"
  20. import protorpc "github.com/chai2010/protorpc"
  21. // Reference imports to suppress errors if they are not otherwise used.
  22. var _ = proto.Marshal
  23. var _ = math.Inf
  24. // 请求结构
  25. type Request struct {
  26. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  27. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  28. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  29. XXX_unrecognized []byte `json:"-"`
  30. }
  31. func (m *Request) Reset() { *m = Request{} }
  32. func (m *Request) String() string { return proto.CompactTextString(m) }
  33. func (*Request) ProtoMessage() {}
  34. func (m *Request) GetData() string {
  35. if m != nil && m.Data != nil {
  36. return *m.Data
  37. }
  38. return ""
  39. }
  40. func (m *Request) GetTime() string {
  41. if m != nil && m.Time != nil {
  42. return *m.Time
  43. }
  44. return ""
  45. }
  46. func (m *Request) GetSign() string {
  47. if m != nil && m.Sign != nil {
  48. return *m.Sign
  49. }
  50. return ""
  51. }
  52. // 响应结构
  53. type Response struct {
  54. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  55. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  56. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  57. XXX_unrecognized []byte `json:"-"`
  58. }
  59. func (m *Response) Reset() { *m = Response{} }
  60. func (m *Response) String() string { return proto.CompactTextString(m) }
  61. func (*Response) ProtoMessage() {}
  62. func (m *Response) GetData() string {
  63. if m != nil && m.Data != nil {
  64. return *m.Data
  65. }
  66. return ""
  67. }
  68. func (m *Response) GetTime() string {
  69. if m != nil && m.Time != nil {
  70. return *m.Time
  71. }
  72. return ""
  73. }
  74. func (m *Response) GetSign() string {
  75. if m != nil && m.Sign != nil {
  76. return *m.Sign
  77. }
  78. return ""
  79. }
  80. func init() {
  81. }
  82. type OrderService interface {
  83. Create(in *Request, out *Response) error
  84. CreateByCart(in *Request, out *Response) error
  85. Cancel(in *Request, out *Response) error
  86. AutoReceive(in *Request, out *Response) error
  87. Get(in *Request, out *Response) error
  88. GetUserBuyTotal(in *Request, out *Response) error
  89. GetUserBuyNum(in *Request, out *Response) error
  90. }
  91. // AcceptOrderServiceClient accepts connections on the listener and serves requests
  92. // for each incoming connection. Accept blocks; the caller typically
  93. // invokes it in a go statement.
  94. func AcceptOrderServiceClient(lis net.Listener, x OrderService) {
  95. srv := rpc.NewServer()
  96. if err := srv.RegisterName("OrderService", x); err != nil {
  97. log.Fatal(err)
  98. }
  99. for {
  100. conn, err := lis.Accept()
  101. if err != nil {
  102. log.Fatalf("lis.Accept(): %v\n", err)
  103. }
  104. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  105. }
  106. }
  107. // RegisterOrderService publish the given OrderService implementation on the server.
  108. func RegisterOrderService(srv *rpc.Server, x OrderService) error {
  109. if err := srv.RegisterName("OrderService", x); err != nil {
  110. return err
  111. }
  112. return nil
  113. }
  114. // NewOrderServiceServer returns a new OrderService Server.
  115. func NewOrderServiceServer(x OrderService) *rpc.Server {
  116. srv := rpc.NewServer()
  117. if err := srv.RegisterName("OrderService", x); err != nil {
  118. log.Fatal(err)
  119. }
  120. return srv
  121. }
  122. // ListenAndServeOrderService listen announces on the local network address laddr
  123. // and serves the given OrderService implementation.
  124. func ListenAndServeOrderService(network, addr string, x OrderService) error {
  125. lis, err := net.Listen(network, addr)
  126. if err != nil {
  127. return err
  128. }
  129. defer lis.Close()
  130. srv := rpc.NewServer()
  131. if err := srv.RegisterName("OrderService", x); err != nil {
  132. return err
  133. }
  134. for {
  135. conn, err := lis.Accept()
  136. if err != nil {
  137. log.Fatalf("lis.Accept(): %v\n", err)
  138. }
  139. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  140. }
  141. }
  142. type OrderServiceClient struct {
  143. *rpc.Client
  144. }
  145. // NewOrderServiceClient returns a OrderService rpc.Client and stub to handle
  146. // requests to the set of OrderService at the other end of the connection.
  147. func NewOrderServiceClient(conn io.ReadWriteCloser) (*OrderServiceClient, *rpc.Client) {
  148. c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
  149. return &OrderServiceClient{c}, c
  150. }
  151. func (c *OrderServiceClient) Create(in *Request, out *Response) error {
  152. return c.Call("OrderService.Create", in, out)
  153. }
  154. func (c *OrderServiceClient) CreateByCart(in *Request, out *Response) error {
  155. return c.Call("OrderService.CreateByCart", in, out)
  156. }
  157. func (c *OrderServiceClient) Cancel(in *Request, out *Response) error {
  158. return c.Call("OrderService.Cancel", in, out)
  159. }
  160. func (c *OrderServiceClient) AutoReceive(in *Request, out *Response) error {
  161. return c.Call("OrderService.AutoReceive", in, out)
  162. }
  163. func (c *OrderServiceClient) Get(in *Request, out *Response) error {
  164. return c.Call("OrderService.Get", in, out)
  165. }
  166. func (c *OrderServiceClient) GetUserBuyTotal(in *Request, out *Response) error {
  167. return c.Call("OrderService.GetUserBuyTotal", in, out)
  168. }
  169. func (c *OrderServiceClient) GetUserBuyNum(in *Request, out *Response) error {
  170. return c.Call("OrderService.GetUserBuyNum", in, out)
  171. }
  172. // DialOrderService connects to an OrderService at the specified network address.
  173. func DialOrderService(network, addr string) (*OrderServiceClient, *rpc.Client, error) {
  174. c, err := protorpc.Dial(network, addr)
  175. if err != nil {
  176. return nil, nil, err
  177. }
  178. return &OrderServiceClient{c}, c, nil
  179. }
  180. // DialOrderServiceTimeout connects to an OrderService at the specified network address.
  181. func DialOrderServiceTimeout(network, addr string,
  182. timeout time.Duration) (*OrderServiceClient, *rpc.Client, error) {
  183. c, err := protorpc.DialTimeout(network, addr, timeout)
  184. if err != nil {
  185. return nil, nil, err
  186. }
  187. return &OrderServiceClient{c}, c, nil
  188. }