github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/proto/router/router.pb.micro.go (about) 1 // Code generated by protoc-gen-micro. DO NOT EDIT. 2 // source: router/router.proto 3 4 package router 5 6 import ( 7 fmt "fmt" 8 proto "github.com/golang/protobuf/proto" 9 math "math" 10 ) 11 12 import ( 13 context "context" 14 api "github.com/tickoalcantara12/micro/v3/service/api" 15 client "github.com/tickoalcantara12/micro/v3/service/client" 16 server "github.com/tickoalcantara12/micro/v3/service/server" 17 ) 18 19 // Reference imports to suppress errors if they are not otherwise used. 20 var _ = proto.Marshal 21 var _ = fmt.Errorf 22 var _ = math.Inf 23 24 // This is a compile-time assertion to ensure that this generated file 25 // is compatible with the proto package it is being compiled against. 26 // A compilation error at this line likely means your copy of the 27 // proto package needs to be updated. 28 const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 29 30 // Reference imports to suppress errors if they are not otherwise used. 31 var _ api.Endpoint 32 var _ context.Context 33 var _ client.Option 34 var _ server.Option 35 36 // Api Endpoints for Router service 37 38 func NewRouterEndpoints() []*api.Endpoint { 39 return []*api.Endpoint{} 40 } 41 42 // Client API for Router service 43 44 type RouterService interface { 45 Lookup(ctx context.Context, in *LookupRequest, opts ...client.CallOption) (*LookupResponse, error) 46 Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Router_WatchService, error) 47 } 48 49 type routerService struct { 50 c client.Client 51 name string 52 } 53 54 func NewRouterService(name string, c client.Client) RouterService { 55 return &routerService{ 56 c: c, 57 name: name, 58 } 59 } 60 61 func (c *routerService) Lookup(ctx context.Context, in *LookupRequest, opts ...client.CallOption) (*LookupResponse, error) { 62 req := c.c.NewRequest(c.name, "Router.Lookup", in) 63 out := new(LookupResponse) 64 err := c.c.Call(ctx, req, out, opts...) 65 if err != nil { 66 return nil, err 67 } 68 return out, nil 69 } 70 71 func (c *routerService) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Router_WatchService, error) { 72 req := c.c.NewRequest(c.name, "Router.Watch", &WatchRequest{}) 73 stream, err := c.c.Stream(ctx, req, opts...) 74 if err != nil { 75 return nil, err 76 } 77 if err := stream.Send(in); err != nil { 78 return nil, err 79 } 80 return &routerServiceWatch{stream}, nil 81 } 82 83 type Router_WatchService interface { 84 Context() context.Context 85 SendMsg(interface{}) error 86 RecvMsg(interface{}) error 87 Close() error 88 Recv() (*Event, error) 89 } 90 91 type routerServiceWatch struct { 92 stream client.Stream 93 } 94 95 func (x *routerServiceWatch) Close() error { 96 return x.stream.Close() 97 } 98 99 func (x *routerServiceWatch) Context() context.Context { 100 return x.stream.Context() 101 } 102 103 func (x *routerServiceWatch) SendMsg(m interface{}) error { 104 return x.stream.Send(m) 105 } 106 107 func (x *routerServiceWatch) RecvMsg(m interface{}) error { 108 return x.stream.Recv(m) 109 } 110 111 func (x *routerServiceWatch) Recv() (*Event, error) { 112 m := new(Event) 113 err := x.stream.Recv(m) 114 if err != nil { 115 return nil, err 116 } 117 return m, nil 118 } 119 120 // Server API for Router service 121 122 type RouterHandler interface { 123 Lookup(context.Context, *LookupRequest, *LookupResponse) error 124 Watch(context.Context, *WatchRequest, Router_WatchStream) error 125 } 126 127 func RegisterRouterHandler(s server.Server, hdlr RouterHandler, opts ...server.HandlerOption) error { 128 type router interface { 129 Lookup(ctx context.Context, in *LookupRequest, out *LookupResponse) error 130 Watch(ctx context.Context, stream server.Stream) error 131 } 132 type Router struct { 133 router 134 } 135 h := &routerHandler{hdlr} 136 return s.Handle(s.NewHandler(&Router{h}, opts...)) 137 } 138 139 type routerHandler struct { 140 RouterHandler 141 } 142 143 func (h *routerHandler) Lookup(ctx context.Context, in *LookupRequest, out *LookupResponse) error { 144 return h.RouterHandler.Lookup(ctx, in, out) 145 } 146 147 func (h *routerHandler) Watch(ctx context.Context, stream server.Stream) error { 148 m := new(WatchRequest) 149 if err := stream.Recv(m); err != nil { 150 return err 151 } 152 return h.RouterHandler.Watch(ctx, m, &routerWatchStream{stream}) 153 } 154 155 type Router_WatchStream interface { 156 Context() context.Context 157 SendMsg(interface{}) error 158 RecvMsg(interface{}) error 159 Close() error 160 Send(*Event) error 161 } 162 163 type routerWatchStream struct { 164 stream server.Stream 165 } 166 167 func (x *routerWatchStream) Close() error { 168 return x.stream.Close() 169 } 170 171 func (x *routerWatchStream) Context() context.Context { 172 return x.stream.Context() 173 } 174 175 func (x *routerWatchStream) SendMsg(m interface{}) error { 176 return x.stream.Send(m) 177 } 178 179 func (x *routerWatchStream) RecvMsg(m interface{}) error { 180 return x.stream.Recv(m) 181 } 182 183 func (x *routerWatchStream) Send(m *Event) error { 184 return x.stream.Send(m) 185 } 186 187 // Api Endpoints for Table service 188 189 func NewTableEndpoints() []*api.Endpoint { 190 return []*api.Endpoint{} 191 } 192 193 // Client API for Table service 194 195 type TableService interface { 196 Create(ctx context.Context, in *Route, opts ...client.CallOption) (*CreateResponse, error) 197 Delete(ctx context.Context, in *Route, opts ...client.CallOption) (*DeleteResponse, error) 198 Update(ctx context.Context, in *Route, opts ...client.CallOption) (*UpdateResponse, error) 199 Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) 200 } 201 202 type tableService struct { 203 c client.Client 204 name string 205 } 206 207 func NewTableService(name string, c client.Client) TableService { 208 return &tableService{ 209 c: c, 210 name: name, 211 } 212 } 213 214 func (c *tableService) Create(ctx context.Context, in *Route, opts ...client.CallOption) (*CreateResponse, error) { 215 req := c.c.NewRequest(c.name, "Table.Create", in) 216 out := new(CreateResponse) 217 err := c.c.Call(ctx, req, out, opts...) 218 if err != nil { 219 return nil, err 220 } 221 return out, nil 222 } 223 224 func (c *tableService) Delete(ctx context.Context, in *Route, opts ...client.CallOption) (*DeleteResponse, error) { 225 req := c.c.NewRequest(c.name, "Table.Delete", in) 226 out := new(DeleteResponse) 227 err := c.c.Call(ctx, req, out, opts...) 228 if err != nil { 229 return nil, err 230 } 231 return out, nil 232 } 233 234 func (c *tableService) Update(ctx context.Context, in *Route, opts ...client.CallOption) (*UpdateResponse, error) { 235 req := c.c.NewRequest(c.name, "Table.Update", in) 236 out := new(UpdateResponse) 237 err := c.c.Call(ctx, req, out, opts...) 238 if err != nil { 239 return nil, err 240 } 241 return out, nil 242 } 243 244 func (c *tableService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) { 245 req := c.c.NewRequest(c.name, "Table.Read", in) 246 out := new(ReadResponse) 247 err := c.c.Call(ctx, req, out, opts...) 248 if err != nil { 249 return nil, err 250 } 251 return out, nil 252 } 253 254 // Server API for Table service 255 256 type TableHandler interface { 257 Create(context.Context, *Route, *CreateResponse) error 258 Delete(context.Context, *Route, *DeleteResponse) error 259 Update(context.Context, *Route, *UpdateResponse) error 260 Read(context.Context, *ReadRequest, *ReadResponse) error 261 } 262 263 func RegisterTableHandler(s server.Server, hdlr TableHandler, opts ...server.HandlerOption) error { 264 type table interface { 265 Create(ctx context.Context, in *Route, out *CreateResponse) error 266 Delete(ctx context.Context, in *Route, out *DeleteResponse) error 267 Update(ctx context.Context, in *Route, out *UpdateResponse) error 268 Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error 269 } 270 type Table struct { 271 table 272 } 273 h := &tableHandler{hdlr} 274 return s.Handle(s.NewHandler(&Table{h}, opts...)) 275 } 276 277 type tableHandler struct { 278 TableHandler 279 } 280 281 func (h *tableHandler) Create(ctx context.Context, in *Route, out *CreateResponse) error { 282 return h.TableHandler.Create(ctx, in, out) 283 } 284 285 func (h *tableHandler) Delete(ctx context.Context, in *Route, out *DeleteResponse) error { 286 return h.TableHandler.Delete(ctx, in, out) 287 } 288 289 func (h *tableHandler) Update(ctx context.Context, in *Route, out *UpdateResponse) error { 290 return h.TableHandler.Update(ctx, in, out) 291 } 292 293 func (h *tableHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error { 294 return h.TableHandler.Read(ctx, in, out) 295 }