-
Notifications
You must be signed in to change notification settings - Fork 1
/
cart.pb.micro.go
172 lines (145 loc) · 4.91 KB
/
cart.pb.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
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/cart/cart.proto
package cart
import (
fmt "fmt"
proto "google.golang.org/protobuf/proto"
math "math"
)
import (
context "context"
api "go-micro.dev/v4/api"
client "go-micro.dev/v4/client"
server "go-micro.dev/v4/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Cart service
func NewCartEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Cart service
type CartService interface {
AddCart(ctx context.Context, in *CartInfo, opts ...client.CallOption) (*ResponseAdd, error)
CleanCart(ctx context.Context, in *Clean, opts ...client.CallOption) (*Response, error)
Incr(ctx context.Context, in *Item, opts ...client.CallOption) (*Response, error)
Decr(ctx context.Context, in *Item, opts ...client.CallOption) (*Response, error)
DeleteItemByID(ctx context.Context, in *CartID, opts ...client.CallOption) (*Response, error)
GetAll(ctx context.Context, in *CartFindAll, opts ...client.CallOption) (*CartAll, error)
}
type cartService struct {
c client.Client
name string
}
func NewCartService(name string, c client.Client) CartService {
return &cartService{
c: c,
name: name,
}
}
func (c *cartService) AddCart(ctx context.Context, in *CartInfo, opts ...client.CallOption) (*ResponseAdd, error) {
req := c.c.NewRequest(c.name, "Cart.AddCart", in)
out := new(ResponseAdd)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cartService) CleanCart(ctx context.Context, in *Clean, opts ...client.CallOption) (*Response, error) {
req := c.c.NewRequest(c.name, "Cart.CleanCart", in)
out := new(Response)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cartService) Incr(ctx context.Context, in *Item, opts ...client.CallOption) (*Response, error) {
req := c.c.NewRequest(c.name, "Cart.Incr", in)
out := new(Response)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cartService) Decr(ctx context.Context, in *Item, opts ...client.CallOption) (*Response, error) {
req := c.c.NewRequest(c.name, "Cart.Decr", in)
out := new(Response)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cartService) DeleteItemByID(ctx context.Context, in *CartID, opts ...client.CallOption) (*Response, error) {
req := c.c.NewRequest(c.name, "Cart.DeleteItemByID", in)
out := new(Response)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cartService) GetAll(ctx context.Context, in *CartFindAll, opts ...client.CallOption) (*CartAll, error) {
req := c.c.NewRequest(c.name, "Cart.GetAll", in)
out := new(CartAll)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Cart service
type CartHandler interface {
AddCart(context.Context, *CartInfo, *ResponseAdd) error
CleanCart(context.Context, *Clean, *Response) error
Incr(context.Context, *Item, *Response) error
Decr(context.Context, *Item, *Response) error
DeleteItemByID(context.Context, *CartID, *Response) error
GetAll(context.Context, *CartFindAll, *CartAll) error
}
func RegisterCartHandler(s server.Server, hdlr CartHandler, opts ...server.HandlerOption) error {
type cart interface {
AddCart(ctx context.Context, in *CartInfo, out *ResponseAdd) error
CleanCart(ctx context.Context, in *Clean, out *Response) error
Incr(ctx context.Context, in *Item, out *Response) error
Decr(ctx context.Context, in *Item, out *Response) error
DeleteItemByID(ctx context.Context, in *CartID, out *Response) error
GetAll(ctx context.Context, in *CartFindAll, out *CartAll) error
}
type Cart struct {
cart
}
h := &cartHandler{hdlr}
return s.Handle(s.NewHandler(&Cart{h}, opts...))
}
type cartHandler struct {
CartHandler
}
func (h *cartHandler) AddCart(ctx context.Context, in *CartInfo, out *ResponseAdd) error {
return h.CartHandler.AddCart(ctx, in, out)
}
func (h *cartHandler) CleanCart(ctx context.Context, in *Clean, out *Response) error {
return h.CartHandler.CleanCart(ctx, in, out)
}
func (h *cartHandler) Incr(ctx context.Context, in *Item, out *Response) error {
return h.CartHandler.Incr(ctx, in, out)
}
func (h *cartHandler) Decr(ctx context.Context, in *Item, out *Response) error {
return h.CartHandler.Decr(ctx, in, out)
}
func (h *cartHandler) DeleteItemByID(ctx context.Context, in *CartID, out *Response) error {
return h.CartHandler.DeleteItemByID(ctx, in, out)
}
func (h *cartHandler) GetAll(ctx context.Context, in *CartFindAll, out *CartAll) error {
return h.CartHandler.GetAll(ctx, in, out)
}