github.com/grpc-ecosystem/grpc-gateway/v2@v2.19.1/examples/internal/helloworld/helloworld_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 (unknown) 5 // source: examples/internal/helloworld/helloworld.proto 6 7 package helloworld 8 9 import ( 10 context "context" 11 grpc "google.golang.org/grpc" 12 codes "google.golang.org/grpc/codes" 13 status "google.golang.org/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 // GreeterClient is the client API for Greeter 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 GreeterClient interface { 25 SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) 26 } 27 28 type greeterClient struct { 29 cc grpc.ClientConnInterface 30 } 31 32 func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient { 33 return &greeterClient{cc} 34 } 35 36 func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) { 37 out := new(HelloReply) 38 err := c.cc.Invoke(ctx, "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", in, out, opts...) 39 if err != nil { 40 return nil, err 41 } 42 return out, nil 43 } 44 45 // GreeterServer is the server API for Greeter service. 46 // All implementations should embed UnimplementedGreeterServer 47 // for forward compatibility 48 type GreeterServer interface { 49 SayHello(context.Context, *HelloRequest) (*HelloReply, error) 50 } 51 52 // UnimplementedGreeterServer should be embedded to have forward compatible implementations. 53 type UnimplementedGreeterServer struct { 54 } 55 56 func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) { 57 return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented") 58 } 59 60 // UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service. 61 // Use of this interface is not recommended, as added methods to GreeterServer will 62 // result in compilation errors. 63 type UnsafeGreeterServer interface { 64 mustEmbedUnimplementedGreeterServer() 65 } 66 67 func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) { 68 s.RegisterService(&Greeter_ServiceDesc, srv) 69 } 70 71 func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 72 in := new(HelloRequest) 73 if err := dec(in); err != nil { 74 return nil, err 75 } 76 if interceptor == nil { 77 return srv.(GreeterServer).SayHello(ctx, in) 78 } 79 info := &grpc.UnaryServerInfo{ 80 Server: srv, 81 FullMethod: "/grpc.gateway.examples.internal.helloworld.Greeter/SayHello", 82 } 83 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 84 return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest)) 85 } 86 return interceptor(ctx, in, info, handler) 87 } 88 89 // Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. 90 // It's only intended for direct use with grpc.RegisterService, 91 // and not to be introspected or modified (even as a copy) 92 var Greeter_ServiceDesc = grpc.ServiceDesc{ 93 ServiceName: "grpc.gateway.examples.internal.helloworld.Greeter", 94 HandlerType: (*GreeterServer)(nil), 95 Methods: []grpc.MethodDesc{ 96 { 97 MethodName: "SayHello", 98 Handler: _Greeter_SayHello_Handler, 99 }, 100 }, 101 Streams: []grpc.StreamDesc{}, 102 Metadata: "examples/internal/helloworld/helloworld.proto", 103 }