google.golang.org/grpc@v1.62.1/reflection/grpc_testing/test_grpc.pb.go (about) 1 // Copyright 2017 gRPC authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 16 // versions: 17 // - protoc-gen-go-grpc v1.3.0 18 // - protoc v4.25.2 19 // source: reflection/grpc_testing/test.proto 20 21 package grpc_testing 22 23 import ( 24 context "context" 25 grpc "google.golang.org/grpc" 26 codes "google.golang.org/grpc/codes" 27 status "google.golang.org/grpc/status" 28 ) 29 30 // This is a compile-time assertion to ensure that this generated file 31 // is compatible with the grpc package it is being compiled against. 32 // Requires gRPC-Go v1.32.0 or later. 33 const _ = grpc.SupportPackageIsVersion7 34 35 const ( 36 SearchService_Search_FullMethodName = "/grpc.testing.SearchService/Search" 37 SearchService_StreamingSearch_FullMethodName = "/grpc.testing.SearchService/StreamingSearch" 38 ) 39 40 // SearchServiceClient is the client API for SearchService service. 41 // 42 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 43 type SearchServiceClient interface { 44 Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) 45 StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error) 46 } 47 48 type searchServiceClient struct { 49 cc grpc.ClientConnInterface 50 } 51 52 func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient { 53 return &searchServiceClient{cc} 54 } 55 56 func (c *searchServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) { 57 out := new(SearchResponse) 58 err := c.cc.Invoke(ctx, SearchService_Search_FullMethodName, in, out, opts...) 59 if err != nil { 60 return nil, err 61 } 62 return out, nil 63 } 64 65 func (c *searchServiceClient) StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error) { 66 stream, err := c.cc.NewStream(ctx, &SearchService_ServiceDesc.Streams[0], SearchService_StreamingSearch_FullMethodName, opts...) 67 if err != nil { 68 return nil, err 69 } 70 x := &searchServiceStreamingSearchClient{stream} 71 return x, nil 72 } 73 74 type SearchService_StreamingSearchClient interface { 75 Send(*SearchRequest) error 76 Recv() (*SearchResponse, error) 77 grpc.ClientStream 78 } 79 80 type searchServiceStreamingSearchClient struct { 81 grpc.ClientStream 82 } 83 84 func (x *searchServiceStreamingSearchClient) Send(m *SearchRequest) error { 85 return x.ClientStream.SendMsg(m) 86 } 87 88 func (x *searchServiceStreamingSearchClient) Recv() (*SearchResponse, error) { 89 m := new(SearchResponse) 90 if err := x.ClientStream.RecvMsg(m); err != nil { 91 return nil, err 92 } 93 return m, nil 94 } 95 96 // SearchServiceServer is the server API for SearchService service. 97 // All implementations must embed UnimplementedSearchServiceServer 98 // for forward compatibility 99 type SearchServiceServer interface { 100 Search(context.Context, *SearchRequest) (*SearchResponse, error) 101 StreamingSearch(SearchService_StreamingSearchServer) error 102 mustEmbedUnimplementedSearchServiceServer() 103 } 104 105 // UnimplementedSearchServiceServer must be embedded to have forward compatible implementations. 106 type UnimplementedSearchServiceServer struct { 107 } 108 109 func (UnimplementedSearchServiceServer) Search(context.Context, *SearchRequest) (*SearchResponse, error) { 110 return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") 111 } 112 func (UnimplementedSearchServiceServer) StreamingSearch(SearchService_StreamingSearchServer) error { 113 return status.Errorf(codes.Unimplemented, "method StreamingSearch not implemented") 114 } 115 func (UnimplementedSearchServiceServer) mustEmbedUnimplementedSearchServiceServer() {} 116 117 // UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service. 118 // Use of this interface is not recommended, as added methods to SearchServiceServer will 119 // result in compilation errors. 120 type UnsafeSearchServiceServer interface { 121 mustEmbedUnimplementedSearchServiceServer() 122 } 123 124 func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer) { 125 s.RegisterService(&SearchService_ServiceDesc, srv) 126 } 127 128 func _SearchService_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 129 in := new(SearchRequest) 130 if err := dec(in); err != nil { 131 return nil, err 132 } 133 if interceptor == nil { 134 return srv.(SearchServiceServer).Search(ctx, in) 135 } 136 info := &grpc.UnaryServerInfo{ 137 Server: srv, 138 FullMethod: SearchService_Search_FullMethodName, 139 } 140 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 141 return srv.(SearchServiceServer).Search(ctx, req.(*SearchRequest)) 142 } 143 return interceptor(ctx, in, info, handler) 144 } 145 146 func _SearchService_StreamingSearch_Handler(srv interface{}, stream grpc.ServerStream) error { 147 return srv.(SearchServiceServer).StreamingSearch(&searchServiceStreamingSearchServer{stream}) 148 } 149 150 type SearchService_StreamingSearchServer interface { 151 Send(*SearchResponse) error 152 Recv() (*SearchRequest, error) 153 grpc.ServerStream 154 } 155 156 type searchServiceStreamingSearchServer struct { 157 grpc.ServerStream 158 } 159 160 func (x *searchServiceStreamingSearchServer) Send(m *SearchResponse) error { 161 return x.ServerStream.SendMsg(m) 162 } 163 164 func (x *searchServiceStreamingSearchServer) Recv() (*SearchRequest, error) { 165 m := new(SearchRequest) 166 if err := x.ServerStream.RecvMsg(m); err != nil { 167 return nil, err 168 } 169 return m, nil 170 } 171 172 // SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service. 173 // It's only intended for direct use with grpc.RegisterService, 174 // and not to be introspected or modified (even as a copy) 175 var SearchService_ServiceDesc = grpc.ServiceDesc{ 176 ServiceName: "grpc.testing.SearchService", 177 HandlerType: (*SearchServiceServer)(nil), 178 Methods: []grpc.MethodDesc{ 179 { 180 MethodName: "Search", 181 Handler: _SearchService_Search_Handler, 182 }, 183 }, 184 Streams: []grpc.StreamDesc{ 185 { 186 StreamName: "StreamingSearch", 187 Handler: _SearchService_StreamingSearch_Handler, 188 ServerStreams: true, 189 ClientStreams: true, 190 }, 191 }, 192 Metadata: "reflection/grpc_testing/test.proto", 193 }