github.com/hoveychen/protoreflect@v1.4.7-0.20221103114119-0b4b3385ec76/internal/testprotos/desc_test_proto3.pb.go (about) 1 // Code generated by protoc-gen-go. DO NOT EDIT. 2 // source: desc_test_proto3.proto 3 4 package testprotos 5 6 import ( 7 context "context" 8 fmt "fmt" 9 proto "github.com/golang/protobuf/proto" 10 pkg "github.com/hoveychen/protoreflect/internal/testprotos/pkg" 11 grpc "google.golang.org/grpc" 12 math "math" 13 ) 14 15 // Reference imports to suppress errors if they are not otherwise used. 16 var _ = proto.Marshal 17 var _ = fmt.Errorf 18 var _ = math.Inf 19 20 // This is a compile-time assertion to ensure that this generated file 21 // is compatible with the proto package it is being compiled against. 22 // A compilation error at this line likely means your copy of the 23 // proto package needs to be updated. 24 const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 25 26 type Proto3Enum int32 27 28 const ( 29 Proto3Enum_UNKNOWN Proto3Enum = 0 30 Proto3Enum_VALUE1 Proto3Enum = 1 31 Proto3Enum_VALUE2 Proto3Enum = 2 32 ) 33 34 var Proto3Enum_name = map[int32]string{ 35 0: "UNKNOWN", 36 1: "VALUE1", 37 2: "VALUE2", 38 } 39 40 var Proto3Enum_value = map[string]int32{ 41 "UNKNOWN": 0, 42 "VALUE1": 1, 43 "VALUE2": 2, 44 } 45 46 func (x Proto3Enum) String() string { 47 return proto.EnumName(Proto3Enum_name, int32(x)) 48 } 49 50 func (Proto3Enum) EnumDescriptor() ([]byte, []int) { 51 return fileDescriptor_9cbf5a38d930f32c, []int{0} 52 } 53 54 type TestRequest struct { 55 Foo []Proto3Enum `protobuf:"varint,1,rep,packed,name=foo,proto3,enum=testprotos.Proto3Enum" json:"foo,omitempty"` 56 Bar string `protobuf:"bytes,2,opt,name=bar,proto3" json:"bar,omitempty"` 57 Baz *TestMessage `protobuf:"bytes,3,opt,name=baz,proto3" json:"baz,omitempty"` 58 Snafu *TestMessage_NestedMessage_AnotherNestedMessage `protobuf:"bytes,4,opt,name=snafu,proto3" json:"snafu,omitempty"` 59 Flags map[string]bool `protobuf:"bytes,5,rep,name=flags,proto3" json:"flags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` 60 XXX_NoUnkeyedLiteral struct{} `json:"-"` 61 XXX_unrecognized []byte `json:"-"` 62 XXX_sizecache int32 `json:"-"` 63 } 64 65 func (m *TestRequest) Reset() { *m = TestRequest{} } 66 func (m *TestRequest) String() string { return proto.CompactTextString(m) } 67 func (*TestRequest) ProtoMessage() {} 68 func (*TestRequest) Descriptor() ([]byte, []int) { 69 return fileDescriptor_9cbf5a38d930f32c, []int{0} 70 } 71 72 func (m *TestRequest) XXX_Unmarshal(b []byte) error { 73 return xxx_messageInfo_TestRequest.Unmarshal(m, b) 74 } 75 func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 76 return xxx_messageInfo_TestRequest.Marshal(b, m, deterministic) 77 } 78 func (m *TestRequest) XXX_Merge(src proto.Message) { 79 xxx_messageInfo_TestRequest.Merge(m, src) 80 } 81 func (m *TestRequest) XXX_Size() int { 82 return xxx_messageInfo_TestRequest.Size(m) 83 } 84 func (m *TestRequest) XXX_DiscardUnknown() { 85 xxx_messageInfo_TestRequest.DiscardUnknown(m) 86 } 87 88 var xxx_messageInfo_TestRequest proto.InternalMessageInfo 89 90 func (m *TestRequest) GetFoo() []Proto3Enum { 91 if m != nil { 92 return m.Foo 93 } 94 return nil 95 } 96 97 func (m *TestRequest) GetBar() string { 98 if m != nil { 99 return m.Bar 100 } 101 return "" 102 } 103 104 func (m *TestRequest) GetBaz() *TestMessage { 105 if m != nil { 106 return m.Baz 107 } 108 return nil 109 } 110 111 func (m *TestRequest) GetSnafu() *TestMessage_NestedMessage_AnotherNestedMessage { 112 if m != nil { 113 return m.Snafu 114 } 115 return nil 116 } 117 118 func (m *TestRequest) GetFlags() map[string]bool { 119 if m != nil { 120 return m.Flags 121 } 122 return nil 123 } 124 125 type TestResponse struct { 126 Atm *AnotherTestMessage `protobuf:"bytes,1,opt,name=atm,proto3" json:"atm,omitempty"` 127 Vs []int32 `protobuf:"varint,2,rep,packed,name=vs,proto3" json:"vs,omitempty"` 128 XXX_NoUnkeyedLiteral struct{} `json:"-"` 129 XXX_unrecognized []byte `json:"-"` 130 XXX_sizecache int32 `json:"-"` 131 } 132 133 func (m *TestResponse) Reset() { *m = TestResponse{} } 134 func (m *TestResponse) String() string { return proto.CompactTextString(m) } 135 func (*TestResponse) ProtoMessage() {} 136 func (*TestResponse) Descriptor() ([]byte, []int) { 137 return fileDescriptor_9cbf5a38d930f32c, []int{1} 138 } 139 140 func (m *TestResponse) XXX_Unmarshal(b []byte) error { 141 return xxx_messageInfo_TestResponse.Unmarshal(m, b) 142 } 143 func (m *TestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 144 return xxx_messageInfo_TestResponse.Marshal(b, m, deterministic) 145 } 146 func (m *TestResponse) XXX_Merge(src proto.Message) { 147 xxx_messageInfo_TestResponse.Merge(m, src) 148 } 149 func (m *TestResponse) XXX_Size() int { 150 return xxx_messageInfo_TestResponse.Size(m) 151 } 152 func (m *TestResponse) XXX_DiscardUnknown() { 153 xxx_messageInfo_TestResponse.DiscardUnknown(m) 154 } 155 156 var xxx_messageInfo_TestResponse proto.InternalMessageInfo 157 158 func (m *TestResponse) GetAtm() *AnotherTestMessage { 159 if m != nil { 160 return m.Atm 161 } 162 return nil 163 } 164 165 func (m *TestResponse) GetVs() []int32 { 166 if m != nil { 167 return m.Vs 168 } 169 return nil 170 } 171 172 func init() { 173 proto.RegisterEnum("testprotos.Proto3Enum", Proto3Enum_name, Proto3Enum_value) 174 proto.RegisterType((*TestRequest)(nil), "testprotos.TestRequest") 175 proto.RegisterMapType((map[string]bool)(nil), "testprotos.TestRequest.FlagsEntry") 176 proto.RegisterType((*TestResponse)(nil), "testprotos.TestResponse") 177 } 178 179 func init() { proto.RegisterFile("desc_test_proto3.proto", fileDescriptor_9cbf5a38d930f32c) } 180 181 var fileDescriptor_9cbf5a38d930f32c = []byte{ 182 // 472 bytes of a gzipped FileDescriptorProto 183 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xc1, 0x6e, 0xd3, 0x40, 184 0x10, 0xc5, 0x36, 0x29, 0x30, 0x46, 0xc5, 0x1a, 0xa1, 0xc6, 0xb2, 0x10, 0x8a, 0x72, 0x32, 0x1c, 185 0x9c, 0xc4, 0xbd, 0x44, 0xbd, 0xa5, 0x6a, 0x72, 0x29, 0x84, 0xc8, 0xa5, 0x20, 0x71, 0xa9, 0x36, 186 0xe9, 0xc4, 0x31, 0xb1, 0xbd, 0x61, 0x77, 0x6d, 0x29, 0xfd, 0x34, 0xc4, 0xc7, 0x21, 0x7b, 0x43, 187 0xe3, 0x82, 0x52, 0x4e, 0xde, 0x9d, 0x7d, 0xf3, 0xe6, 0xbd, 0xb7, 0x6b, 0x38, 0xb9, 0x25, 0xb9, 188 0xb8, 0x51, 0x24, 0xd5, 0xcd, 0x46, 0x70, 0xc5, 0x4f, 0x83, 0xfa, 0x83, 0x50, 0x95, 0xea, 0xa5, 189 0xf4, 0x9c, 0x7b, 0xcc, 0x40, 0x9f, 0x7a, 0xed, 0xcd, 0x3a, 0xee, 0x35, 0x3a, 0xd7, 0xb1, 0x3e, 190 0xe8, 0xfe, 0x34, 0xc1, 0xfe, 0x4c, 0x52, 0x45, 0xf4, 0xa3, 0x20, 0xa9, 0xd0, 0x07, 0x6b, 0xc9, 191 0xb9, 0x6b, 0x74, 0x2c, 0xff, 0x38, 0x3c, 0x09, 0xf6, 0xa4, 0xc1, 0xac, 0x9e, 0x36, 0xce, 0x8b, 192 0x2c, 0xaa, 0x20, 0xe8, 0x80, 0x35, 0x67, 0xc2, 0x35, 0x3b, 0x86, 0xff, 0x22, 0xaa, 0x96, 0xf8, 193 0xae, 0xaa, 0xdc, 0xb9, 0x56, 0xc7, 0xf0, 0xed, 0xb0, 0xdd, 0xec, 0xad, 0x26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x24, 0x8f, 0xb1, 0x7d, 0x20, 0x08, 0xef, 0x4d, 0xf0, 0x7d, 0x55, 0x64, 0x1b, 0xfd, 0x0e, 0x04, 206 0x2d, 0x53, 0x5a, 0xa8, 0xa0, 0x7a, 0x22, 0xc1, 0x39, 0x13, 0x38, 0x81, 0x57, 0x0d, 0x96, 0x71, 207 0x2a, 0x09, 0x0f, 0xdd, 0xa8, 0xe7, 0xfe, 0x3b, 0x42, 0x07, 0xe2, 0x1b, 0x18, 0x81, 0xd3, 0xe0, 208 0x19, 0xc5, 0x2c, 0xc9, 0xf1, 0xd1, 0xc9, 0xde, 0x7f, 0x72, 0xeb, 0x1b, 0x78, 0x09, 0xd8, 0xe0, 209 0x9c, 0x70, 0x41, 0x25, 0x89, 0xc3, 0x46, 0x1f, 0x91, 0xd7, 0x37, 0xce, 0x4f, 0xbf, 0x0d, 0xe2, 210 0x44, 0xad, 0x8a, 0x79, 0xb0, 0xe0, 0x59, 0xaf, 0x16, 0xd6, 0x6b, 0x0a, 0xeb, 0x25, 0xb9, 0x22, 211 0x91, 0xb3, 0xb4, 0xb7, 0x67, 0x99, 0x1f, 0xe9, 0x5f, 0xef, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 212 0xbe, 0x61, 0xdf, 0x72, 0x8d, 0x03, 0x00, 0x00, 213 } 214 215 // Reference imports to suppress errors if they are not otherwise used. 216 var _ context.Context 217 var _ grpc.ClientConn 218 219 // This is a compile-time assertion to ensure that this generated file 220 // is compatible with the grpc package it is being compiled against. 221 const _ = grpc.SupportPackageIsVersion4 222 223 // TestServiceClient is the client API for TestService service. 224 // 225 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 226 type TestServiceClient interface { 227 DoSomething(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*pkg.Bar, error) 228 DoSomethingElse(ctx context.Context, opts ...grpc.CallOption) (TestService_DoSomethingElseClient, error) 229 DoSomethingAgain(ctx context.Context, in *pkg.Bar, opts ...grpc.CallOption) (TestService_DoSomethingAgainClient, error) 230 DoSomethingForever(ctx context.Context, opts ...grpc.CallOption) (TestService_DoSomethingForeverClient, error) 231 } 232 233 type testServiceClient struct { 234 cc *grpc.ClientConn 235 } 236 237 func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient { 238 return &testServiceClient{cc} 239 } 240 241 func (c *testServiceClient) DoSomething(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*pkg.Bar, error) { 242 out := new(pkg.Bar) 243 err := c.cc.Invoke(ctx, "/testprotos.TestService/DoSomething", in, out, opts...) 244 if err != nil { 245 return nil, err 246 } 247 return out, nil 248 } 249 250 func (c *testServiceClient) DoSomethingElse(ctx context.Context, opts ...grpc.CallOption) (TestService_DoSomethingElseClient, error) { 251 stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/testprotos.TestService/DoSomethingElse", opts...) 252 if err != nil { 253 return nil, err 254 } 255 x := &testServiceDoSomethingElseClient{stream} 256 return x, nil 257 } 258 259 type TestService_DoSomethingElseClient interface { 260 Send(*TestMessage) error 261 CloseAndRecv() (*TestResponse, error) 262 grpc.ClientStream 263 } 264 265 type testServiceDoSomethingElseClient struct { 266 grpc.ClientStream 267 } 268 269 func (x *testServiceDoSomethingElseClient) Send(m *TestMessage) error { 270 return x.ClientStream.SendMsg(m) 271 } 272 273 func (x *testServiceDoSomethingElseClient) CloseAndRecv() (*TestResponse, error) { 274 if err := x.ClientStream.CloseSend(); err != nil { 275 return nil, err 276 } 277 m := new(TestResponse) 278 if err := x.ClientStream.RecvMsg(m); err != nil { 279 return nil, err 280 } 281 return m, nil 282 } 283 284 func (c *testServiceClient) DoSomethingAgain(ctx context.Context, in *pkg.Bar, opts ...grpc.CallOption) (TestService_DoSomethingAgainClient, error) { 285 stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/testprotos.TestService/DoSomethingAgain", opts...) 286 if err != nil { 287 return nil, err 288 } 289 x := &testServiceDoSomethingAgainClient{stream} 290 if err := x.ClientStream.SendMsg(in); err != nil { 291 return nil, err 292 } 293 if err := x.ClientStream.CloseSend(); err != nil { 294 return nil, err 295 } 296 return x, nil 297 } 298 299 type TestService_DoSomethingAgainClient interface { 300 Recv() (*AnotherTestMessage, error) 301 grpc.ClientStream 302 } 303 304 type testServiceDoSomethingAgainClient struct { 305 grpc.ClientStream 306 } 307 308 func (x *testServiceDoSomethingAgainClient) Recv() (*AnotherTestMessage, error) { 309 m := new(AnotherTestMessage) 310 if err := x.ClientStream.RecvMsg(m); err != nil { 311 return nil, err 312 } 313 return m, nil 314 } 315 316 func (c *testServiceClient) DoSomethingForever(ctx context.Context, opts ...grpc.CallOption) (TestService_DoSomethingForeverClient, error) { 317 stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/testprotos.TestService/DoSomethingForever", opts...) 318 if err != nil { 319 return nil, err 320 } 321 x := &testServiceDoSomethingForeverClient{stream} 322 return x, nil 323 } 324 325 type TestService_DoSomethingForeverClient interface { 326 Send(*TestRequest) error 327 Recv() (*TestResponse, error) 328 grpc.ClientStream 329 } 330 331 type testServiceDoSomethingForeverClient struct { 332 grpc.ClientStream 333 } 334 335 func (x *testServiceDoSomethingForeverClient) Send(m *TestRequest) error { 336 return x.ClientStream.SendMsg(m) 337 } 338 339 func (x *testServiceDoSomethingForeverClient) Recv() (*TestResponse, error) { 340 m := new(TestResponse) 341 if err := x.ClientStream.RecvMsg(m); err != nil { 342 return nil, err 343 } 344 return m, nil 345 } 346 347 // TestServiceServer is the server API for TestService service. 348 type TestServiceServer interface { 349 DoSomething(context.Context, *TestRequest) (*pkg.Bar, error) 350 DoSomethingElse(TestService_DoSomethingElseServer) error 351 DoSomethingAgain(*pkg.Bar, TestService_DoSomethingAgainServer) error 352 DoSomethingForever(TestService_DoSomethingForeverServer) error 353 } 354 355 func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) { 356 s.RegisterService(&_TestService_serviceDesc, srv) 357 } 358 359 func _TestService_DoSomething_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 360 in := new(TestRequest) 361 if err := dec(in); err != nil { 362 return nil, err 363 } 364 if interceptor == nil { 365 return srv.(TestServiceServer).DoSomething(ctx, in) 366 } 367 info := &grpc.UnaryServerInfo{ 368 Server: srv, 369 FullMethod: "/testprotos.TestService/DoSomething", 370 } 371 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 372 return srv.(TestServiceServer).DoSomething(ctx, req.(*TestRequest)) 373 } 374 return interceptor(ctx, in, info, handler) 375 } 376 377 func _TestService_DoSomethingElse_Handler(srv interface{}, stream grpc.ServerStream) error { 378 return srv.(TestServiceServer).DoSomethingElse(&testServiceDoSomethingElseServer{stream}) 379 } 380 381 type TestService_DoSomethingElseServer interface { 382 SendAndClose(*TestResponse) error 383 Recv() (*TestMessage, error) 384 grpc.ServerStream 385 } 386 387 type testServiceDoSomethingElseServer struct { 388 grpc.ServerStream 389 } 390 391 func (x *testServiceDoSomethingElseServer) SendAndClose(m *TestResponse) error { 392 return x.ServerStream.SendMsg(m) 393 } 394 395 func (x *testServiceDoSomethingElseServer) Recv() (*TestMessage, error) { 396 m := new(TestMessage) 397 if err := x.ServerStream.RecvMsg(m); err != nil { 398 return nil, err 399 } 400 return m, nil 401 } 402 403 func _TestService_DoSomethingAgain_Handler(srv interface{}, stream grpc.ServerStream) error { 404 m := new(pkg.Bar) 405 if err := stream.RecvMsg(m); err != nil { 406 return err 407 } 408 return srv.(TestServiceServer).DoSomethingAgain(m, &testServiceDoSomethingAgainServer{stream}) 409 } 410 411 type TestService_DoSomethingAgainServer interface { 412 Send(*AnotherTestMessage) error 413 grpc.ServerStream 414 } 415 416 type testServiceDoSomethingAgainServer struct { 417 grpc.ServerStream 418 } 419 420 func (x *testServiceDoSomethingAgainServer) Send(m *AnotherTestMessage) error { 421 return x.ServerStream.SendMsg(m) 422 } 423 424 func _TestService_DoSomethingForever_Handler(srv interface{}, stream grpc.ServerStream) error { 425 return srv.(TestServiceServer).DoSomethingForever(&testServiceDoSomethingForeverServer{stream}) 426 } 427 428 type TestService_DoSomethingForeverServer interface { 429 Send(*TestResponse) error 430 Recv() (*TestRequest, error) 431 grpc.ServerStream 432 } 433 434 type testServiceDoSomethingForeverServer struct { 435 grpc.ServerStream 436 } 437 438 func (x *testServiceDoSomethingForeverServer) Send(m *TestResponse) error { 439 return x.ServerStream.SendMsg(m) 440 } 441 442 func (x *testServiceDoSomethingForeverServer) Recv() (*TestRequest, error) { 443 m := new(TestRequest) 444 if err := x.ServerStream.RecvMsg(m); err != nil { 445 return nil, err 446 } 447 return m, nil 448 } 449 450 var _TestService_serviceDesc = grpc.ServiceDesc{ 451 ServiceName: "testprotos.TestService", 452 HandlerType: (*TestServiceServer)(nil), 453 Methods: []grpc.MethodDesc{ 454 { 455 MethodName: "DoSomething", 456 Handler: _TestService_DoSomething_Handler, 457 }, 458 }, 459 Streams: []grpc.StreamDesc{ 460 { 461 StreamName: "DoSomethingElse", 462 Handler: _TestService_DoSomethingElse_Handler, 463 ClientStreams: true, 464 }, 465 { 466 StreamName: "DoSomethingAgain", 467 Handler: _TestService_DoSomethingAgain_Handler, 468 ServerStreams: true, 469 }, 470 { 471 StreamName: "DoSomethingForever", 472 Handler: _TestService_DoSomethingForever_Handler, 473 ServerStreams: true, 474 ClientStreams: true, 475 }, 476 }, 477 Metadata: "desc_test_proto3.proto", 478 }