github.com/annwntech/go-micro/v2@v2.9.5/server/grpc/proto/test.pb.micro.go (about) 1 // Code generated by protoc-gen-micro. DO NOT EDIT. 2 // source: server/grpc/proto/test.proto 3 4 package test 5 6 import ( 7 fmt "fmt" 8 proto "github.com/golang/protobuf/proto" 9 _ "google.golang.org/genproto/googleapis/api/annotations" 10 math "math" 11 ) 12 13 import ( 14 context "context" 15 api "github.com/annwntech/go-micro/v2/api" 16 client "github.com/annwntech/go-micro/v2/client" 17 server "github.com/annwntech/go-micro/v2/server" 18 ) 19 20 // Reference imports to suppress errors if they are not otherwise used. 21 var _ = proto.Marshal 22 var _ = fmt.Errorf 23 var _ = math.Inf 24 25 // This is a compile-time assertion to ensure that this generated file 26 // is compatible with the proto package it is being compiled against. 27 // A compilation error at this line likely means your copy of the 28 // proto package needs to be updated. 29 const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 30 31 // Reference imports to suppress errors if they are not otherwise used. 32 var _ api.Endpoint 33 var _ context.Context 34 var _ client.Option 35 var _ server.Option 36 37 // Api Endpoints for Test service 38 39 func NewTestEndpoints() []*api.Endpoint { 40 return []*api.Endpoint{ 41 &api.Endpoint{ 42 Name: "Test.Call", 43 Path: []string{"/api/v0/test/call/{uuid}"}, 44 Method: []string{"POST"}, 45 Body: "*", 46 Handler: "rpc", 47 }, 48 &api.Endpoint{ 49 Name: "Test.CallPcre", 50 Path: []string{"^/api/v0/test/call/pcre/?$"}, 51 Method: []string{"POST"}, 52 Body: "*", 53 Handler: "rpc", 54 }, 55 &api.Endpoint{ 56 Name: "Test.CallPcreInvalid", 57 Path: []string{"^/api/v0/test/call/pcre/invalid/?"}, 58 Method: []string{"POST"}, 59 Body: "*", 60 Handler: "rpc", 61 }, 62 } 63 } 64 65 // Client API for Test service 66 67 type TestService interface { 68 Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) 69 CallPcre(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) 70 CallPcreInvalid(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) 71 } 72 73 type testService struct { 74 c client.Client 75 name string 76 } 77 78 func NewTestService(name string, c client.Client) TestService { 79 return &testService{ 80 c: c, 81 name: name, 82 } 83 } 84 85 func (c *testService) Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) { 86 req := c.c.NewRequest(c.name, "Test.Call", in) 87 out := new(Response) 88 err := c.c.Call(ctx, req, out, opts...) 89 if err != nil { 90 return nil, err 91 } 92 return out, nil 93 } 94 95 func (c *testService) CallPcre(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) { 96 req := c.c.NewRequest(c.name, "Test.CallPcre", in) 97 out := new(Response) 98 err := c.c.Call(ctx, req, out, opts...) 99 if err != nil { 100 return nil, err 101 } 102 return out, nil 103 } 104 105 func (c *testService) CallPcreInvalid(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) { 106 req := c.c.NewRequest(c.name, "Test.CallPcreInvalid", in) 107 out := new(Response) 108 err := c.c.Call(ctx, req, out, opts...) 109 if err != nil { 110 return nil, err 111 } 112 return out, nil 113 } 114 115 // Server API for Test service 116 117 type TestHandler interface { 118 Call(context.Context, *Request, *Response) error 119 CallPcre(context.Context, *Request, *Response) error 120 CallPcreInvalid(context.Context, *Request, *Response) error 121 } 122 123 func RegisterTestHandler(s server.Server, hdlr TestHandler, opts ...server.HandlerOption) error { 124 type test interface { 125 Call(ctx context.Context, in *Request, out *Response) error 126 CallPcre(ctx context.Context, in *Request, out *Response) error 127 CallPcreInvalid(ctx context.Context, in *Request, out *Response) error 128 } 129 type Test struct { 130 test 131 } 132 h := &testHandler{hdlr} 133 opts = append(opts, api.WithEndpoint(&api.Endpoint{ 134 Name: "Test.Call", 135 Path: []string{"/api/v0/test/call/{uuid}"}, 136 Method: []string{"POST"}, 137 Body: "*", 138 Handler: "rpc", 139 })) 140 opts = append(opts, api.WithEndpoint(&api.Endpoint{ 141 Name: "Test.CallPcre", 142 Path: []string{"^/api/v0/test/call/pcre/?$"}, 143 Method: []string{"POST"}, 144 Body: "*", 145 Handler: "rpc", 146 })) 147 opts = append(opts, api.WithEndpoint(&api.Endpoint{ 148 Name: "Test.CallPcreInvalid", 149 Path: []string{"^/api/v0/test/call/pcre/invalid/?"}, 150 Method: []string{"POST"}, 151 Body: "*", 152 Handler: "rpc", 153 })) 154 return s.Handle(s.NewHandler(&Test{h}, opts...)) 155 } 156 157 type testHandler struct { 158 TestHandler 159 } 160 161 func (h *testHandler) Call(ctx context.Context, in *Request, out *Response) error { 162 return h.TestHandler.Call(ctx, in, out) 163 } 164 165 func (h *testHandler) CallPcre(ctx context.Context, in *Request, out *Response) error { 166 return h.TestHandler.CallPcre(ctx, in, out) 167 } 168 169 func (h *testHandler) CallPcreInvalid(ctx context.Context, in *Request, out *Response) error { 170 return h.TestHandler.CallPcreInvalid(ctx, in, out) 171 }