| // Code generated by protoc-gen-go-grpc. DO NOT EDIT. |
| |
| package grpc |
| |
| import ( |
| context "context" |
| grpc "google.golang.org/grpc" |
| ) |
| |
| // Reference imports to suppress errors if they are not otherwise used. |
| var _ context.Context |
| var _ grpc.ClientConn |
| |
| // This is a compile-time assertion to ensure that this generated file |
| // is compatible with the grpc package it is being compiled against. |
| const _ = grpc.SupportPackageIsVersion4 |
| |
| // TestServiceClient is the client API for TestService service. |
| // |
| // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. |
| type TestServiceClient interface { |
| UnaryCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) |
| // This RPC streams from the server only. |
| DownstreamCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (TestService_DownstreamCallClient, error) |
| // This RPC streams from the client. |
| UpstreamCall(ctx context.Context, opts ...grpc.CallOption) (TestService_UpstreamCallClient, error) |
| // This one streams in both directions. |
| BidiCall(ctx context.Context, opts ...grpc.CallOption) (TestService_BidiCallClient, error) |
| } |
| |
| type testServiceClient struct { |
| cc *grpc.ClientConn |
| } |
| |
| func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient { |
| return &testServiceClient{cc} |
| } |
| |
| func (c *testServiceClient) UnaryCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { |
| out := new(Response) |
| err := c.cc.Invoke(ctx, "/goproto.protoc.grpc.test_service/unary_call", in, out, opts...) |
| if err != nil { |
| return nil, err |
| } |
| return out, nil |
| } |
| |
| func (c *testServiceClient) DownstreamCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (TestService_DownstreamCallClient, error) { |
| stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/goproto.protoc.grpc.test_service/downstream_call", opts...) |
| if err != nil { |
| return nil, err |
| } |
| x := &testServiceDownstreamCallClient{stream} |
| if err := x.ClientStream.SendMsg(in); err != nil { |
| return nil, err |
| } |
| if err := x.ClientStream.CloseSend(); err != nil { |
| return nil, err |
| } |
| return x, nil |
| } |
| |
| type TestService_DownstreamCallClient interface { |
| Recv() (*Response, error) |
| grpc.ClientStream |
| } |
| |
| type testServiceDownstreamCallClient struct { |
| grpc.ClientStream |
| } |
| |
| func (x *testServiceDownstreamCallClient) Recv() (*Response, error) { |
| m := new(Response) |
| if err := x.ClientStream.RecvMsg(m); err != nil { |
| return nil, err |
| } |
| return m, nil |
| } |
| |
| func (c *testServiceClient) UpstreamCall(ctx context.Context, opts ...grpc.CallOption) (TestService_UpstreamCallClient, error) { |
| stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/goproto.protoc.grpc.test_service/upstream_call", opts...) |
| if err != nil { |
| return nil, err |
| } |
| x := &testServiceUpstreamCallClient{stream} |
| return x, nil |
| } |
| |
| type TestService_UpstreamCallClient interface { |
| Send(*Request) error |
| CloseAndRecv() (*Response, error) |
| grpc.ClientStream |
| } |
| |
| type testServiceUpstreamCallClient struct { |
| grpc.ClientStream |
| } |
| |
| func (x *testServiceUpstreamCallClient) Send(m *Request) error { |
| return x.ClientStream.SendMsg(m) |
| } |
| |
| func (x *testServiceUpstreamCallClient) CloseAndRecv() (*Response, error) { |
| if err := x.ClientStream.CloseSend(); err != nil { |
| return nil, err |
| } |
| m := new(Response) |
| if err := x.ClientStream.RecvMsg(m); err != nil { |
| return nil, err |
| } |
| return m, nil |
| } |
| |
| func (c *testServiceClient) BidiCall(ctx context.Context, opts ...grpc.CallOption) (TestService_BidiCallClient, error) { |
| stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/goproto.protoc.grpc.test_service/bidi_call", opts...) |
| if err != nil { |
| return nil, err |
| } |
| x := &testServiceBidiCallClient{stream} |
| return x, nil |
| } |
| |
| type TestService_BidiCallClient interface { |
| Send(*Request) error |
| Recv() (*Response, error) |
| grpc.ClientStream |
| } |
| |
| type testServiceBidiCallClient struct { |
| grpc.ClientStream |
| } |
| |
| func (x *testServiceBidiCallClient) Send(m *Request) error { |
| return x.ClientStream.SendMsg(m) |
| } |
| |
| func (x *testServiceBidiCallClient) Recv() (*Response, error) { |
| m := new(Response) |
| if err := x.ClientStream.RecvMsg(m); err != nil { |
| return nil, err |
| } |
| return m, nil |
| } |
| |
| // TestServiceServer is the server API for TestService service. |
| type TestServiceServer interface { |
| UnaryCall(context.Context, *Request) (*Response, error) |
| // This RPC streams from the server only. |
| DownstreamCall(*Request, TestService_DownstreamCallServer) error |
| // This RPC streams from the client. |
| UpstreamCall(TestService_UpstreamCallServer) error |
| // This one streams in both directions. |
| BidiCall(TestService_BidiCallServer) error |
| } |
| |
| func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { |
| s.RegisterService(&_TestService_serviceDesc, srv) |
| } |
| |
| func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
| in := new(Request) |
| if err := dec(in); err != nil { |
| return nil, err |
| } |
| if interceptor == nil { |
| return srv.(TestServiceServer).UnaryCall(ctx, in) |
| } |
| info := &grpc.UnaryServerInfo{ |
| Server: srv, |
| FullMethod: "/goproto.protoc.grpc.test_service/UnaryCall", |
| } |
| handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
| return srv.(TestServiceServer).UnaryCall(ctx, req.(*Request)) |
| } |
| return interceptor(ctx, in, info, handler) |
| } |
| |
| func _TestService_DownstreamCall_Handler(srv interface{}, stream grpc.ServerStream) error { |
| m := new(Request) |
| if err := stream.RecvMsg(m); err != nil { |
| return err |
| } |
| return srv.(TestServiceServer).DownstreamCall(m, &testServiceDownstreamCallServer{stream}) |
| } |
| |
| type TestService_DownstreamCallServer interface { |
| Send(*Response) error |
| grpc.ServerStream |
| } |
| |
| type testServiceDownstreamCallServer struct { |
| grpc.ServerStream |
| } |
| |
| func (x *testServiceDownstreamCallServer) Send(m *Response) error { |
| return x.ServerStream.SendMsg(m) |
| } |
| |
| func _TestService_UpstreamCall_Handler(srv interface{}, stream grpc.ServerStream) error { |
| return srv.(TestServiceServer).UpstreamCall(&testServiceUpstreamCallServer{stream}) |
| } |
| |
| type TestService_UpstreamCallServer interface { |
| SendAndClose(*Response) error |
| Recv() (*Request, error) |
| grpc.ServerStream |
| } |
| |
| type testServiceUpstreamCallServer struct { |
| grpc.ServerStream |
| } |
| |
| func (x *testServiceUpstreamCallServer) SendAndClose(m *Response) error { |
| return x.ServerStream.SendMsg(m) |
| } |
| |
| func (x *testServiceUpstreamCallServer) Recv() (*Request, error) { |
| m := new(Request) |
| if err := x.ServerStream.RecvMsg(m); err != nil { |
| return nil, err |
| } |
| return m, nil |
| } |
| |
| func _TestService_BidiCall_Handler(srv interface{}, stream grpc.ServerStream) error { |
| return srv.(TestServiceServer).BidiCall(&testServiceBidiCallServer{stream}) |
| } |
| |
| type TestService_BidiCallServer interface { |
| Send(*Response) error |
| Recv() (*Request, error) |
| grpc.ServerStream |
| } |
| |
| type testServiceBidiCallServer struct { |
| grpc.ServerStream |
| } |
| |
| func (x *testServiceBidiCallServer) Send(m *Response) error { |
| return x.ServerStream.SendMsg(m) |
| } |
| |
| func (x *testServiceBidiCallServer) Recv() (*Request, error) { |
| m := new(Request) |
| if err := x.ServerStream.RecvMsg(m); err != nil { |
| return nil, err |
| } |
| return m, nil |
| } |
| |
| var _TestService_serviceDesc = grpc.ServiceDesc{ |
| ServiceName: "goproto.protoc.grpc.test_service", |
| HandlerType: (*TestServiceServer)(nil), |
| Methods: []grpc.MethodDesc{ |
| { |
| MethodName: "unary_call", |
| Handler: _TestService_UnaryCall_Handler, |
| }, |
| }, |
| Streams: []grpc.StreamDesc{ |
| { |
| StreamName: "downstream_call", |
| Handler: _TestService_DownstreamCall_Handler, |
| ServerStreams: true, |
| }, |
| { |
| StreamName: "upstream_call", |
| Handler: _TestService_UpstreamCall_Handler, |
| ClientStreams: true, |
| }, |
| { |
| StreamName: "bidi_call", |
| Handler: _TestService_BidiCall_Handler, |
| ServerStreams: true, |
| ClientStreams: true, |
| }, |
| }, |
| Metadata: "grpc/grpc.proto", |
| } |