github.com/erda-project/erda-infra@v1.0.10-0.20240327085753-f3a249292aeb/examples/service/protocol/pb/greeter_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 // Source: greeter.proto 3 4 package pb 5 6 import ( 7 context "context" 8 9 transport "github.com/erda-project/erda-infra/pkg/transport" 10 grpc1 "github.com/erda-project/erda-infra/pkg/transport/grpc" 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 const _ = grpc.SupportPackageIsVersion5 19 20 // GreeterServiceClient is the client API for GreeterService 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 type GreeterServiceClient interface { 24 // say hello 25 SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) 26 } 27 28 type greeterServiceClient struct { 29 cc grpc1.ClientConnInterface 30 } 31 32 func NewGreeterServiceClient(cc grpc1.ClientConnInterface) GreeterServiceClient { 33 return &greeterServiceClient{cc} 34 } 35 36 func (c *greeterServiceClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) { 37 out := new(HelloResponse) 38 err := c.cc.Invoke(ctx, "/erda.infra.example.GreeterService/SayHello", in, out, opts...) 39 if err != nil { 40 return nil, err 41 } 42 return out, nil 43 } 44 45 // GreeterServiceServer is the server API for GreeterService service. 46 // All implementations should embed UnimplementedGreeterServiceServer 47 // for forward compatibility 48 type GreeterServiceServer interface { 49 // say hello 50 SayHello(context.Context, *HelloRequest) (*HelloResponse, error) 51 } 52 53 // UnimplementedGreeterServiceServer should be embedded to have forward compatible implementations. 54 type UnimplementedGreeterServiceServer struct { 55 } 56 57 func (*UnimplementedGreeterServiceServer) SayHello(context.Context, *HelloRequest) (*HelloResponse, error) { 58 return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented") 59 } 60 61 func RegisterGreeterServiceServer(s grpc1.ServiceRegistrar, srv GreeterServiceServer, opts ...grpc1.HandleOption) { 62 s.RegisterService(_get_GreeterService_serviceDesc(srv, opts...), srv) 63 } 64 65 var _GreeterService_serviceDesc = grpc.ServiceDesc{ 66 ServiceName: "erda.infra.example.GreeterService", 67 HandlerType: (*GreeterServiceServer)(nil), 68 Methods: []grpc.MethodDesc{}, 69 Streams: []grpc.StreamDesc{}, 70 Metadata: "greeter.proto", 71 } 72 73 func _get_GreeterService_serviceDesc(srv GreeterServiceServer, opts ...grpc1.HandleOption) *grpc.ServiceDesc { 74 h := grpc1.DefaultHandleOptions() 75 for _, op := range opts { 76 op(h) 77 } 78 79 _GreeterService_SayHello_Handler := func(ctx context.Context, req interface{}) (interface{}, error) { 80 return srv.SayHello(ctx, req.(*HelloRequest)) 81 } 82 var _GreeterService_SayHello_info transport.ServiceInfo 83 if h.Interceptor != nil { 84 _GreeterService_SayHello_info = transport.NewServiceInfo("erda.infra.example.GreeterService", "SayHello", srv) 85 _GreeterService_SayHello_Handler = h.Interceptor(_GreeterService_SayHello_Handler) 86 } 87 88 var serviceDesc = _GreeterService_serviceDesc 89 serviceDesc.Methods = []grpc.MethodDesc{ 90 { 91 MethodName: "SayHello", 92 Handler: func(_ interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 93 in := new(HelloRequest) 94 if err := dec(in); err != nil { 95 return nil, err 96 } 97 if interceptor == nil && h.Interceptor == nil { 98 return srv.(GreeterServiceServer).SayHello(ctx, in) 99 } 100 if h.Interceptor != nil { 101 ctx = context.WithValue(ctx, transport.ServiceInfoContextKey, _GreeterService_SayHello_info) 102 } 103 if interceptor == nil { 104 return _GreeterService_SayHello_Handler(ctx, in) 105 } 106 info := &grpc.UnaryServerInfo{ 107 Server: srv, 108 FullMethod: "/erda.infra.example.GreeterService/SayHello", 109 } 110 return interceptor(ctx, in, info, _GreeterService_SayHello_Handler) 111 }, 112 }, 113 } 114 return &serviceDesc 115 }