mirror of
https://github.com/linka-cloud/grpc.git
synced 2024-11-29 06:16:24 +00:00
307 lines
9.8 KiB
Go
307 lines
9.8 KiB
Go
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||
|
|
||
|
package testservice
|
||
|
|
||
|
import (
|
||
|
context "context"
|
||
|
grpc "google.golang.org/grpc"
|
||
|
codes "google.golang.org/grpc/codes"
|
||
|
status "google.golang.org/grpc/status"
|
||
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||
|
)
|
||
|
|
||
|
// This is a compile-time assertion to ensure that this generated file
|
||
|
// is compatible with the grpc package it is being compiled against.
|
||
|
// Requires gRPC-Go v1.32.0 or later.
|
||
|
const _ = grpc.SupportPackageIsVersion7
|
||
|
|
||
|
// TestServiceClient is the client API for TestService service.
|
||
|
//
|
||
|
// 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.
|
||
|
type TestServiceClient interface {
|
||
|
PingEmpty(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PingResponse, error)
|
||
|
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
|
||
|
PingError(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||
|
PingList(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (TestService_PingListClient, error)
|
||
|
PingStream(ctx context.Context, opts ...grpc.CallOption) (TestService_PingStreamClient, error)
|
||
|
}
|
||
|
|
||
|
type testServiceClient struct {
|
||
|
cc grpc.ClientConnInterface
|
||
|
}
|
||
|
|
||
|
func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient {
|
||
|
return &testServiceClient{cc}
|
||
|
}
|
||
|
|
||
|
func (c *testServiceClient) PingEmpty(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PingResponse, error) {
|
||
|
out := new(PingResponse)
|
||
|
err := c.cc.Invoke(ctx, "/mwitkow.testproto.TestService/PingEmpty", in, out, opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return out, nil
|
||
|
}
|
||
|
|
||
|
func (c *testServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) {
|
||
|
out := new(PingResponse)
|
||
|
err := c.cc.Invoke(ctx, "/mwitkow.testproto.TestService/Ping", in, out, opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return out, nil
|
||
|
}
|
||
|
|
||
|
func (c *testServiceClient) PingError(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||
|
out := new(emptypb.Empty)
|
||
|
err := c.cc.Invoke(ctx, "/mwitkow.testproto.TestService/PingError", in, out, opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return out, nil
|
||
|
}
|
||
|
|
||
|
func (c *testServiceClient) PingList(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (TestService_PingListClient, error) {
|
||
|
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[0], "/mwitkow.testproto.TestService/PingList", opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
x := &testServicePingListClient{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_PingListClient interface {
|
||
|
Recv() (*PingResponse, error)
|
||
|
grpc.ClientStream
|
||
|
}
|
||
|
|
||
|
type testServicePingListClient struct {
|
||
|
grpc.ClientStream
|
||
|
}
|
||
|
|
||
|
func (x *testServicePingListClient) Recv() (*PingResponse, error) {
|
||
|
m := new(PingResponse)
|
||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return m, nil
|
||
|
}
|
||
|
|
||
|
func (c *testServiceClient) PingStream(ctx context.Context, opts ...grpc.CallOption) (TestService_PingStreamClient, error) {
|
||
|
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[1], "/mwitkow.testproto.TestService/PingStream", opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
x := &testServicePingStreamClient{stream}
|
||
|
return x, nil
|
||
|
}
|
||
|
|
||
|
type TestService_PingStreamClient interface {
|
||
|
Send(*PingRequest) error
|
||
|
Recv() (*PingResponse, error)
|
||
|
grpc.ClientStream
|
||
|
}
|
||
|
|
||
|
type testServicePingStreamClient struct {
|
||
|
grpc.ClientStream
|
||
|
}
|
||
|
|
||
|
func (x *testServicePingStreamClient) Send(m *PingRequest) error {
|
||
|
return x.ClientStream.SendMsg(m)
|
||
|
}
|
||
|
|
||
|
func (x *testServicePingStreamClient) Recv() (*PingResponse, error) {
|
||
|
m := new(PingResponse)
|
||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return m, nil
|
||
|
}
|
||
|
|
||
|
// TestServiceServer is the server API for TestService service.
|
||
|
// All implementations must embed UnimplementedTestServiceServer
|
||
|
// for forward compatibility
|
||
|
type TestServiceServer interface {
|
||
|
PingEmpty(context.Context, *emptypb.Empty) (*PingResponse, error)
|
||
|
Ping(context.Context, *PingRequest) (*PingResponse, error)
|
||
|
PingError(context.Context, *PingRequest) (*emptypb.Empty, error)
|
||
|
PingList(*PingRequest, TestService_PingListServer) error
|
||
|
PingStream(TestService_PingStreamServer) error
|
||
|
mustEmbedUnimplementedTestServiceServer()
|
||
|
}
|
||
|
|
||
|
// UnimplementedTestServiceServer must be embedded to have forward compatible implementations.
|
||
|
type UnimplementedTestServiceServer struct {
|
||
|
}
|
||
|
|
||
|
func (UnimplementedTestServiceServer) PingEmpty(context.Context, *emptypb.Empty) (*PingResponse, error) {
|
||
|
return nil, status.Errorf(codes.Unimplemented, "method PingEmpty not implemented")
|
||
|
}
|
||
|
func (UnimplementedTestServiceServer) Ping(context.Context, *PingRequest) (*PingResponse, error) {
|
||
|
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
|
||
|
}
|
||
|
func (UnimplementedTestServiceServer) PingError(context.Context, *PingRequest) (*emptypb.Empty, error) {
|
||
|
return nil, status.Errorf(codes.Unimplemented, "method PingError not implemented")
|
||
|
}
|
||
|
func (UnimplementedTestServiceServer) PingList(*PingRequest, TestService_PingListServer) error {
|
||
|
return status.Errorf(codes.Unimplemented, "method PingList not implemented")
|
||
|
}
|
||
|
func (UnimplementedTestServiceServer) PingStream(TestService_PingStreamServer) error {
|
||
|
return status.Errorf(codes.Unimplemented, "method PingStream not implemented")
|
||
|
}
|
||
|
func (UnimplementedTestServiceServer) mustEmbedUnimplementedTestServiceServer() {}
|
||
|
|
||
|
// UnsafeTestServiceServer may be embedded to opt out of forward compatibility for this service.
|
||
|
// Use of this interface is not recommended, as added methods to TestServiceServer will
|
||
|
// result in compilation errors.
|
||
|
type UnsafeTestServiceServer interface {
|
||
|
mustEmbedUnimplementedTestServiceServer()
|
||
|
}
|
||
|
|
||
|
func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer) {
|
||
|
s.RegisterService(&TestService_ServiceDesc, srv)
|
||
|
}
|
||
|
|
||
|
func _TestService_PingEmpty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
in := new(emptypb.Empty)
|
||
|
if err := dec(in); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if interceptor == nil {
|
||
|
return srv.(TestServiceServer).PingEmpty(ctx, in)
|
||
|
}
|
||
|
info := &grpc.UnaryServerInfo{
|
||
|
Server: srv,
|
||
|
FullMethod: "/mwitkow.testproto.TestService/PingEmpty",
|
||
|
}
|
||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
return srv.(TestServiceServer).PingEmpty(ctx, req.(*emptypb.Empty))
|
||
|
}
|
||
|
return interceptor(ctx, in, info, handler)
|
||
|
}
|
||
|
|
||
|
func _TestService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
in := new(PingRequest)
|
||
|
if err := dec(in); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if interceptor == nil {
|
||
|
return srv.(TestServiceServer).Ping(ctx, in)
|
||
|
}
|
||
|
info := &grpc.UnaryServerInfo{
|
||
|
Server: srv,
|
||
|
FullMethod: "/mwitkow.testproto.TestService/Ping",
|
||
|
}
|
||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
return srv.(TestServiceServer).Ping(ctx, req.(*PingRequest))
|
||
|
}
|
||
|
return interceptor(ctx, in, info, handler)
|
||
|
}
|
||
|
|
||
|
func _TestService_PingError_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
in := new(PingRequest)
|
||
|
if err := dec(in); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if interceptor == nil {
|
||
|
return srv.(TestServiceServer).PingError(ctx, in)
|
||
|
}
|
||
|
info := &grpc.UnaryServerInfo{
|
||
|
Server: srv,
|
||
|
FullMethod: "/mwitkow.testproto.TestService/PingError",
|
||
|
}
|
||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
return srv.(TestServiceServer).PingError(ctx, req.(*PingRequest))
|
||
|
}
|
||
|
return interceptor(ctx, in, info, handler)
|
||
|
}
|
||
|
|
||
|
func _TestService_PingList_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||
|
m := new(PingRequest)
|
||
|
if err := stream.RecvMsg(m); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return srv.(TestServiceServer).PingList(m, &testServicePingListServer{stream})
|
||
|
}
|
||
|
|
||
|
type TestService_PingListServer interface {
|
||
|
Send(*PingResponse) error
|
||
|
grpc.ServerStream
|
||
|
}
|
||
|
|
||
|
type testServicePingListServer struct {
|
||
|
grpc.ServerStream
|
||
|
}
|
||
|
|
||
|
func (x *testServicePingListServer) Send(m *PingResponse) error {
|
||
|
return x.ServerStream.SendMsg(m)
|
||
|
}
|
||
|
|
||
|
func _TestService_PingStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||
|
return srv.(TestServiceServer).PingStream(&testServicePingStreamServer{stream})
|
||
|
}
|
||
|
|
||
|
type TestService_PingStreamServer interface {
|
||
|
Send(*PingResponse) error
|
||
|
Recv() (*PingRequest, error)
|
||
|
grpc.ServerStream
|
||
|
}
|
||
|
|
||
|
type testServicePingStreamServer struct {
|
||
|
grpc.ServerStream
|
||
|
}
|
||
|
|
||
|
func (x *testServicePingStreamServer) Send(m *PingResponse) error {
|
||
|
return x.ServerStream.SendMsg(m)
|
||
|
}
|
||
|
|
||
|
func (x *testServicePingStreamServer) Recv() (*PingRequest, error) {
|
||
|
m := new(PingRequest)
|
||
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return m, nil
|
||
|
}
|
||
|
|
||
|
// TestService_ServiceDesc is the grpc.ServiceDesc for TestService service.
|
||
|
// It's only intended for direct use with grpc.RegisterService,
|
||
|
// and not to be introspected or modified (even as a copy)
|
||
|
var TestService_ServiceDesc = grpc.ServiceDesc{
|
||
|
ServiceName: "mwitkow.testproto.TestService",
|
||
|
HandlerType: (*TestServiceServer)(nil),
|
||
|
Methods: []grpc.MethodDesc{
|
||
|
{
|
||
|
MethodName: "PingEmpty",
|
||
|
Handler: _TestService_PingEmpty_Handler,
|
||
|
},
|
||
|
{
|
||
|
MethodName: "Ping",
|
||
|
Handler: _TestService_Ping_Handler,
|
||
|
},
|
||
|
{
|
||
|
MethodName: "PingError",
|
||
|
Handler: _TestService_PingError_Handler,
|
||
|
},
|
||
|
},
|
||
|
Streams: []grpc.StreamDesc{
|
||
|
{
|
||
|
StreamName: "PingList",
|
||
|
Handler: _TestService_PingList_Handler,
|
||
|
ServerStreams: true,
|
||
|
},
|
||
|
{
|
||
|
StreamName: "PingStream",
|
||
|
Handler: _TestService_PingStream_Handler,
|
||
|
ServerStreams: true,
|
||
|
ClientStreams: true,
|
||
|
},
|
||
|
},
|
||
|
Metadata: "test.proto",
|
||
|
}
|