• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//Generated by gRPC Go plugin
2//If you make any local changes, they will be lost
3//source: greeter
4
5package models
6
7import (
8	context "context"
9	flatbuffers "github.com/google/flatbuffers/go"
10	grpc "google.golang.org/grpc"
11	"google.golang.org/grpc/codes"
12	"google.golang.org/grpc/status"
13)
14
15// Client API for Greeter service
16type GreeterClient interface {
17	SayHello(ctx context.Context, in *flatbuffers.Builder,
18		opts ...grpc.CallOption) (*HelloReply, error)
19	SayManyHellos(ctx context.Context, in *flatbuffers.Builder,
20		opts ...grpc.CallOption) (Greeter_SayManyHellosClient, error)
21}
22
23type greeterClient struct {
24	cc grpc.ClientConnInterface
25}
26
27func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient {
28	return &greeterClient{cc}
29}
30
31func (c *greeterClient) SayHello(ctx context.Context, in *flatbuffers.Builder,
32	opts ...grpc.CallOption) (*HelloReply, error) {
33	out := new(HelloReply)
34	err := c.cc.Invoke(ctx, "/models.Greeter/SayHello", in, out, opts...)
35	if err != nil {
36		return nil, err
37	}
38	return out, nil
39}
40
41func (c *greeterClient) SayManyHellos(ctx context.Context, in *flatbuffers.Builder,
42	opts ...grpc.CallOption) (Greeter_SayManyHellosClient, error) {
43	stream, err := c.cc.NewStream(ctx, &_Greeter_serviceDesc.Streams[0], "/models.Greeter/SayManyHellos", opts...)
44	if err != nil {
45		return nil, err
46	}
47	x := &greeterSayManyHellosClient{stream}
48	if err := x.ClientStream.SendMsg(in); err != nil {
49		return nil, err
50	}
51	if err := x.ClientStream.CloseSend(); err != nil {
52		return nil, err
53	}
54	return x, nil
55}
56
57type Greeter_SayManyHellosClient interface {
58	Recv() (*HelloReply, error)
59	grpc.ClientStream
60}
61
62type greeterSayManyHellosClient struct {
63	grpc.ClientStream
64}
65
66func (x *greeterSayManyHellosClient) Recv() (*HelloReply, error) {
67	m := new(HelloReply)
68	if err := x.ClientStream.RecvMsg(m); err != nil {
69		return nil, err
70	}
71	return m, nil
72}
73
74// Server API for Greeter service
75type GreeterServer interface {
76	SayHello(context.Context, *HelloRequest) (*flatbuffers.Builder, error)
77	SayManyHellos(*HelloRequest, Greeter_SayManyHellosServer) error
78	mustEmbedUnimplementedGreeterServer()
79}
80
81type UnimplementedGreeterServer struct {
82}
83
84func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*flatbuffers.Builder, error) {
85	return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
86}
87
88func (UnimplementedGreeterServer) SayManyHellos(*HelloRequest, Greeter_SayManyHellosServer) error {
89	return status.Errorf(codes.Unimplemented, "method SayManyHellos not implemented")
90}
91
92func (UnimplementedGreeterServer) mustEmbedUnimplementedGreeterServer() {}
93
94type UnsafeGreeterServer interface {
95	mustEmbedUnimplementedGreeterServer()
96}
97
98func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) {
99	s.RegisterService(&_Greeter_serviceDesc, srv)
100}
101
102func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context,
103	dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
104	in := new(HelloRequest)
105	if err := dec(in); err != nil {
106		return nil, err
107	}
108	if interceptor == nil {
109		return srv.(GreeterServer).SayHello(ctx, in)
110	}
111	info := &grpc.UnaryServerInfo{
112		Server:     srv,
113		FullMethod: "/models.Greeter/SayHello",
114	}
115
116	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
117		return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
118	}
119	return interceptor(ctx, in, info, handler)
120}
121func _Greeter_SayManyHellos_Handler(srv interface{}, stream grpc.ServerStream) error {
122	m := new(HelloRequest)
123	if err := stream.RecvMsg(m); err != nil {
124		return err
125	}
126	return srv.(GreeterServer).SayManyHellos(m, &greeterSayManyHellosServer{stream})
127}
128
129type Greeter_SayManyHellosServer interface {
130	Send(*flatbuffers.Builder) error
131	grpc.ServerStream
132}
133
134type greeterSayManyHellosServer struct {
135	grpc.ServerStream
136}
137
138func (x *greeterSayManyHellosServer) Send(m *flatbuffers.Builder) error {
139	return x.ServerStream.SendMsg(m)
140}
141
142var _Greeter_serviceDesc = grpc.ServiceDesc{
143	ServiceName: "models.Greeter",
144	HandlerType: (*GreeterServer)(nil),
145	Methods: []grpc.MethodDesc{
146		{
147			MethodName: "SayHello",
148			Handler:    _Greeter_SayHello_Handler,
149		},
150	},
151	Streams: []grpc.StreamDesc{
152		{
153			StreamName:    "SayManyHellos",
154			Handler:       _Greeter_SayManyHellos_Handler,
155			ServerStreams: true,
156		},
157	},
158}
159