github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go (about) 1 // Code generated by protoc-gen-go. 2 // source: my_test/test.proto 3 // DO NOT EDIT! 4 5 /* 6 Package my_test is a generated protocol buffer package. 7 8 This package holds interesting messages. 9 10 It is generated from these files: 11 my_test/test.proto 12 13 It has these top-level messages: 14 Request 15 Reply 16 OtherBase 17 ReplyExtensions 18 OtherReplyExtensions 19 OldReply 20 Communique 21 */ 22 package my_test 23 24 import proto "github.com/insionng/yougam/libraries/golang/protobuf/proto" 25 import fmt "fmt" 26 import math "math" 27 import _ "github.com/insionng/yougam/libraries/golang/protobuf/protoc-gen-go/testdata/multi" 28 29 // Reference imports to suppress errors if they are not otherwise used. 30 var _ = proto.Marshal 31 var _ = fmt.Errorf 32 var _ = math.Inf 33 34 // This is a compile-time assertion to ensure that this generated file 35 // is compatible with the proto package it is being compiled against. 36 const _ = proto.ProtoPackageIsVersion1 37 38 type HatType int32 39 40 const ( 41 // deliberately skipping 0 42 HatType_FEDORA HatType = 1 43 HatType_FEZ HatType = 2 44 ) 45 46 var HatType_name = map[int32]string{ 47 1: "FEDORA", 48 2: "FEZ", 49 } 50 var HatType_value = map[string]int32{ 51 "FEDORA": 1, 52 "FEZ": 2, 53 } 54 55 func (x HatType) Enum() *HatType { 56 p := new(HatType) 57 *p = x 58 return p 59 } 60 func (x HatType) String() string { 61 return proto.EnumName(HatType_name, int32(x)) 62 } 63 func (x *HatType) UnmarshalJSON(data []byte) error { 64 value, err := proto.UnmarshalJSONEnum(HatType_value, data, "HatType") 65 if err != nil { 66 return err 67 } 68 *x = HatType(value) 69 return nil 70 } 71 72 // This enum represents days of the week. 73 type Days int32 74 75 const ( 76 Days_MONDAY Days = 1 77 Days_TUESDAY Days = 2 78 Days_LUNDI Days = 1 79 ) 80 81 var Days_name = map[int32]string{ 82 1: "MONDAY", 83 2: "TUESDAY", 84 // Duplicate value: 1: "LUNDI", 85 } 86 var Days_value = map[string]int32{ 87 "MONDAY": 1, 88 "TUESDAY": 2, 89 "LUNDI": 1, 90 } 91 92 func (x Days) Enum() *Days { 93 p := new(Days) 94 *p = x 95 return p 96 } 97 func (x Days) String() string { 98 return proto.EnumName(Days_name, int32(x)) 99 } 100 func (x *Days) UnmarshalJSON(data []byte) error { 101 value, err := proto.UnmarshalJSONEnum(Days_value, data, "Days") 102 if err != nil { 103 return err 104 } 105 *x = Days(value) 106 return nil 107 } 108 109 type Request_Color int32 110 111 const ( 112 Request_RED Request_Color = 0 113 Request_GREEN Request_Color = 1 114 Request_BLUE Request_Color = 2 115 ) 116 117 var Request_Color_name = map[int32]string{ 118 0: "RED", 119 1: "GREEN", 120 2: "BLUE", 121 } 122 var Request_Color_value = map[string]int32{ 123 "RED": 0, 124 "GREEN": 1, 125 "BLUE": 2, 126 } 127 128 func (x Request_Color) Enum() *Request_Color { 129 p := new(Request_Color) 130 *p = x 131 return p 132 } 133 func (x Request_Color) String() string { 134 return proto.EnumName(Request_Color_name, int32(x)) 135 } 136 func (x *Request_Color) UnmarshalJSON(data []byte) error { 137 value, err := proto.UnmarshalJSONEnum(Request_Color_value, data, "Request_Color") 138 if err != nil { 139 return err 140 } 141 *x = Request_Color(value) 142 return nil 143 } 144 145 type Reply_Entry_Game int32 146 147 const ( 148 Reply_Entry_FOOTBALL Reply_Entry_Game = 1 149 Reply_Entry_TENNIS Reply_Entry_Game = 2 150 ) 151 152 var Reply_Entry_Game_name = map[int32]string{ 153 1: "FOOTBALL", 154 2: "TENNIS", 155 } 156 var Reply_Entry_Game_value = map[string]int32{ 157 "FOOTBALL": 1, 158 "TENNIS": 2, 159 } 160 161 func (x Reply_Entry_Game) Enum() *Reply_Entry_Game { 162 p := new(Reply_Entry_Game) 163 *p = x 164 return p 165 } 166 func (x Reply_Entry_Game) String() string { 167 return proto.EnumName(Reply_Entry_Game_name, int32(x)) 168 } 169 func (x *Reply_Entry_Game) UnmarshalJSON(data []byte) error { 170 value, err := proto.UnmarshalJSONEnum(Reply_Entry_Game_value, data, "Reply_Entry_Game") 171 if err != nil { 172 return err 173 } 174 *x = Reply_Entry_Game(value) 175 return nil 176 } 177 178 // This is a message that might be sent somewhere. 179 type Request struct { 180 Key []int64 `protobuf:"varint,1,rep,name=key" json:"key,omitempty"` 181 // optional imp.ImportedMessage imported_message = 2; 182 Hue *Request_Color `protobuf:"varint,3,opt,name=hue,enum=my.test.Request_Color" json:"hue,omitempty"` 183 Hat *HatType `protobuf:"varint,4,opt,name=hat,enum=my.test.HatType,def=1" json:"hat,omitempty"` 184 // optional imp.ImportedMessage.Owner owner = 6; 185 Deadline *float32 `protobuf:"fixed32,7,opt,name=deadline,def=inf" json:"deadline,omitempty"` 186 Somegroup *Request_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty"` 187 // This is a map field. It will generate map[int32]string. 188 NameMapping map[int32]string `protobuf:"bytes,14,rep,name=name_mapping,json=nameMapping" json:"name_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` 189 // This is a map field whose value type is a message. 190 MsgMapping map[int64]*Reply `protobuf:"bytes,15,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` 191 Reset_ *int32 `protobuf:"varint,12,opt,name=reset" json:"reset,omitempty"` 192 // This field should not conflict with any getters. 193 GetKey_ *string `protobuf:"bytes,16,opt,name=get_key,json=getKey" json:"get_key,omitempty"` 194 XXX_unrecognized []byte `json:"-"` 195 } 196 197 func (m *Request) Reset() { *m = Request{} } 198 func (m *Request) String() string { return proto.CompactTextString(m) } 199 func (*Request) ProtoMessage() {} 200 201 const Default_Request_Hat HatType = HatType_FEDORA 202 203 var Default_Request_Deadline float32 = float32(math.Inf(1)) 204 205 func (m *Request) GetKey() []int64 { 206 if m != nil { 207 return m.Key 208 } 209 return nil 210 } 211 212 func (m *Request) GetHue() Request_Color { 213 if m != nil && m.Hue != nil { 214 return *m.Hue 215 } 216 return Request_RED 217 } 218 219 func (m *Request) GetHat() HatType { 220 if m != nil && m.Hat != nil { 221 return *m.Hat 222 } 223 return Default_Request_Hat 224 } 225 226 func (m *Request) GetDeadline() float32 { 227 if m != nil && m.Deadline != nil { 228 return *m.Deadline 229 } 230 return Default_Request_Deadline 231 } 232 233 func (m *Request) GetSomegroup() *Request_SomeGroup { 234 if m != nil { 235 return m.Somegroup 236 } 237 return nil 238 } 239 240 func (m *Request) GetNameMapping() map[int32]string { 241 if m != nil { 242 return m.NameMapping 243 } 244 return nil 245 } 246 247 func (m *Request) GetMsgMapping() map[int64]*Reply { 248 if m != nil { 249 return m.MsgMapping 250 } 251 return nil 252 } 253 254 func (m *Request) GetReset_() int32 { 255 if m != nil && m.Reset_ != nil { 256 return *m.Reset_ 257 } 258 return 0 259 } 260 261 func (m *Request) GetGetKey_() string { 262 if m != nil && m.GetKey_ != nil { 263 return *m.GetKey_ 264 } 265 return "" 266 } 267 268 type Request_SomeGroup struct { 269 GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty"` 270 XXX_unrecognized []byte `json:"-"` 271 } 272 273 func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} } 274 func (m *Request_SomeGroup) String() string { return proto.CompactTextString(m) } 275 func (*Request_SomeGroup) ProtoMessage() {} 276 277 func (m *Request_SomeGroup) GetGroupField() int32 { 278 if m != nil && m.GroupField != nil { 279 return *m.GroupField 280 } 281 return 0 282 } 283 284 type Reply struct { 285 Found []*Reply_Entry `protobuf:"bytes,1,rep,name=found" json:"found,omitempty"` 286 CompactKeys []int32 `protobuf:"varint,2,rep,packed,name=compact_keys,json=compactKeys" json:"compact_keys,omitempty"` 287 XXX_extensions map[int32]proto.Extension `json:"-"` 288 XXX_unrecognized []byte `json:"-"` 289 } 290 291 func (m *Reply) Reset() { *m = Reply{} } 292 func (m *Reply) String() string { return proto.CompactTextString(m) } 293 func (*Reply) ProtoMessage() {} 294 295 var extRange_Reply = []proto.ExtensionRange{ 296 {100, 536870911}, 297 } 298 299 func (*Reply) ExtensionRangeArray() []proto.ExtensionRange { 300 return extRange_Reply 301 } 302 func (m *Reply) ExtensionMap() map[int32]proto.Extension { 303 if m.XXX_extensions == nil { 304 m.XXX_extensions = make(map[int32]proto.Extension) 305 } 306 return m.XXX_extensions 307 } 308 309 func (m *Reply) GetFound() []*Reply_Entry { 310 if m != nil { 311 return m.Found 312 } 313 return nil 314 } 315 316 func (m *Reply) GetCompactKeys() []int32 { 317 if m != nil { 318 return m.CompactKeys 319 } 320 return nil 321 } 322 323 type Reply_Entry struct { 324 KeyThatNeeds_1234Camel_CasIng *int64 `protobuf:"varint,1,req,name=key_that_needs_1234camel_CasIng,json=keyThatNeeds1234camelCasIng" json:"key_that_needs_1234camel_CasIng,omitempty"` 325 Value *int64 `protobuf:"varint,2,opt,name=value,def=7" json:"value,omitempty"` 326 XMyFieldName_2 *int64 `protobuf:"varint,3,opt,name=_my_field_name_2,json=myFieldName2" json:"_my_field_name_2,omitempty"` 327 XXX_unrecognized []byte `json:"-"` 328 } 329 330 func (m *Reply_Entry) Reset() { *m = Reply_Entry{} } 331 func (m *Reply_Entry) String() string { return proto.CompactTextString(m) } 332 func (*Reply_Entry) ProtoMessage() {} 333 334 const Default_Reply_Entry_Value int64 = 7 335 336 func (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 { 337 if m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil { 338 return *m.KeyThatNeeds_1234Camel_CasIng 339 } 340 return 0 341 } 342 343 func (m *Reply_Entry) GetValue() int64 { 344 if m != nil && m.Value != nil { 345 return *m.Value 346 } 347 return Default_Reply_Entry_Value 348 } 349 350 func (m *Reply_Entry) GetXMyFieldName_2() int64 { 351 if m != nil && m.XMyFieldName_2 != nil { 352 return *m.XMyFieldName_2 353 } 354 return 0 355 } 356 357 type OtherBase struct { 358 Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` 359 XXX_extensions map[int32]proto.Extension `json:"-"` 360 XXX_unrecognized []byte `json:"-"` 361 } 362 363 func (m *OtherBase) Reset() { *m = OtherBase{} } 364 func (m *OtherBase) String() string { return proto.CompactTextString(m) } 365 func (*OtherBase) ProtoMessage() {} 366 367 var extRange_OtherBase = []proto.ExtensionRange{ 368 {100, 536870911}, 369 } 370 371 func (*OtherBase) ExtensionRangeArray() []proto.ExtensionRange { 372 return extRange_OtherBase 373 } 374 func (m *OtherBase) ExtensionMap() map[int32]proto.Extension { 375 if m.XXX_extensions == nil { 376 m.XXX_extensions = make(map[int32]proto.Extension) 377 } 378 return m.XXX_extensions 379 } 380 381 func (m *OtherBase) GetName() string { 382 if m != nil && m.Name != nil { 383 return *m.Name 384 } 385 return "" 386 } 387 388 type ReplyExtensions struct { 389 XXX_unrecognized []byte `json:"-"` 390 } 391 392 func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} } 393 func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) } 394 func (*ReplyExtensions) ProtoMessage() {} 395 396 var E_ReplyExtensions_Time = &proto.ExtensionDesc{ 397 ExtendedType: (*Reply)(nil), 398 ExtensionType: (*float64)(nil), 399 Field: 101, 400 Name: "my.test.ReplyExtensions.time", 401 Tag: "fixed64,101,opt,name=time", 402 } 403 404 var E_ReplyExtensions_Carrot = &proto.ExtensionDesc{ 405 ExtendedType: (*Reply)(nil), 406 ExtensionType: (*ReplyExtensions)(nil), 407 Field: 105, 408 Name: "my.test.ReplyExtensions.carrot", 409 Tag: "bytes,105,opt,name=carrot", 410 } 411 412 var E_ReplyExtensions_Donut = &proto.ExtensionDesc{ 413 ExtendedType: (*OtherBase)(nil), 414 ExtensionType: (*ReplyExtensions)(nil), 415 Field: 101, 416 Name: "my.test.ReplyExtensions.donut", 417 Tag: "bytes,101,opt,name=donut", 418 } 419 420 type OtherReplyExtensions struct { 421 Key *int32 `protobuf:"varint,1,opt,name=key" json:"key,omitempty"` 422 XXX_unrecognized []byte `json:"-"` 423 } 424 425 func (m *OtherReplyExtensions) Reset() { *m = OtherReplyExtensions{} } 426 func (m *OtherReplyExtensions) String() string { return proto.CompactTextString(m) } 427 func (*OtherReplyExtensions) ProtoMessage() {} 428 429 func (m *OtherReplyExtensions) GetKey() int32 { 430 if m != nil && m.Key != nil { 431 return *m.Key 432 } 433 return 0 434 } 435 436 type OldReply struct { 437 XXX_extensions map[int32]proto.Extension `json:"-"` 438 XXX_unrecognized []byte `json:"-"` 439 } 440 441 func (m *OldReply) Reset() { *m = OldReply{} } 442 func (m *OldReply) String() string { return proto.CompactTextString(m) } 443 func (*OldReply) ProtoMessage() {} 444 445 func (m *OldReply) Marshal() ([]byte, error) { 446 return proto.MarshalMessageSet(m.ExtensionMap()) 447 } 448 func (m *OldReply) Unmarshal(buf []byte) error { 449 return proto.UnmarshalMessageSet(buf, m.ExtensionMap()) 450 } 451 func (m *OldReply) MarshalJSON() ([]byte, error) { 452 return proto.MarshalMessageSetJSON(m.XXX_extensions) 453 } 454 func (m *OldReply) UnmarshalJSON(buf []byte) error { 455 return proto.UnmarshalMessageSetJSON(buf, m.XXX_extensions) 456 } 457 458 // ensure OldReply satisfies proto.Marshaler and proto.Unmarshaler 459 var _ proto.Marshaler = (*OldReply)(nil) 460 var _ proto.Unmarshaler = (*OldReply)(nil) 461 462 var extRange_OldReply = []proto.ExtensionRange{ 463 {100, 2147483646}, 464 } 465 466 func (*OldReply) ExtensionRangeArray() []proto.ExtensionRange { 467 return extRange_OldReply 468 } 469 func (m *OldReply) ExtensionMap() map[int32]proto.Extension { 470 if m.XXX_extensions == nil { 471 m.XXX_extensions = make(map[int32]proto.Extension) 472 } 473 return m.XXX_extensions 474 } 475 476 type Communique struct { 477 MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty"` 478 // This is a oneof, called "union". 479 // 480 // Types that are valid to be assigned to Union: 481 // *Communique_Number 482 // *Communique_Name 483 // *Communique_Data 484 // *Communique_TempC 485 // *Communique_Height 486 // *Communique_Today 487 // *Communique_Maybe 488 // *Communique_Delta_ 489 // *Communique_Msg 490 // *Communique_Somegroup 491 Union isCommunique_Union `protobuf_oneof:"union"` 492 XXX_unrecognized []byte `json:"-"` 493 } 494 495 func (m *Communique) Reset() { *m = Communique{} } 496 func (m *Communique) String() string { return proto.CompactTextString(m) } 497 func (*Communique) ProtoMessage() {} 498 499 type isCommunique_Union interface { 500 isCommunique_Union() 501 } 502 503 type Communique_Number struct { 504 Number int32 `protobuf:"varint,5,opt,name=number,oneof"` 505 } 506 type Communique_Name struct { 507 Name string `protobuf:"bytes,6,opt,name=name,oneof"` 508 } 509 type Communique_Data struct { 510 Data []byte `protobuf:"bytes,7,opt,name=data,oneof"` 511 } 512 type Communique_TempC struct { 513 TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"` 514 } 515 type Communique_Height struct { 516 Height float32 `protobuf:"fixed32,9,opt,name=height,oneof"` 517 } 518 type Communique_Today struct { 519 Today Days `protobuf:"varint,10,opt,name=today,enum=my.test.Days,oneof"` 520 } 521 type Communique_Maybe struct { 522 Maybe bool `protobuf:"varint,11,opt,name=maybe,oneof"` 523 } 524 type Communique_Delta_ struct { 525 Delta int32 `protobuf:"zigzag32,12,opt,name=delta,oneof"` 526 } 527 type Communique_Msg struct { 528 Msg *Reply `protobuf:"bytes,13,opt,name=msg,oneof"` 529 } 530 type Communique_Somegroup struct { 531 Somegroup *Communique_SomeGroup `protobuf:"group,14,opt,name=SomeGroup,json=somegroup,oneof"` 532 } 533 534 func (*Communique_Number) isCommunique_Union() {} 535 func (*Communique_Name) isCommunique_Union() {} 536 func (*Communique_Data) isCommunique_Union() {} 537 func (*Communique_TempC) isCommunique_Union() {} 538 func (*Communique_Height) isCommunique_Union() {} 539 func (*Communique_Today) isCommunique_Union() {} 540 func (*Communique_Maybe) isCommunique_Union() {} 541 func (*Communique_Delta_) isCommunique_Union() {} 542 func (*Communique_Msg) isCommunique_Union() {} 543 func (*Communique_Somegroup) isCommunique_Union() {} 544 545 func (m *Communique) GetUnion() isCommunique_Union { 546 if m != nil { 547 return m.Union 548 } 549 return nil 550 } 551 552 func (m *Communique) GetMakeMeCry() bool { 553 if m != nil && m.MakeMeCry != nil { 554 return *m.MakeMeCry 555 } 556 return false 557 } 558 559 func (m *Communique) GetNumber() int32 { 560 if x, ok := m.GetUnion().(*Communique_Number); ok { 561 return x.Number 562 } 563 return 0 564 } 565 566 func (m *Communique) GetName() string { 567 if x, ok := m.GetUnion().(*Communique_Name); ok { 568 return x.Name 569 } 570 return "" 571 } 572 573 func (m *Communique) GetData() []byte { 574 if x, ok := m.GetUnion().(*Communique_Data); ok { 575 return x.Data 576 } 577 return nil 578 } 579 580 func (m *Communique) GetTempC() float64 { 581 if x, ok := m.GetUnion().(*Communique_TempC); ok { 582 return x.TempC 583 } 584 return 0 585 } 586 587 func (m *Communique) GetHeight() float32 { 588 if x, ok := m.GetUnion().(*Communique_Height); ok { 589 return x.Height 590 } 591 return 0 592 } 593 594 func (m *Communique) GetToday() Days { 595 if x, ok := m.GetUnion().(*Communique_Today); ok { 596 return x.Today 597 } 598 return Days_MONDAY 599 } 600 601 func (m *Communique) GetMaybe() bool { 602 if x, ok := m.GetUnion().(*Communique_Maybe); ok { 603 return x.Maybe 604 } 605 return false 606 } 607 608 func (m *Communique) GetDelta() int32 { 609 if x, ok := m.GetUnion().(*Communique_Delta_); ok { 610 return x.Delta 611 } 612 return 0 613 } 614 615 func (m *Communique) GetMsg() *Reply { 616 if x, ok := m.GetUnion().(*Communique_Msg); ok { 617 return x.Msg 618 } 619 return nil 620 } 621 622 func (m *Communique) GetSomegroup() *Communique_SomeGroup { 623 if x, ok := m.GetUnion().(*Communique_Somegroup); ok { 624 return x.Somegroup 625 } 626 return nil 627 } 628 629 // XXX_OneofFuncs is for the internal use of the proto package. 630 func (*Communique) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { 631 return _Communique_OneofMarshaler, _Communique_OneofUnmarshaler, _Communique_OneofSizer, []interface{}{ 632 (*Communique_Number)(nil), 633 (*Communique_Name)(nil), 634 (*Communique_Data)(nil), 635 (*Communique_TempC)(nil), 636 (*Communique_Height)(nil), 637 (*Communique_Today)(nil), 638 (*Communique_Maybe)(nil), 639 (*Communique_Delta_)(nil), 640 (*Communique_Msg)(nil), 641 (*Communique_Somegroup)(nil), 642 } 643 } 644 645 func _Communique_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { 646 m := msg.(*Communique) 647 // union 648 switch x := m.Union.(type) { 649 case *Communique_Number: 650 b.EncodeVarint(5<<3 | proto.WireVarint) 651 b.EncodeVarint(uint64(x.Number)) 652 case *Communique_Name: 653 b.EncodeVarint(6<<3 | proto.WireBytes) 654 b.EncodeStringBytes(x.Name) 655 case *Communique_Data: 656 b.EncodeVarint(7<<3 | proto.WireBytes) 657 b.EncodeRawBytes(x.Data) 658 case *Communique_TempC: 659 b.EncodeVarint(8<<3 | proto.WireFixed64) 660 b.EncodeFixed64(math.Float64bits(x.TempC)) 661 case *Communique_Height: 662 b.EncodeVarint(9<<3 | proto.WireFixed32) 663 b.EncodeFixed32(uint64(math.Float32bits(x.Height))) 664 case *Communique_Today: 665 b.EncodeVarint(10<<3 | proto.WireVarint) 666 b.EncodeVarint(uint64(x.Today)) 667 case *Communique_Maybe: 668 t := uint64(0) 669 if x.Maybe { 670 t = 1 671 } 672 b.EncodeVarint(11<<3 | proto.WireVarint) 673 b.EncodeVarint(t) 674 case *Communique_Delta_: 675 b.EncodeVarint(12<<3 | proto.WireVarint) 676 b.EncodeZigzag32(uint64(x.Delta)) 677 case *Communique_Msg: 678 b.EncodeVarint(13<<3 | proto.WireBytes) 679 if err := b.EncodeMessage(x.Msg); err != nil { 680 return err 681 } 682 case *Communique_Somegroup: 683 b.EncodeVarint(14<<3 | proto.WireStartGroup) 684 if err := b.Marshal(x.Somegroup); err != nil { 685 return err 686 } 687 b.EncodeVarint(14<<3 | proto.WireEndGroup) 688 case nil: 689 default: 690 return fmt.Errorf("Communique.Union has unexpected type %T", x) 691 } 692 return nil 693 } 694 695 func _Communique_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { 696 m := msg.(*Communique) 697 switch tag { 698 case 5: // union.number 699 if wire != proto.WireVarint { 700 return true, proto.ErrInternalBadWireType 701 } 702 x, err := b.DecodeVarint() 703 m.Union = &Communique_Number{int32(x)} 704 return true, err 705 case 6: // union.name 706 if wire != proto.WireBytes { 707 return true, proto.ErrInternalBadWireType 708 } 709 x, err := b.DecodeStringBytes() 710 m.Union = &Communique_Name{x} 711 return true, err 712 case 7: // union.data 713 if wire != proto.WireBytes { 714 return true, proto.ErrInternalBadWireType 715 } 716 x, err := b.DecodeRawBytes(true) 717 m.Union = &Communique_Data{x} 718 return true, err 719 case 8: // union.temp_c 720 if wire != proto.WireFixed64 { 721 return true, proto.ErrInternalBadWireType 722 } 723 x, err := b.DecodeFixed64() 724 m.Union = &Communique_TempC{math.Float64frombits(x)} 725 return true, err 726 case 9: // union.height 727 if wire != proto.WireFixed32 { 728 return true, proto.ErrInternalBadWireType 729 } 730 x, err := b.DecodeFixed32() 731 m.Union = &Communique_Height{math.Float32frombits(uint32(x))} 732 return true, err 733 case 10: // union.today 734 if wire != proto.WireVarint { 735 return true, proto.ErrInternalBadWireType 736 } 737 x, err := b.DecodeVarint() 738 m.Union = &Communique_Today{Days(x)} 739 return true, err 740 case 11: // union.maybe 741 if wire != proto.WireVarint { 742 return true, proto.ErrInternalBadWireType 743 } 744 x, err := b.DecodeVarint() 745 m.Union = &Communique_Maybe{x != 0} 746 return true, err 747 case 12: // union.delta 748 if wire != proto.WireVarint { 749 return true, proto.ErrInternalBadWireType 750 } 751 x, err := b.DecodeZigzag32() 752 m.Union = &Communique_Delta_{int32(x)} 753 return true, err 754 case 13: // union.msg 755 if wire != proto.WireBytes { 756 return true, proto.ErrInternalBadWireType 757 } 758 msg := new(Reply) 759 err := b.DecodeMessage(msg) 760 m.Union = &Communique_Msg{msg} 761 return true, err 762 case 14: // union.somegroup 763 if wire != proto.WireStartGroup { 764 return true, proto.ErrInternalBadWireType 765 } 766 msg := new(Communique_SomeGroup) 767 err := b.DecodeGroup(msg) 768 m.Union = &Communique_Somegroup{msg} 769 return true, err 770 default: 771 return false, nil 772 } 773 } 774 775 func _Communique_OneofSizer(msg proto.Message) (n int) { 776 m := msg.(*Communique) 777 // union 778 switch x := m.Union.(type) { 779 case *Communique_Number: 780 n += proto.SizeVarint(5<<3 | proto.WireVarint) 781 n += proto.SizeVarint(uint64(x.Number)) 782 case *Communique_Name: 783 n += proto.SizeVarint(6<<3 | proto.WireBytes) 784 n += proto.SizeVarint(uint64(len(x.Name))) 785 n += len(x.Name) 786 case *Communique_Data: 787 n += proto.SizeVarint(7<<3 | proto.WireBytes) 788 n += proto.SizeVarint(uint64(len(x.Data))) 789 n += len(x.Data) 790 case *Communique_TempC: 791 n += proto.SizeVarint(8<<3 | proto.WireFixed64) 792 n += 8 793 case *Communique_Height: 794 n += proto.SizeVarint(9<<3 | proto.WireFixed32) 795 n += 4 796 case *Communique_Today: 797 n += proto.SizeVarint(10<<3 | proto.WireVarint) 798 n += proto.SizeVarint(uint64(x.Today)) 799 case *Communique_Maybe: 800 n += proto.SizeVarint(11<<3 | proto.WireVarint) 801 n += 1 802 case *Communique_Delta_: 803 n += proto.SizeVarint(12<<3 | proto.WireVarint) 804 n += proto.SizeVarint(uint64((uint32(x.Delta) << 1) ^ uint32((int32(x.Delta) >> 31)))) 805 case *Communique_Msg: 806 s := proto.Size(x.Msg) 807 n += proto.SizeVarint(13<<3 | proto.WireBytes) 808 n += proto.SizeVarint(uint64(s)) 809 n += s 810 case *Communique_Somegroup: 811 n += proto.SizeVarint(14<<3 | proto.WireStartGroup) 812 n += proto.Size(x.Somegroup) 813 n += proto.SizeVarint(14<<3 | proto.WireEndGroup) 814 case nil: 815 default: 816 panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) 817 } 818 return n 819 } 820 821 type Communique_SomeGroup struct { 822 Member *string `protobuf:"bytes,15,opt,name=member" json:"member,omitempty"` 823 XXX_unrecognized []byte `json:"-"` 824 } 825 826 func (m *Communique_SomeGroup) Reset() { *m = Communique_SomeGroup{} } 827 func (m *Communique_SomeGroup) String() string { return proto.CompactTextString(m) } 828 func (*Communique_SomeGroup) ProtoMessage() {} 829 830 func (m *Communique_SomeGroup) GetMember() string { 831 if m != nil && m.Member != nil { 832 return *m.Member 833 } 834 return "" 835 } 836 837 type Communique_Delta struct { 838 XXX_unrecognized []byte `json:"-"` 839 } 840 841 func (m *Communique_Delta) Reset() { *m = Communique_Delta{} } 842 func (m *Communique_Delta) String() string { return proto.CompactTextString(m) } 843 func (*Communique_Delta) ProtoMessage() {} 844 845 var E_Tag = &proto.ExtensionDesc{ 846 ExtendedType: (*Reply)(nil), 847 ExtensionType: (*string)(nil), 848 Field: 103, 849 Name: "my.test.tag", 850 Tag: "bytes,103,opt,name=tag", 851 } 852 853 var E_Donut = &proto.ExtensionDesc{ 854 ExtendedType: (*Reply)(nil), 855 ExtensionType: (*OtherReplyExtensions)(nil), 856 Field: 106, 857 Name: "my.test.donut", 858 Tag: "bytes,106,opt,name=donut", 859 } 860 861 func init() { 862 proto.RegisterType((*Request)(nil), "my.test.Request") 863 proto.RegisterType((*Request_SomeGroup)(nil), "my.test.Request.SomeGroup") 864 proto.RegisterType((*Reply)(nil), "my.test.Reply") 865 proto.RegisterType((*Reply_Entry)(nil), "my.test.Reply.Entry") 866 proto.RegisterType((*OtherBase)(nil), "my.test.OtherBase") 867 proto.RegisterType((*ReplyExtensions)(nil), "my.test.ReplyExtensions") 868 proto.RegisterType((*OtherReplyExtensions)(nil), "my.test.OtherReplyExtensions") 869 proto.RegisterType((*OldReply)(nil), "my.test.OldReply") 870 proto.RegisterType((*Communique)(nil), "my.test.Communique") 871 proto.RegisterType((*Communique_SomeGroup)(nil), "my.test.Communique.SomeGroup") 872 proto.RegisterType((*Communique_Delta)(nil), "my.test.Communique.Delta") 873 proto.RegisterEnum("my.test.HatType", HatType_name, HatType_value) 874 proto.RegisterEnum("my.test.Days", Days_name, Days_value) 875 proto.RegisterEnum("my.test.Request_Color", Request_Color_name, Request_Color_value) 876 proto.RegisterEnum("my.test.Reply_Entry_Game", Reply_Entry_Game_name, Reply_Entry_Game_value) 877 proto.RegisterExtension(E_ReplyExtensions_Time) 878 proto.RegisterExtension(E_ReplyExtensions_Carrot) 879 proto.RegisterExtension(E_ReplyExtensions_Donut) 880 proto.RegisterExtension(E_Tag) 881 proto.RegisterExtension(E_Donut) 882 }