/
chat_msg.pb.go
133 lines (106 loc) · 2.84 KB
/
chat_msg.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Code generated by protoc-gen-go.
// source: chat_msg.proto
// DO NOT EDIT!
/*
Package chat_msg is a generated protocol buffer package.
It is generated from these files:
chat_msg.proto
It has these top-level messages:
Msg
*/
package chat_msg
import proto "github.com/golang/protobuf/proto"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
// only support the string for now
type Msg struct {
Content string `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"`
}
func (m *Msg) Reset() { *m = Msg{} }
func (m *Msg) String() string { return proto.CompactTextString(m) }
func (*Msg) ProtoMessage() {}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// Client API for Chat service
type ChatClient interface {
Chat(ctx context.Context, opts ...grpc.CallOption) (Chat_ChatClient, error)
}
type chatClient struct {
cc *grpc.ClientConn
}
func NewChatClient(cc *grpc.ClientConn) ChatClient {
return &chatClient{cc}
}
func (c *chatClient) Chat(ctx context.Context, opts ...grpc.CallOption) (Chat_ChatClient, error) {
stream, err := grpc.NewClientStream(ctx, &_Chat_serviceDesc.Streams[0], c.cc, "/chat_msg.Chat/Chat", opts...)
if err != nil {
return nil, err
}
x := &chatChatClient{stream}
return x, nil
}
type Chat_ChatClient interface {
Send(*Msg) error
Recv() (*Msg, error)
grpc.ClientStream
}
type chatChatClient struct {
grpc.ClientStream
}
func (x *chatChatClient) Send(m *Msg) error {
return x.ClientStream.SendMsg(m)
}
func (x *chatChatClient) Recv() (*Msg, error) {
m := new(Msg)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Server API for Chat service
type ChatServer interface {
Chat(Chat_ChatServer) error
}
func RegisterChatServer(s *grpc.Server, srv ChatServer) {
s.RegisterService(&_Chat_serviceDesc, srv)
}
func _Chat_Chat_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(ChatServer).Chat(&chatChatServer{stream})
}
type Chat_ChatServer interface {
Send(*Msg) error
Recv() (*Msg, error)
grpc.ServerStream
}
type chatChatServer struct {
grpc.ServerStream
}
func (x *chatChatServer) Send(m *Msg) error {
return x.ServerStream.SendMsg(m)
}
func (x *chatChatServer) Recv() (*Msg, error) {
m := new(Msg)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
var _Chat_serviceDesc = grpc.ServiceDesc{
ServiceName: "chat_msg.Chat",
HandlerType: (*ChatServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "Chat",
Handler: _Chat_Chat_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
}