商品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.

392 lines
11 KiB

  1. // Code generated by protoc-gen-go.
  2. // source: product.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package productrpc is a generated protocol buffer package.
  6. It is generated from these files:
  7. product.proto
  8. It has these top-level messages:
  9. GetRequest
  10. GetUuidRequest
  11. GetSkuRequest
  12. GetResponse
  13. Request
  14. Response
  15. */
  16. package productrpc
  17. import proto "github.com/chai2010/protorpc/proto"
  18. import math "math"
  19. import "io"
  20. import "log"
  21. import "net"
  22. import "net/rpc"
  23. import "time"
  24. import protorpc "github.com/chai2010/protorpc"
  25. // Reference imports to suppress errors if they are not otherwise used.
  26. var _ = proto.Marshal
  27. var _ = math.Inf
  28. // 使用key查询
  29. type GetRequest struct {
  30. SiteId *string `protobuf:"bytes,1,opt,name=site_id" json:"site_id,omitempty"`
  31. Dbname *string `protobuf:"bytes,2,opt,name=dbname" json:"dbname,omitempty"`
  32. Id *string `protobuf:"bytes,3,opt,name=id" json:"id,omitempty"`
  33. Field *string `protobuf:"bytes,4,opt,name=field" json:"field,omitempty"`
  34. XXX_unrecognized []byte `json:"-"`
  35. }
  36. func (m *GetRequest) Reset() { *m = GetRequest{} }
  37. func (m *GetRequest) String() string { return proto.CompactTextString(m) }
  38. func (*GetRequest) ProtoMessage() {}
  39. func (m *GetRequest) GetSiteId() string {
  40. if m != nil && m.SiteId != nil {
  41. return *m.SiteId
  42. }
  43. return ""
  44. }
  45. func (m *GetRequest) GetDbname() string {
  46. if m != nil && m.Dbname != nil {
  47. return *m.Dbname
  48. }
  49. return ""
  50. }
  51. func (m *GetRequest) GetId() string {
  52. if m != nil && m.Id != nil {
  53. return *m.Id
  54. }
  55. return ""
  56. }
  57. func (m *GetRequest) GetField() string {
  58. if m != nil && m.Field != nil {
  59. return *m.Field
  60. }
  61. return ""
  62. }
  63. type GetUuidRequest struct {
  64. SiteId *string `protobuf:"bytes,1,opt,name=site_id" json:"site_id,omitempty"`
  65. Dbname *string `protobuf:"bytes,2,opt,name=dbname" json:"dbname,omitempty"`
  66. Uuid *string `protobuf:"bytes,3,opt,name=uuid" json:"uuid,omitempty"`
  67. Field *string `protobuf:"bytes,4,opt,name=field" json:"field,omitempty"`
  68. XXX_unrecognized []byte `json:"-"`
  69. }
  70. func (m *GetUuidRequest) Reset() { *m = GetUuidRequest{} }
  71. func (m *GetUuidRequest) String() string { return proto.CompactTextString(m) }
  72. func (*GetUuidRequest) ProtoMessage() {}
  73. func (m *GetUuidRequest) GetSiteId() string {
  74. if m != nil && m.SiteId != nil {
  75. return *m.SiteId
  76. }
  77. return ""
  78. }
  79. func (m *GetUuidRequest) GetDbname() string {
  80. if m != nil && m.Dbname != nil {
  81. return *m.Dbname
  82. }
  83. return ""
  84. }
  85. func (m *GetUuidRequest) GetUuid() string {
  86. if m != nil && m.Uuid != nil {
  87. return *m.Uuid
  88. }
  89. return ""
  90. }
  91. func (m *GetUuidRequest) GetField() string {
  92. if m != nil && m.Field != nil {
  93. return *m.Field
  94. }
  95. return ""
  96. }
  97. type GetSkuRequest struct {
  98. SiteId *string `protobuf:"bytes,1,opt,name=site_id" json:"site_id,omitempty"`
  99. Dbname *string `protobuf:"bytes,2,opt,name=dbname" json:"dbname,omitempty"`
  100. ProductUuid *string `protobuf:"bytes,3,opt,name=product_uuid" json:"product_uuid,omitempty"`
  101. SkuId *string `protobuf:"bytes,4,opt,name=sku_id" json:"sku_id,omitempty"`
  102. Field *string `protobuf:"bytes,5,opt,name=field" json:"field,omitempty"`
  103. XXX_unrecognized []byte `json:"-"`
  104. }
  105. func (m *GetSkuRequest) Reset() { *m = GetSkuRequest{} }
  106. func (m *GetSkuRequest) String() string { return proto.CompactTextString(m) }
  107. func (*GetSkuRequest) ProtoMessage() {}
  108. func (m *GetSkuRequest) GetSiteId() string {
  109. if m != nil && m.SiteId != nil {
  110. return *m.SiteId
  111. }
  112. return ""
  113. }
  114. func (m *GetSkuRequest) GetDbname() string {
  115. if m != nil && m.Dbname != nil {
  116. return *m.Dbname
  117. }
  118. return ""
  119. }
  120. func (m *GetSkuRequest) GetProductUuid() string {
  121. if m != nil && m.ProductUuid != nil {
  122. return *m.ProductUuid
  123. }
  124. return ""
  125. }
  126. func (m *GetSkuRequest) GetSkuId() string {
  127. if m != nil && m.SkuId != nil {
  128. return *m.SkuId
  129. }
  130. return ""
  131. }
  132. func (m *GetSkuRequest) GetField() string {
  133. if m != nil && m.Field != nil {
  134. return *m.Field
  135. }
  136. return ""
  137. }
  138. // 使用key查询响应结构
  139. type GetResponse struct {
  140. Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
  141. XXX_unrecognized []byte `json:"-"`
  142. }
  143. func (m *GetResponse) Reset() { *m = GetResponse{} }
  144. func (m *GetResponse) String() string { return proto.CompactTextString(m) }
  145. func (*GetResponse) ProtoMessage() {}
  146. func (m *GetResponse) GetValue() []byte {
  147. if m != nil {
  148. return m.Value
  149. }
  150. return nil
  151. }
  152. // 配置信息请求结构
  153. type Request struct {
  154. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  155. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  156. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  157. XXX_unrecognized []byte `json:"-"`
  158. }
  159. func (m *Request) Reset() { *m = Request{} }
  160. func (m *Request) String() string { return proto.CompactTextString(m) }
  161. func (*Request) ProtoMessage() {}
  162. func (m *Request) GetData() string {
  163. if m != nil && m.Data != nil {
  164. return *m.Data
  165. }
  166. return ""
  167. }
  168. func (m *Request) GetTime() string {
  169. if m != nil && m.Time != nil {
  170. return *m.Time
  171. }
  172. return ""
  173. }
  174. func (m *Request) GetSign() string {
  175. if m != nil && m.Sign != nil {
  176. return *m.Sign
  177. }
  178. return ""
  179. }
  180. // 配置信息响应结构
  181. type Response struct {
  182. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  183. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  184. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  185. XXX_unrecognized []byte `json:"-"`
  186. }
  187. func (m *Response) Reset() { *m = Response{} }
  188. func (m *Response) String() string { return proto.CompactTextString(m) }
  189. func (*Response) ProtoMessage() {}
  190. func (m *Response) GetData() string {
  191. if m != nil && m.Data != nil {
  192. return *m.Data
  193. }
  194. return ""
  195. }
  196. func (m *Response) GetTime() string {
  197. if m != nil && m.Time != nil {
  198. return *m.Time
  199. }
  200. return ""
  201. }
  202. func (m *Response) GetSign() string {
  203. if m != nil && m.Sign != nil {
  204. return *m.Sign
  205. }
  206. return ""
  207. }
  208. func init() {
  209. }
  210. type ProductService interface {
  211. Get(in *GetRequest, out *GetResponse) error
  212. GetByUuid(in *GetUuidRequest, out *GetResponse) error
  213. GetSku(in *GetRequest, out *GetResponse) error
  214. GetSkuByUuid(in *GetUuidRequest, out *GetResponse) error
  215. GetActivity(in *Request, out *Response) error
  216. GetAllActivity(in *Request, out *Response) error
  217. GetWarmingActivity(in *Request, out *Response) error
  218. FavoriteProduct(in *Request, out *Response) error
  219. GetProductActivity(in *Request, out *Response) error
  220. GetProductAllActivity(in *Request, out *Response) error
  221. GetProductWarmingActivity(in *Request, out *Response) error
  222. GetSkuInfo(in *GetSkuRequest, out *GetResponse) error
  223. GetSkuList(in *GetSkuRequest, out *GetResponse) error
  224. }
  225. // AcceptProductServiceClient accepts connections on the listener and serves requests
  226. // for each incoming connection. Accept blocks; the caller typically
  227. // invokes it in a go statement.
  228. func AcceptProductServiceClient(lis net.Listener, x ProductService) {
  229. srv := rpc.NewServer()
  230. if err := srv.RegisterName("ProductService", x); err != nil {
  231. log.Fatal(err)
  232. }
  233. for {
  234. conn, err := lis.Accept()
  235. if err != nil {
  236. log.Fatalf("lis.Accept(): %v\n", err)
  237. }
  238. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  239. }
  240. }
  241. // RegisterProductService publish the given ProductService implementation on the server.
  242. func RegisterProductService(srv *rpc.Server, x ProductService) error {
  243. if err := srv.RegisterName("ProductService", x); err != nil {
  244. return err
  245. }
  246. return nil
  247. }
  248. // NewProductServiceServer returns a new ProductService Server.
  249. func NewProductServiceServer(x ProductService) *rpc.Server {
  250. srv := rpc.NewServer()
  251. if err := srv.RegisterName("ProductService", x); err != nil {
  252. log.Fatal(err)
  253. }
  254. return srv
  255. }
  256. // ListenAndServeProductService listen announces on the local network address laddr
  257. // and serves the given ProductService implementation.
  258. func ListenAndServeProductService(network, addr string, x ProductService) error {
  259. lis, err := net.Listen(network, addr)
  260. if err != nil {
  261. return err
  262. }
  263. defer lis.Close()
  264. srv := rpc.NewServer()
  265. if err := srv.RegisterName("ProductService", x); err != nil {
  266. return err
  267. }
  268. for {
  269. conn, err := lis.Accept()
  270. if err != nil {
  271. log.Fatalf("lis.Accept(): %v\n", err)
  272. }
  273. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  274. }
  275. }
  276. type ProductServiceClient struct {
  277. *rpc.Client
  278. }
  279. // NewProductServiceClient returns a ProductService rpc.Client and stub to handle
  280. // requests to the set of ProductService at the other end of the connection.
  281. func NewProductServiceClient(conn io.ReadWriteCloser) (*ProductServiceClient, *rpc.Client) {
  282. c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
  283. return &ProductServiceClient{c}, c
  284. }
  285. func (c *ProductServiceClient) Get(in *GetRequest, out *GetResponse) error {
  286. return c.Call("ProductService.Get", in, out)
  287. }
  288. func (c *ProductServiceClient) GetByUuid(in *GetUuidRequest, out *GetResponse) error {
  289. return c.Call("ProductService.GetByUuid", in, out)
  290. }
  291. func (c *ProductServiceClient) GetSku(in *GetRequest, out *GetResponse) error {
  292. return c.Call("ProductService.GetSku", in, out)
  293. }
  294. func (c *ProductServiceClient) GetSkuByUuid(in *GetUuidRequest, out *GetResponse) error {
  295. return c.Call("ProductService.GetSkuByUuid", in, out)
  296. }
  297. func (c *ProductServiceClient) GetActivity(in *Request, out *Response) error {
  298. return c.Call("ProductService.GetActivity", in, out)
  299. }
  300. func (c *ProductServiceClient) GetAllActivity(in *Request, out *Response) error {
  301. return c.Call("ProductService.GetAllActivity", in, out)
  302. }
  303. func (c *ProductServiceClient) GetWarmingActivity(in *Request, out *Response) error {
  304. return c.Call("ProductService.GetWarmingActivity", in, out)
  305. }
  306. func (c *ProductServiceClient) FavoriteProduct(in *Request, out *Response) error {
  307. return c.Call("ProductService.FavoriteProduct", in, out)
  308. }
  309. func (c *ProductServiceClient) GetProductActivity(in *Request, out *Response) error {
  310. return c.Call("ProductService.GetProductActivity", in, out)
  311. }
  312. func (c *ProductServiceClient) GetProductAllActivity(in *Request, out *Response) error {
  313. return c.Call("ProductService.GetProductAllActivity", in, out)
  314. }
  315. func (c *ProductServiceClient) GetProductWarmingActivity(in *Request, out *Response) error {
  316. return c.Call("ProductService.GetProductWarmingActivity", in, out)
  317. }
  318. func (c *ProductServiceClient) GetSkuInfo(in *GetSkuRequest, out *GetResponse) error {
  319. return c.Call("ProductService.GetSkuInfo", in, out)
  320. }
  321. func (c *ProductServiceClient) GetSkuList(in *GetSkuRequest, out *GetResponse) error {
  322. return c.Call("ProductService.GetSkuList", in, out)
  323. }
  324. // DialProductService connects to an ProductService at the specified network address.
  325. func DialProductService(network, addr string) (*ProductServiceClient, *rpc.Client, error) {
  326. c, err := protorpc.Dial(network, addr)
  327. if err != nil {
  328. return nil, nil, err
  329. }
  330. return &ProductServiceClient{c}, c, nil
  331. }
  332. // DialProductServiceTimeout connects to an ProductService at the specified network address.
  333. func DialProductServiceTimeout(network, addr string,
  334. timeout time.Duration) (*ProductServiceClient, *rpc.Client, error) {
  335. c, err := protorpc.DialTimeout(network, addr, timeout)
  336. if err != nil {
  337. return nil, nil, err
  338. }
  339. return &ProductServiceClient{c}, c, nil
  340. }