greeter_grpc.pb.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. // versions:
  3. // - protoc-gen-go-grpc v1.5.1
  4. // - protoc v3.20.0--rc1
  5. // source: helloworld/v1/greeter.proto
  6. package v1
  7. import (
  8. context "context"
  9. grpc "google.golang.org/grpc"
  10. codes "google.golang.org/grpc/codes"
  11. status "google.golang.org/grpc/status"
  12. )
  13. // This is a compile-time assertion to ensure that this generated file
  14. // is compatible with the grpc package it is being compiled against.
  15. // Requires gRPC-Go v1.64.0 or later.
  16. const _ = grpc.SupportPackageIsVersion9
  17. const (
  18. Greeter_SayHello_FullMethodName = "/helloworld.v1.Greeter/SayHello"
  19. )
  20. // GreeterClient is the client API for Greeter service.
  21. //
  22. // 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.
  23. //
  24. // The greeting service definition.
  25. type GreeterClient interface {
  26. // Sends a greeting
  27. SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
  28. }
  29. type greeterClient struct {
  30. cc grpc.ClientConnInterface
  31. }
  32. func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient {
  33. return &greeterClient{cc}
  34. }
  35. func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
  36. cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
  37. out := new(HelloReply)
  38. err := c.cc.Invoke(ctx, Greeter_SayHello_FullMethodName, in, out, cOpts...)
  39. if err != nil {
  40. return nil, err
  41. }
  42. return out, nil
  43. }
  44. // GreeterServer is the server API for Greeter service.
  45. // All implementations must embed UnimplementedGreeterServer
  46. // for forward compatibility.
  47. //
  48. // The greeting service definition.
  49. type GreeterServer interface {
  50. // Sends a greeting
  51. SayHello(context.Context, *HelloRequest) (*HelloReply, error)
  52. mustEmbedUnimplementedGreeterServer()
  53. }
  54. // UnimplementedGreeterServer must be embedded to have
  55. // forward compatible implementations.
  56. //
  57. // NOTE: this should be embedded by value instead of pointer to avoid a nil
  58. // pointer dereference when methods are called.
  59. type UnimplementedGreeterServer struct{}
  60. func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) {
  61. return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
  62. }
  63. func (UnimplementedGreeterServer) mustEmbedUnimplementedGreeterServer() {}
  64. func (UnimplementedGreeterServer) testEmbeddedByValue() {}
  65. // UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service.
  66. // Use of this interface is not recommended, as added methods to GreeterServer will
  67. // result in compilation errors.
  68. type UnsafeGreeterServer interface {
  69. mustEmbedUnimplementedGreeterServer()
  70. }
  71. func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) {
  72. // If the following call pancis, it indicates UnimplementedGreeterServer was
  73. // embedded by pointer and is nil. This will cause panics if an
  74. // unimplemented method is ever invoked, so we test this at initialization
  75. // time to prevent it from happening at runtime later due to I/O.
  76. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
  77. t.testEmbeddedByValue()
  78. }
  79. s.RegisterService(&Greeter_ServiceDesc, srv)
  80. }
  81. func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  82. in := new(HelloRequest)
  83. if err := dec(in); err != nil {
  84. return nil, err
  85. }
  86. if interceptor == nil {
  87. return srv.(GreeterServer).SayHello(ctx, in)
  88. }
  89. info := &grpc.UnaryServerInfo{
  90. Server: srv,
  91. FullMethod: Greeter_SayHello_FullMethodName,
  92. }
  93. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  94. return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
  95. }
  96. return interceptor(ctx, in, info, handler)
  97. }
  98. // Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service.
  99. // It's only intended for direct use with grpc.RegisterService,
  100. // and not to be introspected or modified (even as a copy)
  101. var Greeter_ServiceDesc = grpc.ServiceDesc{
  102. ServiceName: "helloworld.v1.Greeter",
  103. HandlerType: (*GreeterServer)(nil),
  104. Methods: []grpc.MethodDesc{
  105. {
  106. MethodName: "SayHello",
  107. Handler: _Greeter_SayHello_Handler,
  108. },
  109. },
  110. Streams: []grpc.StreamDesc{},
  111. Metadata: "helloworld/v1/greeter.proto",
  112. }