/
service.pb.micro.go
236 lines (200 loc) · 6.74 KB
/
service.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// versions:
// - protoc-gen-go-micro 23815987fd5c65de1306066d8380981c5ec77123
// - protoc v3.19.4
// source: config/source/service/proto/service.proto
package proto
import (
api "c-z.dev/go-micro/api"
client "c-z.dev/go-micro/client"
server "c-z.dev/go-micro/server"
context "context"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// NewConfigEndpoints API Endpoints for Config service
func NewConfigEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// ConfigService is the client API for Config service.
type ConfigService interface {
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error)
}
type configService struct {
c client.Client
name string
}
func NewConfigService(name string, c client.Client) ConfigService {
return &configService{
c: c,
name: name,
}
}
func (c *configService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
req := c.c.NewRequest(c.name, "Config.Create", in)
out := new(CreateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *configService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
req := c.c.NewRequest(c.name, "Config.Update", in)
out := new(UpdateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *configService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
req := c.c.NewRequest(c.name, "Config.Delete", in)
out := new(DeleteResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *configService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Config.List", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *configService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
req := c.c.NewRequest(c.name, "Config.Read", in)
out := new(ReadResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *configService) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error) {
req := c.c.NewRequest(c.name, "Config.Watch", &WatchRequest{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
if err := stream.Send(in); err != nil {
return nil, err
}
return &configServiceWatch{stream}, nil
}
type Config_WatchService interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*WatchResponse, error)
}
type configServiceWatch struct {
stream client.Stream
}
func (x *configServiceWatch) Close() error {
return x.stream.Close()
}
func (x *configServiceWatch) Context() context.Context {
return x.stream.Context()
}
func (x *configServiceWatch) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *configServiceWatch) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *configServiceWatch) Recv() (*WatchResponse, error) {
m := new(WatchResponse)
err := x.stream.Recv(m)
if err != nil {
return nil, err
}
return m, nil
}
// ConfigHandler is the server API for Config service.
type ConfigHandler interface {
Create(context.Context, *CreateRequest, *CreateResponse) error
Update(context.Context, *UpdateRequest, *UpdateResponse) error
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
List(context.Context, *ListRequest, *ListResponse) error
Read(context.Context, *ReadRequest, *ReadResponse) error
Watch(context.Context, *WatchRequest, Config_WatchStream) error
}
func RegisterConfigHandler(s server.Server, hdlr ConfigHandler, opts ...server.HandlerOption) error {
type config interface {
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
List(ctx context.Context, in *ListRequest, out *ListResponse) error
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
Watch(ctx context.Context, stream server.Stream) error
}
type Config struct {
config
}
h := &configHandler{hdlr}
return s.Handle(s.NewHandler(&Config{h}, opts...))
}
type configHandler struct {
ConfigHandler
}
func (h *configHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
return h.ConfigHandler.Create(ctx, in, out)
}
func (h *configHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
return h.ConfigHandler.Update(ctx, in, out)
}
func (h *configHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
return h.ConfigHandler.Delete(ctx, in, out)
}
func (h *configHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
return h.ConfigHandler.List(ctx, in, out)
}
func (h *configHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
return h.ConfigHandler.Read(ctx, in, out)
}
func (h *configHandler) Watch(ctx context.Context, stream server.Stream) error {
m := new(WatchRequest)
if err := stream.Recv(m); err != nil {
return err
}
return h.ConfigHandler.Watch(ctx, m, &configWatchStream{stream})
}
type Config_WatchStream interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*WatchResponse) error
}
type configWatchStream struct {
stream server.Stream
}
func (x *configWatchStream) Close() error {
return x.stream.Close()
}
func (x *configWatchStream) Context() context.Context {
return x.stream.Context()
}
func (x *configWatchStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *configWatchStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *configWatchStream) Send(m *WatchResponse) error {
return x.stream.Send(m)
}