github.com/micro/go-micro/v2@v2.9.1/server/proto/server.pb.micro.go (about) 1 // Code generated by protoc-gen-micro. DO NOT EDIT. 2 // source: server/proto/server.proto 3 4 package go_micro_server 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/micro/go-micro/v2/api" 15 client "github.com/micro/go-micro/v2/client" 16 server "github.com/micro/go-micro/v2/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 Server service 37 38 func NewServerEndpoints() []*api.Endpoint { 39 return []*api.Endpoint{} 40 } 41 42 // Client API for Server service 43 44 type ServerService interface { 45 Handle(ctx context.Context, in *HandleRequest, opts ...client.CallOption) (*HandleResponse, error) 46 Subscribe(ctx context.Context, in *SubscribeRequest, opts ...client.CallOption) (*SubscribeResponse, error) 47 } 48 49 type serverService struct { 50 c client.Client 51 name string 52 } 53 54 func NewServerService(name string, c client.Client) ServerService { 55 return &serverService{ 56 c: c, 57 name: name, 58 } 59 } 60 61 func (c *serverService) Handle(ctx context.Context, in *HandleRequest, opts ...client.CallOption) (*HandleResponse, error) { 62 req := c.c.NewRequest(c.name, "Server.Handle", in) 63 out := new(HandleResponse) 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 *serverService) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...client.CallOption) (*SubscribeResponse, error) { 72 req := c.c.NewRequest(c.name, "Server.Subscribe", in) 73 out := new(SubscribeResponse) 74 err := c.c.Call(ctx, req, out, opts...) 75 if err != nil { 76 return nil, err 77 } 78 return out, nil 79 } 80 81 // Server API for Server service 82 83 type ServerHandler interface { 84 Handle(context.Context, *HandleRequest, *HandleResponse) error 85 Subscribe(context.Context, *SubscribeRequest, *SubscribeResponse) error 86 } 87 88 func RegisterServerHandler(s server.Server, hdlr ServerHandler, opts ...server.HandlerOption) error { 89 type server interface { 90 Handle(ctx context.Context, in *HandleRequest, out *HandleResponse) error 91 Subscribe(ctx context.Context, in *SubscribeRequest, out *SubscribeResponse) error 92 } 93 type Server struct { 94 server 95 } 96 h := &serverHandler{hdlr} 97 return s.Handle(s.NewHandler(&Server{h}, opts...)) 98 } 99 100 type serverHandler struct { 101 ServerHandler 102 } 103 104 func (h *serverHandler) Handle(ctx context.Context, in *HandleRequest, out *HandleResponse) error { 105 return h.ServerHandler.Handle(ctx, in, out) 106 } 107 108 func (h *serverHandler) Subscribe(ctx context.Context, in *SubscribeRequest, out *SubscribeResponse) error { 109 return h.ServerHandler.Subscribe(ctx, in, out) 110 }