-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.micro.go
190 lines (162 loc) · 6.7 KB
/
product.micro.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/product.proto
/*
Package product_proto is a generated protocol buffer package.
It is generated from these files:
proto/product.proto
It has these top-level messages:
ProductInfo
GeneralRequest
GeneralResponse
AddProductRequest
GetProductListRequest
GetProductListResponse
GetProductResponse
EditProductRequest
*/
package product_proto
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
context "context"
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
// Client API for ProductService service
type ProductService interface {
AddProduct(ctx context.Context, in *AddProductRequest, opts ...client.CallOption) (*GeneralResponse, error)
DeleteProduct(ctx context.Context, in *GeneralRequest, opts ...client.CallOption) (*GeneralResponse, error)
GetProductList(ctx context.Context, in *GetProductListRequest, opts ...client.CallOption) (*GetProductListResponse, error)
GetProduct(ctx context.Context, in *GeneralRequest, opts ...client.CallOption) (*GetProductResponse, error)
GetSelectedProductList(ctx context.Context, in *GeneralRequest, opts ...client.CallOption) (*GetProductListResponse, error)
EditProduct(ctx context.Context, in *EditProductRequest, opts ...client.CallOption) (*GeneralResponse, error)
}
type productService struct {
c client.Client
name string
}
func NewProductService(name string, c client.Client) ProductService {
if c == nil {
c = client.NewClient()
}
if len(name) == 0 {
name = "product_proto"
}
return &productService{
c: c,
name: name,
}
}
func (c *productService) AddProduct(ctx context.Context, in *AddProductRequest, opts ...client.CallOption) (*GeneralResponse, error) {
req := c.c.NewRequest(c.name, "ProductService.AddProduct", in)
out := new(GeneralResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productService) DeleteProduct(ctx context.Context, in *GeneralRequest, opts ...client.CallOption) (*GeneralResponse, error) {
req := c.c.NewRequest(c.name, "ProductService.DeleteProduct", in)
out := new(GeneralResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productService) GetProductList(ctx context.Context, in *GetProductListRequest, opts ...client.CallOption) (*GetProductListResponse, error) {
req := c.c.NewRequest(c.name, "ProductService.GetProductList", in)
out := new(GetProductListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productService) GetProduct(ctx context.Context, in *GeneralRequest, opts ...client.CallOption) (*GetProductResponse, error) {
req := c.c.NewRequest(c.name, "ProductService.GetProduct", in)
out := new(GetProductResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productService) GetSelectedProductList(ctx context.Context, in *GeneralRequest, opts ...client.CallOption) (*GetProductListResponse, error) {
req := c.c.NewRequest(c.name, "ProductService.GetSelectedProductList", in)
out := new(GetProductListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *productService) EditProduct(ctx context.Context, in *EditProductRequest, opts ...client.CallOption) (*GeneralResponse, error) {
req := c.c.NewRequest(c.name, "ProductService.EditProduct", in)
out := new(GeneralResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for ProductService service
type ProductServiceHandler interface {
AddProduct(context.Context, *AddProductRequest, *GeneralResponse) error
DeleteProduct(context.Context, *GeneralRequest, *GeneralResponse) error
GetProductList(context.Context, *GetProductListRequest, *GetProductListResponse) error
GetProduct(context.Context, *GeneralRequest, *GetProductResponse) error
GetSelectedProductList(context.Context, *GeneralRequest, *GetProductListResponse) error
EditProduct(context.Context, *EditProductRequest, *GeneralResponse) error
}
func RegisterProductServiceHandler(s server.Server, hdlr ProductServiceHandler, opts ...server.HandlerOption) error {
type productService interface {
AddProduct(ctx context.Context, in *AddProductRequest, out *GeneralResponse) error
DeleteProduct(ctx context.Context, in *GeneralRequest, out *GeneralResponse) error
GetProductList(ctx context.Context, in *GetProductListRequest, out *GetProductListResponse) error
GetProduct(ctx context.Context, in *GeneralRequest, out *GetProductResponse) error
GetSelectedProductList(ctx context.Context, in *GeneralRequest, out *GetProductListResponse) error
EditProduct(ctx context.Context, in *EditProductRequest, out *GeneralResponse) error
}
type ProductService struct {
productService
}
h := &productServiceHandler{hdlr}
return s.Handle(s.NewHandler(&ProductService{h}, opts...))
}
type productServiceHandler struct {
ProductServiceHandler
}
func (h *productServiceHandler) AddProduct(ctx context.Context, in *AddProductRequest, out *GeneralResponse) error {
return h.ProductServiceHandler.AddProduct(ctx, in, out)
}
func (h *productServiceHandler) DeleteProduct(ctx context.Context, in *GeneralRequest, out *GeneralResponse) error {
return h.ProductServiceHandler.DeleteProduct(ctx, in, out)
}
func (h *productServiceHandler) GetProductList(ctx context.Context, in *GetProductListRequest, out *GetProductListResponse) error {
return h.ProductServiceHandler.GetProductList(ctx, in, out)
}
func (h *productServiceHandler) GetProduct(ctx context.Context, in *GeneralRequest, out *GetProductResponse) error {
return h.ProductServiceHandler.GetProduct(ctx, in, out)
}
func (h *productServiceHandler) GetSelectedProductList(ctx context.Context, in *GeneralRequest, out *GetProductListResponse) error {
return h.ProductServiceHandler.GetSelectedProductList(ctx, in, out)
}
func (h *productServiceHandler) EditProduct(ctx context.Context, in *EditProductRequest, out *GeneralResponse) error {
return h.ProductServiceHandler.EditProduct(ctx, in, out)
}