github.com/annwntech/go-micro/v2@v2.9.5/service/grpc/proto/test.pb.micro.go (about) 1 // Code generated by protoc-gen-micro. DO NOT EDIT. 2 // source: service/grpc/proto/test.proto 3 4 package test 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/annwntech/go-micro/v2/api" 15 client "github.com/annwntech/go-micro/v2/client" 16 server "github.com/annwntech/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 Test service 37 38 func NewTestEndpoints() []*api.Endpoint { 39 return []*api.Endpoint{} 40 } 41 42 // Client API for Test service 43 44 type TestService interface { 45 Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) 46 } 47 48 type testService struct { 49 c client.Client 50 name string 51 } 52 53 func NewTestService(name string, c client.Client) TestService { 54 return &testService{ 55 c: c, 56 name: name, 57 } 58 } 59 60 func (c *testService) Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) { 61 req := c.c.NewRequest(c.name, "Test.Call", in) 62 out := new(Response) 63 err := c.c.Call(ctx, req, out, opts...) 64 if err != nil { 65 return nil, err 66 } 67 return out, nil 68 } 69 70 // Server API for Test service 71 72 type TestHandler interface { 73 Call(context.Context, *Request, *Response) error 74 } 75 76 func RegisterTestHandler(s server.Server, hdlr TestHandler, opts ...server.HandlerOption) error { 77 type test interface { 78 Call(ctx context.Context, in *Request, out *Response) error 79 } 80 type Test struct { 81 test 82 } 83 h := &testHandler{hdlr} 84 return s.Handle(s.NewHandler(&Test{h}, opts...)) 85 } 86 87 type testHandler struct { 88 TestHandler 89 } 90 91 func (h *testHandler) Call(ctx context.Context, in *Request, out *Response) error { 92 return h.TestHandler.Call(ctx, in, out) 93 }