| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
package api |
| 11 |
|
| 12 |
import ( |
| 13 |
context "context" |
| 14 |
grpc "google.golang.org/grpc" |
| 15 |
codes "google.golang.org/grpc/codes" |
| 16 |
status "google.golang.org/grpc/status" |
| 17 |
) |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
const _ = grpc.SupportPackageIsVersion9 |
| 23 |
|
| 24 |
const ( |
| 25 |
HelloService_SayHello_FullMethodName = "/api.HelloService/SayHello" |
| 26 |
HelloService_SayHelloServerStream_FullMethodName = "/api.HelloService/SayHelloServerStream" |
| 27 |
HelloService_SayHelloClientStream_FullMethodName = "/api.HelloService/SayHelloClientStream" |
| 28 |
HelloService_SayHelloBidiStream_FullMethodName = "/api.HelloService/SayHelloBidiStream" |
| 29 |
) |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
type HelloServiceClient interface { |
| 35 |
SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) |
| 36 |
SayHelloServerStream(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[HelloResponse], error) |
| 37 |
SayHelloClientStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[HelloRequest, HelloResponse], error) |
| 38 |
SayHelloBidiStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[HelloRequest, HelloResponse], error) |
| 39 |
} |
| 40 |
|
| 41 |
type helloServiceClient struct { |
| 42 |
cc grpc.ClientConnInterface |
| 43 |
} |
| 44 |
|
| 45 |
func NewHelloServiceClient(cc grpc.ClientConnInterface) HelloServiceClient { |
| 46 |
return &helloServiceClient{cc} |
| 47 |
} |
| 48 |
|
| 49 |
func (c *helloServiceClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) { |
| 50 |
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) |
| 51 |
out := new(HelloResponse) |
| 52 |
err := c.cc.Invoke(ctx, HelloService_SayHello_FullMethodName, in, out, cOpts...) |
| 53 |
if err != nil { |
| 54 |
return nil, err |
| 55 |
} |
| 56 |
return out, nil |
| 57 |
} |
| 58 |
|
| 59 |
func (c *helloServiceClient) SayHelloServerStream(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[HelloResponse], error) { |
| 60 |
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) |
| 61 |
stream, err := c.cc.NewStream(ctx, &HelloService_ServiceDesc.Streams[0], HelloService_SayHelloServerStream_FullMethodName, cOpts...) |
| 62 |
if err != nil { |
| 63 |
return nil, err |
| 64 |
} |
| 65 |
x := &grpc.GenericClientStream[HelloRequest, HelloResponse]{ClientStream: stream} |
| 66 |
if err := x.ClientStream.SendMsg(in); err != nil { |
| 67 |
return nil, err |
| 68 |
} |
| 69 |
if err := x.ClientStream.CloseSend(); err != nil { |
| 70 |
return nil, err |
| 71 |
} |
| 72 |
return x, nil |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
type HelloService_SayHelloServerStreamClient = grpc.ServerStreamingClient[HelloResponse] |
| 77 |
|
| 78 |
func (c *helloServiceClient) SayHelloClientStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[HelloRequest, HelloResponse], error) { |
| 79 |
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) |
| 80 |
stream, err := c.cc.NewStream(ctx, &HelloService_ServiceDesc.Streams[1], HelloService_SayHelloClientStream_FullMethodName, cOpts...) |
| 81 |
if err != nil { |
| 82 |
return nil, err |
| 83 |
} |
| 84 |
x := &grpc.GenericClientStream[HelloRequest, HelloResponse]{ClientStream: stream} |
| 85 |
return x, nil |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
type HelloService_SayHelloClientStreamClient = grpc.ClientStreamingClient[HelloRequest, HelloResponse] |
| 90 |
|
| 91 |
func (c *helloServiceClient) SayHelloBidiStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[HelloRequest, HelloResponse], error) { |
| 92 |
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) |
| 93 |
stream, err := c.cc.NewStream(ctx, &HelloService_ServiceDesc.Streams[2], HelloService_SayHelloBidiStream_FullMethodName, cOpts...) |
| 94 |
if err != nil { |
| 95 |
return nil, err |
| 96 |
} |
| 97 |
x := &grpc.GenericClientStream[HelloRequest, HelloResponse]{ClientStream: stream} |
| 98 |
return x, nil |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
type HelloService_SayHelloBidiStreamClient = grpc.BidiStreamingClient[HelloRequest, HelloResponse] |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
type HelloServiceServer interface { |
| 108 |
SayHello(context.Context, *HelloRequest) (*HelloResponse, error) |
| 109 |
SayHelloServerStream(*HelloRequest, grpc.ServerStreamingServer[HelloResponse]) error |
| 110 |
SayHelloClientStream(grpc.ClientStreamingServer[HelloRequest, HelloResponse]) error |
| 111 |
SayHelloBidiStream(grpc.BidiStreamingServer[HelloRequest, HelloResponse]) error |
| 112 |
mustEmbedUnimplementedHelloServiceServer() |
| 113 |
} |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
type UnimplementedHelloServiceServer struct{} |
| 121 |
|
| 122 |
func (UnimplementedHelloServiceServer) SayHello(context.Context, *HelloRequest) (*HelloResponse, error) { |
| 123 |
return nil, status.Error(codes.Unimplemented, "method SayHello not implemented") |
| 124 |
} |
| 125 |
func (UnimplementedHelloServiceServer) SayHelloServerStream(*HelloRequest, grpc.ServerStreamingServer[HelloResponse]) error { |
| 126 |
return status.Error(codes.Unimplemented, "method SayHelloServerStream not implemented") |
| 127 |
} |
| 128 |
func (UnimplementedHelloServiceServer) SayHelloClientStream(grpc.ClientStreamingServer[HelloRequest, HelloResponse]) error { |
| 129 |
return status.Error(codes.Unimplemented, "method SayHelloClientStream not implemented") |
| 130 |
} |
| 131 |
func (UnimplementedHelloServiceServer) SayHelloBidiStream(grpc.BidiStreamingServer[HelloRequest, HelloResponse]) error { |
| 132 |
return status.Error(codes.Unimplemented, "method SayHelloBidiStream not implemented") |
| 133 |
} |
| 134 |
func (UnimplementedHelloServiceServer) mustEmbedUnimplementedHelloServiceServer() {} |
| 135 |
func (UnimplementedHelloServiceServer) testEmbeddedByValue() {} |
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
type UnsafeHelloServiceServer interface { |
| 141 |
mustEmbedUnimplementedHelloServiceServer() |
| 142 |
} |
| 143 |
|
| 144 |
func RegisterHelloServiceServer(s grpc.ServiceRegistrar, srv HelloServiceServer) { |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { |
| 150 |
t.testEmbeddedByValue() |
| 151 |
} |
| 152 |
s.RegisterService(&HelloService_ServiceDesc, srv) |
| 153 |
} |
| 154 |
|
| 155 |
func _HelloService_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
| 156 |
in := new(HelloRequest) |
| 157 |
if err := dec(in); err != nil { |
| 158 |
return nil, err |
| 159 |
} |
| 160 |
if interceptor == nil { |
| 161 |
return srv.(HelloServiceServer).SayHello(ctx, in) |
| 162 |
} |
| 163 |
info := &grpc.UnaryServerInfo{ |
| 164 |
Server: srv, |
| 165 |
FullMethod: HelloService_SayHello_FullMethodName, |
| 166 |
} |
| 167 |
handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
| 168 |
return srv.(HelloServiceServer).SayHello(ctx, req.(*HelloRequest)) |
| 169 |
} |
| 170 |
return interceptor(ctx, in, info, handler) |
| 171 |
} |
| 172 |
|
| 173 |
func _HelloService_SayHelloServerStream_Handler(srv interface{}, stream grpc.ServerStream) error { |
| 174 |
m := new(HelloRequest) |
| 175 |
if err := stream.RecvMsg(m); err != nil { |
| 176 |
return err |
| 177 |
} |
| 178 |
return srv.(HelloServiceServer).SayHelloServerStream(m, &grpc.GenericServerStream[HelloRequest, HelloResponse]{ServerStream: stream}) |
| 179 |
} |
| 180 |
|
| 181 |
|
| 182 |
type HelloService_SayHelloServerStreamServer = grpc.ServerStreamingServer[HelloResponse] |
| 183 |
|
| 184 |
func _HelloService_SayHelloClientStream_Handler(srv interface{}, stream grpc.ServerStream) error { |
| 185 |
return srv.(HelloServiceServer).SayHelloClientStream(&grpc.GenericServerStream[HelloRequest, HelloResponse]{ServerStream: stream}) |
| 186 |
} |
| 187 |
|
| 188 |
|
| 189 |
type HelloService_SayHelloClientStreamServer = grpc.ClientStreamingServer[HelloRequest, HelloResponse] |
| 190 |
|
| 191 |
func _HelloService_SayHelloBidiStream_Handler(srv interface{}, stream grpc.ServerStream) error { |
| 192 |
return srv.(HelloServiceServer).SayHelloBidiStream(&grpc.GenericServerStream[HelloRequest, HelloResponse]{ServerStream: stream}) |
| 193 |
} |
| 194 |
|
| 195 |
|
| 196 |
type HelloService_SayHelloBidiStreamServer = grpc.BidiStreamingServer[HelloRequest, HelloResponse] |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
var HelloService_ServiceDesc = grpc.ServiceDesc{ |
| 202 |
ServiceName: "api.HelloService", |
| 203 |
HandlerType: (*HelloServiceServer)(nil), |
| 204 |
Methods: []grpc.MethodDesc{ |
| 205 |
{ |
| 206 |
MethodName: "SayHello", |
| 207 |
Handler: _HelloService_SayHello_Handler, |
| 208 |
}, |
| 209 |
}, |
| 210 |
Streams: []grpc.StreamDesc{ |
| 211 |
{ |
| 212 |
StreamName: "SayHelloServerStream", |
| 213 |
Handler: _HelloService_SayHelloServerStream_Handler, |
| 214 |
ServerStreams: true, |
| 215 |
}, |
| 216 |
{ |
| 217 |
StreamName: "SayHelloClientStream", |
| 218 |
Handler: _HelloService_SayHelloClientStream_Handler, |
| 219 |
ClientStreams: true, |
| 220 |
}, |
| 221 |
{ |
| 222 |
StreamName: "SayHelloBidiStream", |
| 223 |
Handler: _HelloService_SayHelloBidiStream_Handler, |
| 224 |
ServerStreams: true, |
| 225 |
ClientStreams: true, |
| 226 |
}, |
| 227 |
}, |
| 228 |
Metadata: "hello-service.proto", |
| 229 |
} |