...
1
2
3
4
5
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
17
18
19 const _ = grpc.SupportPackageIsVersion7
20
21
22
23
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
46
47
48 type GreeterServer interface {
49 SayHello(context.Context, *HelloRequest) (*HelloReply, error)
50 }
51
52
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
61
62
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
90
91
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 }
104
View as plain text