github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/grpc/reflection/grpc_testing/test_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 // versions: 3 // - protoc-gen-go-grpc v1.2.0 4 // - protoc v3.14.0 5 // source: reflection/grpc_testing/test.proto 6 7 package grpc_testing 8 9 import ( 10 context "context" 11 grpc "github.com/hxx258456/ccgo/grpc" 12 codes "github.com/hxx258456/ccgo/grpc/codes" 13 status "github.com/hxx258456/ccgo/grpc/status" 14 ) 15 16 // This is a compile-time assertion to ensure that this generated file 17 // is compatible with the grpc package it is being compiled against. 18 // Requires gRPC-Go v1.32.0 or later. 19 const _ = grpc.SupportPackageIsVersion7 20 21 // SearchServiceClient is the client API for SearchService service. 22 // 23 // 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. 24 type SearchServiceClient interface { 25 Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) 26 StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error) 27 } 28 29 type searchServiceClient struct { 30 cc grpc.ClientConnInterface 31 } 32 33 func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient { 34 return &searchServiceClient{cc} 35 } 36 37 func (c *searchServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) { 38 out := new(SearchResponse) 39 err := c.cc.Invoke(ctx, "/grpc.testing.SearchService/Search", in, out, opts...) 40 if err != nil { 41 return nil, err 42 } 43 return out, nil 44 } 45 46 func (c *searchServiceClient) StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error) { 47 stream, err := c.cc.NewStream(ctx, &SearchService_ServiceDesc.Streams[0], "/grpc.testing.SearchService/StreamingSearch", opts...) 48 if err != nil { 49 return nil, err 50 } 51 x := &searchServiceStreamingSearchClient{stream} 52 return x, nil 53 } 54 55 type SearchService_StreamingSearchClient interface { 56 Send(*SearchRequest) error 57 Recv() (*SearchResponse, error) 58 grpc.ClientStream 59 } 60 61 type searchServiceStreamingSearchClient struct { 62 grpc.ClientStream 63 } 64 65 func (x *searchServiceStreamingSearchClient) Send(m *SearchRequest) error { 66 return x.ClientStream.SendMsg(m) 67 } 68 69 func (x *searchServiceStreamingSearchClient) Recv() (*SearchResponse, error) { 70 m := new(SearchResponse) 71 if err := x.ClientStream.RecvMsg(m); err != nil { 72 return nil, err 73 } 74 return m, nil 75 } 76 77 // SearchServiceServer is the server API for SearchService service. 78 // All implementations must embed UnimplementedSearchServiceServer 79 // for forward compatibility 80 type SearchServiceServer interface { 81 Search(context.Context, *SearchRequest) (*SearchResponse, error) 82 StreamingSearch(SearchService_StreamingSearchServer) error 83 mustEmbedUnimplementedSearchServiceServer() 84 } 85 86 // UnimplementedSearchServiceServer must be embedded to have forward compatible implementations. 87 type UnimplementedSearchServiceServer struct { 88 } 89 90 func (UnimplementedSearchServiceServer) Search(context.Context, *SearchRequest) (*SearchResponse, error) { 91 return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") 92 } 93 func (UnimplementedSearchServiceServer) StreamingSearch(SearchService_StreamingSearchServer) error { 94 return status.Errorf(codes.Unimplemented, "method StreamingSearch not implemented") 95 } 96 func (UnimplementedSearchServiceServer) mustEmbedUnimplementedSearchServiceServer() {} 97 98 // UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service. 99 // Use of this interface is not recommended, as added methods to SearchServiceServer will 100 // result in compilation errors. 101 type UnsafeSearchServiceServer interface { 102 mustEmbedUnimplementedSearchServiceServer() 103 } 104 105 func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer) { 106 s.RegisterService(&SearchService_ServiceDesc, srv) 107 } 108 109 func _SearchService_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 110 in := new(SearchRequest) 111 if err := dec(in); err != nil { 112 return nil, err 113 } 114 if interceptor == nil { 115 return srv.(SearchServiceServer).Search(ctx, in) 116 } 117 info := &grpc.UnaryServerInfo{ 118 Server: srv, 119 FullMethod: "/grpc.testing.SearchService/Search", 120 } 121 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 122 return srv.(SearchServiceServer).Search(ctx, req.(*SearchRequest)) 123 } 124 return interceptor(ctx, in, info, handler) 125 } 126 127 func _SearchService_StreamingSearch_Handler(srv interface{}, stream grpc.ServerStream) error { 128 return srv.(SearchServiceServer).StreamingSearch(&searchServiceStreamingSearchServer{stream}) 129 } 130 131 type SearchService_StreamingSearchServer interface { 132 Send(*SearchResponse) error 133 Recv() (*SearchRequest, error) 134 grpc.ServerStream 135 } 136 137 type searchServiceStreamingSearchServer struct { 138 grpc.ServerStream 139 } 140 141 func (x *searchServiceStreamingSearchServer) Send(m *SearchResponse) error { 142 return x.ServerStream.SendMsg(m) 143 } 144 145 func (x *searchServiceStreamingSearchServer) Recv() (*SearchRequest, error) { 146 m := new(SearchRequest) 147 if err := x.ServerStream.RecvMsg(m); err != nil { 148 return nil, err 149 } 150 return m, nil 151 } 152 153 // SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service. 154 // It's only intended for direct use with grpc.RegisterService, 155 // and not to be introspected or modified (even as a copy) 156 var SearchService_ServiceDesc = grpc.ServiceDesc{ 157 ServiceName: "grpc.testing.SearchService", 158 HandlerType: (*SearchServiceServer)(nil), 159 Methods: []grpc.MethodDesc{ 160 { 161 MethodName: "Search", 162 Handler: _SearchService_Search_Handler, 163 }, 164 }, 165 Streams: []grpc.StreamDesc{ 166 { 167 StreamName: "StreamingSearch", 168 Handler: _SearchService_StreamingSearch_Handler, 169 ServerStreams: true, 170 ClientStreams: true, 171 }, 172 }, 173 Metadata: "reflection/grpc_testing/test.proto", 174 }