github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/kitex_gen/baseline/baseline.go (about) 1 // Code generated by thriftgo (0.1.3). DO NOT EDIT. 2 3 package baseline 4 5 import ( 6 "bytes" 7 "context" 8 "fmt" 9 "github.com/apache/thrift/lib/go/thrift" 10 "strings" 11 ) 12 13 type Simple struct { 14 ByteField int8 `thrift:"ByteField,1" json:"ByteField"` 15 I64Field int64 `thrift:"I64Field,2" json:"I64Field"` 16 DoubleField float64 `thrift:"DoubleField,3" json:"DoubleField"` 17 I32Field int32 `thrift:"I32Field,4" json:"I32Field"` 18 StringField string `thrift:"StringField,5" json:"StringField"` 19 BinaryField []byte `thrift:"BinaryField,6" json:"BinaryField"` 20 } 21 22 func NewSimple() *Simple { 23 return &Simple{} 24 } 25 26 func (p *Simple) GetByteField() (v int8) { 27 return p.ByteField 28 } 29 30 func (p *Simple) GetI64Field() (v int64) { 31 return p.I64Field 32 } 33 34 func (p *Simple) GetDoubleField() (v float64) { 35 return p.DoubleField 36 } 37 38 func (p *Simple) GetI32Field() (v int32) { 39 return p.I32Field 40 } 41 42 func (p *Simple) GetStringField() (v string) { 43 return p.StringField 44 } 45 46 func (p *Simple) GetBinaryField() (v []byte) { 47 return p.BinaryField 48 } 49 func (p *Simple) SetByteField(val int8) { 50 p.ByteField = val 51 } 52 func (p *Simple) SetI64Field(val int64) { 53 p.I64Field = val 54 } 55 func (p *Simple) SetDoubleField(val float64) { 56 p.DoubleField = val 57 } 58 func (p *Simple) SetI32Field(val int32) { 59 p.I32Field = val 60 } 61 func (p *Simple) SetStringField(val string) { 62 p.StringField = val 63 } 64 func (p *Simple) SetBinaryField(val []byte) { 65 p.BinaryField = val 66 } 67 68 var fieldIDToName_Simple = map[int16]string{ 69 1: "ByteField", 70 2: "I64Field", 71 3: "DoubleField", 72 4: "I32Field", 73 5: "StringField", 74 6: "BinaryField", 75 } 76 77 func (p *Simple) Read(iprot thrift.TProtocol) (err error) { 78 79 var fieldTypeId thrift.TType 80 var fieldId int16 81 82 if _, err = iprot.ReadStructBegin(); err != nil { 83 goto ReadStructBeginError 84 } 85 86 for { 87 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 88 if err != nil { 89 goto ReadFieldBeginError 90 } 91 if fieldTypeId == thrift.STOP { 92 break 93 } 94 95 switch fieldId { 96 case 1: 97 if fieldTypeId == thrift.BYTE { 98 if err = p.ReadField1(iprot); err != nil { 99 goto ReadFieldError 100 } 101 } else { 102 if err = iprot.Skip(fieldTypeId); err != nil { 103 goto SkipFieldError 104 } 105 } 106 case 2: 107 if fieldTypeId == thrift.I64 { 108 if err = p.ReadField2(iprot); err != nil { 109 goto ReadFieldError 110 } 111 } else { 112 if err = iprot.Skip(fieldTypeId); err != nil { 113 goto SkipFieldError 114 } 115 } 116 case 3: 117 if fieldTypeId == thrift.DOUBLE { 118 if err = p.ReadField3(iprot); err != nil { 119 goto ReadFieldError 120 } 121 } else { 122 if err = iprot.Skip(fieldTypeId); err != nil { 123 goto SkipFieldError 124 } 125 } 126 case 4: 127 if fieldTypeId == thrift.I32 { 128 if err = p.ReadField4(iprot); err != nil { 129 goto ReadFieldError 130 } 131 } else { 132 if err = iprot.Skip(fieldTypeId); err != nil { 133 goto SkipFieldError 134 } 135 } 136 case 5: 137 if fieldTypeId == thrift.STRING { 138 if err = p.ReadField5(iprot); err != nil { 139 goto ReadFieldError 140 } 141 } else { 142 if err = iprot.Skip(fieldTypeId); err != nil { 143 goto SkipFieldError 144 } 145 } 146 case 6: 147 if fieldTypeId == thrift.STRING { 148 if err = p.ReadField6(iprot); err != nil { 149 goto ReadFieldError 150 } 151 } else { 152 if err = iprot.Skip(fieldTypeId); err != nil { 153 goto SkipFieldError 154 } 155 } 156 default: 157 if err = iprot.Skip(fieldTypeId); err != nil { 158 goto SkipFieldError 159 } 160 } 161 162 if err = iprot.ReadFieldEnd(); err != nil { 163 goto ReadFieldEndError 164 } 165 } 166 if err = iprot.ReadStructEnd(); err != nil { 167 goto ReadStructEndError 168 } 169 170 return nil 171 ReadStructBeginError: 172 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 173 ReadFieldBeginError: 174 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 175 ReadFieldError: 176 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Simple[fieldId]), err) 177 SkipFieldError: 178 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 179 180 ReadFieldEndError: 181 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 182 ReadStructEndError: 183 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 184 } 185 186 func (p *Simple) ReadField1(iprot thrift.TProtocol) error { 187 if v, err := iprot.ReadByte(); err != nil { 188 return err 189 } else { 190 p.ByteField = v 191 } 192 return nil 193 } 194 195 func (p *Simple) ReadField2(iprot thrift.TProtocol) error { 196 if v, err := iprot.ReadI64(); err != nil { 197 return err 198 } else { 199 p.I64Field = v 200 } 201 return nil 202 } 203 204 func (p *Simple) ReadField3(iprot thrift.TProtocol) error { 205 if v, err := iprot.ReadDouble(); err != nil { 206 return err 207 } else { 208 p.DoubleField = v 209 } 210 return nil 211 } 212 213 func (p *Simple) ReadField4(iprot thrift.TProtocol) error { 214 if v, err := iprot.ReadI32(); err != nil { 215 return err 216 } else { 217 p.I32Field = v 218 } 219 return nil 220 } 221 222 func (p *Simple) ReadField5(iprot thrift.TProtocol) error { 223 if v, err := iprot.ReadString(); err != nil { 224 return err 225 } else { 226 p.StringField = v 227 } 228 return nil 229 } 230 231 func (p *Simple) ReadField6(iprot thrift.TProtocol) error { 232 if v, err := iprot.ReadBinary(); err != nil { 233 return err 234 } else { 235 p.BinaryField = []byte(v) 236 } 237 return nil 238 } 239 240 func (p *Simple) Write(oprot thrift.TProtocol) (err error) { 241 var fieldId int16 242 if err = oprot.WriteStructBegin("Simple"); err != nil { 243 goto WriteStructBeginError 244 } 245 if p != nil { 246 if err = p.writeField1(oprot); err != nil { 247 fieldId = 1 248 goto WriteFieldError 249 } 250 if err = p.writeField2(oprot); err != nil { 251 fieldId = 2 252 goto WriteFieldError 253 } 254 if err = p.writeField3(oprot); err != nil { 255 fieldId = 3 256 goto WriteFieldError 257 } 258 if err = p.writeField4(oprot); err != nil { 259 fieldId = 4 260 goto WriteFieldError 261 } 262 if err = p.writeField5(oprot); err != nil { 263 fieldId = 5 264 goto WriteFieldError 265 } 266 if err = p.writeField6(oprot); err != nil { 267 fieldId = 6 268 goto WriteFieldError 269 } 270 271 } 272 if err = oprot.WriteFieldStop(); err != nil { 273 goto WriteFieldStopError 274 } 275 if err = oprot.WriteStructEnd(); err != nil { 276 goto WriteStructEndError 277 } 278 return nil 279 WriteStructBeginError: 280 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 281 WriteFieldError: 282 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 283 WriteFieldStopError: 284 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 285 WriteStructEndError: 286 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 287 } 288 289 func (p *Simple) writeField1(oprot thrift.TProtocol) (err error) { 290 if err = oprot.WriteFieldBegin("ByteField", thrift.BYTE, 1); err != nil { 291 goto WriteFieldBeginError 292 } 293 if err := oprot.WriteByte(p.ByteField); err != nil { 294 return err 295 } 296 if err = oprot.WriteFieldEnd(); err != nil { 297 goto WriteFieldEndError 298 } 299 return nil 300 WriteFieldBeginError: 301 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 302 WriteFieldEndError: 303 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 304 } 305 306 func (p *Simple) writeField2(oprot thrift.TProtocol) (err error) { 307 if err = oprot.WriteFieldBegin("I64Field", thrift.I64, 2); err != nil { 308 goto WriteFieldBeginError 309 } 310 if err := oprot.WriteI64(p.I64Field); err != nil { 311 return err 312 } 313 if err = oprot.WriteFieldEnd(); err != nil { 314 goto WriteFieldEndError 315 } 316 return nil 317 WriteFieldBeginError: 318 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 319 WriteFieldEndError: 320 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 321 } 322 323 func (p *Simple) writeField3(oprot thrift.TProtocol) (err error) { 324 if err = oprot.WriteFieldBegin("DoubleField", thrift.DOUBLE, 3); err != nil { 325 goto WriteFieldBeginError 326 } 327 if err := oprot.WriteDouble(p.DoubleField); err != nil { 328 return err 329 } 330 if err = oprot.WriteFieldEnd(); err != nil { 331 goto WriteFieldEndError 332 } 333 return nil 334 WriteFieldBeginError: 335 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 336 WriteFieldEndError: 337 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 338 } 339 340 func (p *Simple) writeField4(oprot thrift.TProtocol) (err error) { 341 if err = oprot.WriteFieldBegin("I32Field", thrift.I32, 4); err != nil { 342 goto WriteFieldBeginError 343 } 344 if err := oprot.WriteI32(p.I32Field); err != nil { 345 return err 346 } 347 if err = oprot.WriteFieldEnd(); err != nil { 348 goto WriteFieldEndError 349 } 350 return nil 351 WriteFieldBeginError: 352 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 353 WriteFieldEndError: 354 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 355 } 356 357 func (p *Simple) writeField5(oprot thrift.TProtocol) (err error) { 358 if err = oprot.WriteFieldBegin("StringField", thrift.STRING, 5); err != nil { 359 goto WriteFieldBeginError 360 } 361 if err := oprot.WriteString(p.StringField); err != nil { 362 return err 363 } 364 if err = oprot.WriteFieldEnd(); err != nil { 365 goto WriteFieldEndError 366 } 367 return nil 368 WriteFieldBeginError: 369 return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) 370 WriteFieldEndError: 371 return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) 372 } 373 374 func (p *Simple) writeField6(oprot thrift.TProtocol) (err error) { 375 if err = oprot.WriteFieldBegin("BinaryField", thrift.STRING, 6); err != nil { 376 goto WriteFieldBeginError 377 } 378 if err := oprot.WriteBinary([]byte(p.BinaryField)); err != nil { 379 return err 380 } 381 if err = oprot.WriteFieldEnd(); err != nil { 382 goto WriteFieldEndError 383 } 384 return nil 385 WriteFieldBeginError: 386 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 387 WriteFieldEndError: 388 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 389 } 390 391 func (p *Simple) String() string { 392 if p == nil { 393 return "<nil>" 394 } 395 return fmt.Sprintf("Simple(%+v)", *p) 396 } 397 398 func (p *Simple) DeepEqual(ano *Simple) bool { 399 if p == ano { 400 return true 401 } else if p == nil || ano == nil { 402 return false 403 } 404 if !p.Field1DeepEqual(ano.ByteField) { 405 return false 406 } 407 if !p.Field2DeepEqual(ano.I64Field) { 408 return false 409 } 410 if !p.Field3DeepEqual(ano.DoubleField) { 411 return false 412 } 413 if !p.Field4DeepEqual(ano.I32Field) { 414 return false 415 } 416 if !p.Field5DeepEqual(ano.StringField) { 417 return false 418 } 419 if !p.Field6DeepEqual(ano.BinaryField) { 420 return false 421 } 422 return true 423 } 424 425 func (p *Simple) Field1DeepEqual(src int8) bool { 426 427 if p.ByteField != src { 428 return false 429 } 430 return true 431 } 432 func (p *Simple) Field2DeepEqual(src int64) bool { 433 434 if p.I64Field != src { 435 return false 436 } 437 return true 438 } 439 func (p *Simple) Field3DeepEqual(src float64) bool { 440 441 if p.DoubleField != src { 442 return false 443 } 444 return true 445 } 446 func (p *Simple) Field4DeepEqual(src int32) bool { 447 448 if p.I32Field != src { 449 return false 450 } 451 return true 452 } 453 func (p *Simple) Field5DeepEqual(src string) bool { 454 455 if strings.Compare(p.StringField, src) != 0 { 456 return false 457 } 458 return true 459 } 460 func (p *Simple) Field6DeepEqual(src []byte) bool { 461 462 if bytes.Compare(p.BinaryField, src) != 0 { 463 return false 464 } 465 return true 466 } 467 468 type PartialSimple struct { 469 ByteField int8 `thrift:"ByteField,1" json:"ByteField"` 470 DoubleField float64 `thrift:"DoubleField,3" json:"DoubleField"` 471 BinaryField []byte `thrift:"BinaryField,6" json:"BinaryField"` 472 } 473 474 func NewPartialSimple() *PartialSimple { 475 return &PartialSimple{} 476 } 477 478 func (p *PartialSimple) GetByteField() (v int8) { 479 return p.ByteField 480 } 481 482 func (p *PartialSimple) GetDoubleField() (v float64) { 483 return p.DoubleField 484 } 485 486 func (p *PartialSimple) GetBinaryField() (v []byte) { 487 return p.BinaryField 488 } 489 func (p *PartialSimple) SetByteField(val int8) { 490 p.ByteField = val 491 } 492 func (p *PartialSimple) SetDoubleField(val float64) { 493 p.DoubleField = val 494 } 495 func (p *PartialSimple) SetBinaryField(val []byte) { 496 p.BinaryField = val 497 } 498 499 var fieldIDToName_PartialSimple = map[int16]string{ 500 1: "ByteField", 501 3: "DoubleField", 502 6: "BinaryField", 503 } 504 505 func (p *PartialSimple) Read(iprot thrift.TProtocol) (err error) { 506 507 var fieldTypeId thrift.TType 508 var fieldId int16 509 510 if _, err = iprot.ReadStructBegin(); err != nil { 511 goto ReadStructBeginError 512 } 513 514 for { 515 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 516 if err != nil { 517 goto ReadFieldBeginError 518 } 519 if fieldTypeId == thrift.STOP { 520 break 521 } 522 523 switch fieldId { 524 case 1: 525 if fieldTypeId == thrift.BYTE { 526 if err = p.ReadField1(iprot); err != nil { 527 goto ReadFieldError 528 } 529 } else { 530 if err = iprot.Skip(fieldTypeId); err != nil { 531 goto SkipFieldError 532 } 533 } 534 case 3: 535 if fieldTypeId == thrift.DOUBLE { 536 if err = p.ReadField3(iprot); err != nil { 537 goto ReadFieldError 538 } 539 } else { 540 if err = iprot.Skip(fieldTypeId); err != nil { 541 goto SkipFieldError 542 } 543 } 544 case 6: 545 if fieldTypeId == thrift.STRING { 546 if err = p.ReadField6(iprot); err != nil { 547 goto ReadFieldError 548 } 549 } else { 550 if err = iprot.Skip(fieldTypeId); err != nil { 551 goto SkipFieldError 552 } 553 } 554 default: 555 if err = iprot.Skip(fieldTypeId); err != nil { 556 goto SkipFieldError 557 } 558 } 559 560 if err = iprot.ReadFieldEnd(); err != nil { 561 goto ReadFieldEndError 562 } 563 } 564 if err = iprot.ReadStructEnd(); err != nil { 565 goto ReadStructEndError 566 } 567 568 return nil 569 ReadStructBeginError: 570 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 571 ReadFieldBeginError: 572 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 573 ReadFieldError: 574 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PartialSimple[fieldId]), err) 575 SkipFieldError: 576 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 577 578 ReadFieldEndError: 579 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 580 ReadStructEndError: 581 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 582 } 583 584 func (p *PartialSimple) ReadField1(iprot thrift.TProtocol) error { 585 if v, err := iprot.ReadByte(); err != nil { 586 return err 587 } else { 588 p.ByteField = v 589 } 590 return nil 591 } 592 593 func (p *PartialSimple) ReadField3(iprot thrift.TProtocol) error { 594 if v, err := iprot.ReadDouble(); err != nil { 595 return err 596 } else { 597 p.DoubleField = v 598 } 599 return nil 600 } 601 602 func (p *PartialSimple) ReadField6(iprot thrift.TProtocol) error { 603 if v, err := iprot.ReadBinary(); err != nil { 604 return err 605 } else { 606 p.BinaryField = []byte(v) 607 } 608 return nil 609 } 610 611 func (p *PartialSimple) Write(oprot thrift.TProtocol) (err error) { 612 var fieldId int16 613 if err = oprot.WriteStructBegin("PartialSimple"); err != nil { 614 goto WriteStructBeginError 615 } 616 if p != nil { 617 if err = p.writeField1(oprot); err != nil { 618 fieldId = 1 619 goto WriteFieldError 620 } 621 if err = p.writeField3(oprot); err != nil { 622 fieldId = 3 623 goto WriteFieldError 624 } 625 if err = p.writeField6(oprot); err != nil { 626 fieldId = 6 627 goto WriteFieldError 628 } 629 630 } 631 if err = oprot.WriteFieldStop(); err != nil { 632 goto WriteFieldStopError 633 } 634 if err = oprot.WriteStructEnd(); err != nil { 635 goto WriteStructEndError 636 } 637 return nil 638 WriteStructBeginError: 639 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 640 WriteFieldError: 641 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 642 WriteFieldStopError: 643 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 644 WriteStructEndError: 645 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 646 } 647 648 func (p *PartialSimple) writeField1(oprot thrift.TProtocol) (err error) { 649 if err = oprot.WriteFieldBegin("ByteField", thrift.BYTE, 1); err != nil { 650 goto WriteFieldBeginError 651 } 652 if err := oprot.WriteByte(p.ByteField); err != nil { 653 return err 654 } 655 if err = oprot.WriteFieldEnd(); err != nil { 656 goto WriteFieldEndError 657 } 658 return nil 659 WriteFieldBeginError: 660 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 661 WriteFieldEndError: 662 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 663 } 664 665 func (p *PartialSimple) writeField3(oprot thrift.TProtocol) (err error) { 666 if err = oprot.WriteFieldBegin("DoubleField", thrift.DOUBLE, 3); err != nil { 667 goto WriteFieldBeginError 668 } 669 if err := oprot.WriteDouble(p.DoubleField); err != nil { 670 return err 671 } 672 if err = oprot.WriteFieldEnd(); err != nil { 673 goto WriteFieldEndError 674 } 675 return nil 676 WriteFieldBeginError: 677 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 678 WriteFieldEndError: 679 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 680 } 681 682 func (p *PartialSimple) writeField6(oprot thrift.TProtocol) (err error) { 683 if err = oprot.WriteFieldBegin("BinaryField", thrift.STRING, 6); err != nil { 684 goto WriteFieldBeginError 685 } 686 if err := oprot.WriteBinary([]byte(p.BinaryField)); err != nil { 687 return err 688 } 689 if err = oprot.WriteFieldEnd(); err != nil { 690 goto WriteFieldEndError 691 } 692 return nil 693 WriteFieldBeginError: 694 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 695 WriteFieldEndError: 696 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 697 } 698 699 func (p *PartialSimple) String() string { 700 if p == nil { 701 return "<nil>" 702 } 703 return fmt.Sprintf("PartialSimple(%+v)", *p) 704 } 705 706 func (p *PartialSimple) DeepEqual(ano *PartialSimple) bool { 707 if p == ano { 708 return true 709 } else if p == nil || ano == nil { 710 return false 711 } 712 if !p.Field1DeepEqual(ano.ByteField) { 713 return false 714 } 715 if !p.Field3DeepEqual(ano.DoubleField) { 716 return false 717 } 718 if !p.Field6DeepEqual(ano.BinaryField) { 719 return false 720 } 721 return true 722 } 723 724 func (p *PartialSimple) Field1DeepEqual(src int8) bool { 725 726 if p.ByteField != src { 727 return false 728 } 729 return true 730 } 731 func (p *PartialSimple) Field3DeepEqual(src float64) bool { 732 733 if p.DoubleField != src { 734 return false 735 } 736 return true 737 } 738 func (p *PartialSimple) Field6DeepEqual(src []byte) bool { 739 740 if bytes.Compare(p.BinaryField, src) != 0 { 741 return false 742 } 743 return true 744 } 745 746 type Nesting struct { 747 String_ string `thrift:"String,1" json:"String"` 748 ListSimple []*Simple `thrift:"ListSimple,2" json:"ListSimple"` 749 Double float64 `thrift:"Double,3" json:"Double"` 750 I32 int32 `thrift:"I32,4" json:"I32"` 751 ListI32 []int32 `thrift:"ListI32,5" json:"ListI32"` 752 I64 int64 `thrift:"I64,6" json:"I64"` 753 MapStringString map[string]string `thrift:"MapStringString,7" json:"MapStringString"` 754 SimpleStruct *Simple `thrift:"SimpleStruct,8" json:"SimpleStruct"` 755 MapI32I64 map[int32]int64 `thrift:"MapI32I64,9" json:"MapI32I64"` 756 ListString []string `thrift:"ListString,10" json:"ListString"` 757 Binary []byte `thrift:"Binary,11" json:"Binary"` 758 MapI64String map[int64]string `thrift:"MapI64String,12" json:"MapI64String"` 759 ListI64 []int64 `thrift:"ListI64,13" json:"ListI64"` 760 Byte int8 `thrift:"Byte,14" json:"Byte"` 761 MapStringSimple map[string]*Simple `thrift:"MapStringSimple,15" json:"MapStringSimple"` 762 } 763 764 func NewNesting() *Nesting { 765 return &Nesting{} 766 } 767 768 func (p *Nesting) GetString() (v string) { 769 return p.String_ 770 } 771 772 func (p *Nesting) GetListSimple() (v []*Simple) { 773 return p.ListSimple 774 } 775 776 func (p *Nesting) GetDouble() (v float64) { 777 return p.Double 778 } 779 780 func (p *Nesting) GetI32() (v int32) { 781 return p.I32 782 } 783 784 func (p *Nesting) GetListI32() (v []int32) { 785 return p.ListI32 786 } 787 788 func (p *Nesting) GetI64() (v int64) { 789 return p.I64 790 } 791 792 func (p *Nesting) GetMapStringString() (v map[string]string) { 793 return p.MapStringString 794 } 795 796 var Nesting_SimpleStruct_DEFAULT *Simple 797 798 func (p *Nesting) GetSimpleStruct() (v *Simple) { 799 if !p.IsSetSimpleStruct() { 800 return Nesting_SimpleStruct_DEFAULT 801 } 802 return p.SimpleStruct 803 } 804 805 func (p *Nesting) GetMapI32I64() (v map[int32]int64) { 806 return p.MapI32I64 807 } 808 809 func (p *Nesting) GetListString() (v []string) { 810 return p.ListString 811 } 812 813 func (p *Nesting) GetBinary() (v []byte) { 814 return p.Binary 815 } 816 817 func (p *Nesting) GetMapI64String() (v map[int64]string) { 818 return p.MapI64String 819 } 820 821 func (p *Nesting) GetListI64() (v []int64) { 822 return p.ListI64 823 } 824 825 func (p *Nesting) GetByte() (v int8) { 826 return p.Byte 827 } 828 829 func (p *Nesting) GetMapStringSimple() (v map[string]*Simple) { 830 return p.MapStringSimple 831 } 832 func (p *Nesting) SetString(val string) { 833 p.String_ = val 834 } 835 func (p *Nesting) SetListSimple(val []*Simple) { 836 p.ListSimple = val 837 } 838 func (p *Nesting) SetDouble(val float64) { 839 p.Double = val 840 } 841 func (p *Nesting) SetI32(val int32) { 842 p.I32 = val 843 } 844 func (p *Nesting) SetListI32(val []int32) { 845 p.ListI32 = val 846 } 847 func (p *Nesting) SetI64(val int64) { 848 p.I64 = val 849 } 850 func (p *Nesting) SetMapStringString(val map[string]string) { 851 p.MapStringString = val 852 } 853 func (p *Nesting) SetSimpleStruct(val *Simple) { 854 p.SimpleStruct = val 855 } 856 func (p *Nesting) SetMapI32I64(val map[int32]int64) { 857 p.MapI32I64 = val 858 } 859 func (p *Nesting) SetListString(val []string) { 860 p.ListString = val 861 } 862 func (p *Nesting) SetBinary(val []byte) { 863 p.Binary = val 864 } 865 func (p *Nesting) SetMapI64String(val map[int64]string) { 866 p.MapI64String = val 867 } 868 func (p *Nesting) SetListI64(val []int64) { 869 p.ListI64 = val 870 } 871 func (p *Nesting) SetByte(val int8) { 872 p.Byte = val 873 } 874 func (p *Nesting) SetMapStringSimple(val map[string]*Simple) { 875 p.MapStringSimple = val 876 } 877 878 var fieldIDToName_Nesting = map[int16]string{ 879 1: "String", 880 2: "ListSimple", 881 3: "Double", 882 4: "I32", 883 5: "ListI32", 884 6: "I64", 885 7: "MapStringString", 886 8: "SimpleStruct", 887 9: "MapI32I64", 888 10: "ListString", 889 11: "Binary", 890 12: "MapI64String", 891 13: "ListI64", 892 14: "Byte", 893 15: "MapStringSimple", 894 } 895 896 func (p *Nesting) IsSetSimpleStruct() bool { 897 return p.SimpleStruct != nil 898 } 899 900 func (p *Nesting) Read(iprot thrift.TProtocol) (err error) { 901 902 var fieldTypeId thrift.TType 903 var fieldId int16 904 905 if _, err = iprot.ReadStructBegin(); err != nil { 906 goto ReadStructBeginError 907 } 908 909 for { 910 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 911 if err != nil { 912 goto ReadFieldBeginError 913 } 914 if fieldTypeId == thrift.STOP { 915 break 916 } 917 918 switch fieldId { 919 case 1: 920 if fieldTypeId == thrift.STRING { 921 if err = p.ReadField1(iprot); err != nil { 922 goto ReadFieldError 923 } 924 } else { 925 if err = iprot.Skip(fieldTypeId); err != nil { 926 goto SkipFieldError 927 } 928 } 929 case 2: 930 if fieldTypeId == thrift.LIST { 931 if err = p.ReadField2(iprot); err != nil { 932 goto ReadFieldError 933 } 934 } else { 935 if err = iprot.Skip(fieldTypeId); err != nil { 936 goto SkipFieldError 937 } 938 } 939 case 3: 940 if fieldTypeId == thrift.DOUBLE { 941 if err = p.ReadField3(iprot); err != nil { 942 goto ReadFieldError 943 } 944 } else { 945 if err = iprot.Skip(fieldTypeId); err != nil { 946 goto SkipFieldError 947 } 948 } 949 case 4: 950 if fieldTypeId == thrift.I32 { 951 if err = p.ReadField4(iprot); err != nil { 952 goto ReadFieldError 953 } 954 } else { 955 if err = iprot.Skip(fieldTypeId); err != nil { 956 goto SkipFieldError 957 } 958 } 959 case 5: 960 if fieldTypeId == thrift.LIST { 961 if err = p.ReadField5(iprot); err != nil { 962 goto ReadFieldError 963 } 964 } else { 965 if err = iprot.Skip(fieldTypeId); err != nil { 966 goto SkipFieldError 967 } 968 } 969 case 6: 970 if fieldTypeId == thrift.I64 { 971 if err = p.ReadField6(iprot); err != nil { 972 goto ReadFieldError 973 } 974 } else { 975 if err = iprot.Skip(fieldTypeId); err != nil { 976 goto SkipFieldError 977 } 978 } 979 case 7: 980 if fieldTypeId == thrift.MAP { 981 if err = p.ReadField7(iprot); err != nil { 982 goto ReadFieldError 983 } 984 } else { 985 if err = iprot.Skip(fieldTypeId); err != nil { 986 goto SkipFieldError 987 } 988 } 989 case 8: 990 if fieldTypeId == thrift.STRUCT { 991 if err = p.ReadField8(iprot); err != nil { 992 goto ReadFieldError 993 } 994 } else { 995 if err = iprot.Skip(fieldTypeId); err != nil { 996 goto SkipFieldError 997 } 998 } 999 case 9: 1000 if fieldTypeId == thrift.MAP { 1001 if err = p.ReadField9(iprot); err != nil { 1002 goto ReadFieldError 1003 } 1004 } else { 1005 if err = iprot.Skip(fieldTypeId); err != nil { 1006 goto SkipFieldError 1007 } 1008 } 1009 case 10: 1010 if fieldTypeId == thrift.LIST { 1011 if err = p.ReadField10(iprot); err != nil { 1012 goto ReadFieldError 1013 } 1014 } else { 1015 if err = iprot.Skip(fieldTypeId); err != nil { 1016 goto SkipFieldError 1017 } 1018 } 1019 case 11: 1020 if fieldTypeId == thrift.STRING { 1021 if err = p.ReadField11(iprot); err != nil { 1022 goto ReadFieldError 1023 } 1024 } else { 1025 if err = iprot.Skip(fieldTypeId); err != nil { 1026 goto SkipFieldError 1027 } 1028 } 1029 case 12: 1030 if fieldTypeId == thrift.MAP { 1031 if err = p.ReadField12(iprot); err != nil { 1032 goto ReadFieldError 1033 } 1034 } else { 1035 if err = iprot.Skip(fieldTypeId); err != nil { 1036 goto SkipFieldError 1037 } 1038 } 1039 case 13: 1040 if fieldTypeId == thrift.LIST { 1041 if err = p.ReadField13(iprot); err != nil { 1042 goto ReadFieldError 1043 } 1044 } else { 1045 if err = iprot.Skip(fieldTypeId); err != nil { 1046 goto SkipFieldError 1047 } 1048 } 1049 case 14: 1050 if fieldTypeId == thrift.BYTE { 1051 if err = p.ReadField14(iprot); err != nil { 1052 goto ReadFieldError 1053 } 1054 } else { 1055 if err = iprot.Skip(fieldTypeId); err != nil { 1056 goto SkipFieldError 1057 } 1058 } 1059 case 15: 1060 if fieldTypeId == thrift.MAP { 1061 if err = p.ReadField15(iprot); err != nil { 1062 goto ReadFieldError 1063 } 1064 } else { 1065 if err = iprot.Skip(fieldTypeId); err != nil { 1066 goto SkipFieldError 1067 } 1068 } 1069 default: 1070 if err = iprot.Skip(fieldTypeId); err != nil { 1071 goto SkipFieldError 1072 } 1073 } 1074 1075 if err = iprot.ReadFieldEnd(); err != nil { 1076 goto ReadFieldEndError 1077 } 1078 } 1079 if err = iprot.ReadStructEnd(); err != nil { 1080 goto ReadStructEndError 1081 } 1082 1083 return nil 1084 ReadStructBeginError: 1085 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 1086 ReadFieldBeginError: 1087 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 1088 ReadFieldError: 1089 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Nesting[fieldId]), err) 1090 SkipFieldError: 1091 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 1092 1093 ReadFieldEndError: 1094 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 1095 ReadStructEndError: 1096 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1097 } 1098 1099 func (p *Nesting) ReadField1(iprot thrift.TProtocol) error { 1100 if v, err := iprot.ReadString(); err != nil { 1101 return err 1102 } else { 1103 p.String_ = v 1104 } 1105 return nil 1106 } 1107 1108 func (p *Nesting) ReadField2(iprot thrift.TProtocol) error { 1109 _, size, err := iprot.ReadListBegin() 1110 if err != nil { 1111 return err 1112 } 1113 p.ListSimple = make([]*Simple, 0, size) 1114 for i := 0; i < size; i++ { 1115 _elem := NewSimple() 1116 if err := _elem.Read(iprot); err != nil { 1117 return err 1118 } 1119 1120 p.ListSimple = append(p.ListSimple, _elem) 1121 } 1122 if err := iprot.ReadListEnd(); err != nil { 1123 return err 1124 } 1125 return nil 1126 } 1127 1128 func (p *Nesting) ReadField3(iprot thrift.TProtocol) error { 1129 if v, err := iprot.ReadDouble(); err != nil { 1130 return err 1131 } else { 1132 p.Double = v 1133 } 1134 return nil 1135 } 1136 1137 func (p *Nesting) ReadField4(iprot thrift.TProtocol) error { 1138 if v, err := iprot.ReadI32(); err != nil { 1139 return err 1140 } else { 1141 p.I32 = v 1142 } 1143 return nil 1144 } 1145 1146 func (p *Nesting) ReadField5(iprot thrift.TProtocol) error { 1147 _, size, err := iprot.ReadListBegin() 1148 if err != nil { 1149 return err 1150 } 1151 p.ListI32 = make([]int32, 0, size) 1152 for i := 0; i < size; i++ { 1153 var _elem int32 1154 if v, err := iprot.ReadI32(); err != nil { 1155 return err 1156 } else { 1157 _elem = v 1158 } 1159 1160 p.ListI32 = append(p.ListI32, _elem) 1161 } 1162 if err := iprot.ReadListEnd(); err != nil { 1163 return err 1164 } 1165 return nil 1166 } 1167 1168 func (p *Nesting) ReadField6(iprot thrift.TProtocol) error { 1169 if v, err := iprot.ReadI64(); err != nil { 1170 return err 1171 } else { 1172 p.I64 = v 1173 } 1174 return nil 1175 } 1176 1177 func (p *Nesting) ReadField7(iprot thrift.TProtocol) error { 1178 _, _, size, err := iprot.ReadMapBegin() 1179 if err != nil { 1180 return err 1181 } 1182 p.MapStringString = make(map[string]string, size) 1183 for i := 0; i < size; i++ { 1184 var _key string 1185 if v, err := iprot.ReadString(); err != nil { 1186 return err 1187 } else { 1188 _key = v 1189 } 1190 1191 var _val string 1192 if v, err := iprot.ReadString(); err != nil { 1193 return err 1194 } else { 1195 _val = v 1196 } 1197 1198 p.MapStringString[_key] = _val 1199 } 1200 if err := iprot.ReadMapEnd(); err != nil { 1201 return err 1202 } 1203 return nil 1204 } 1205 1206 func (p *Nesting) ReadField8(iprot thrift.TProtocol) error { 1207 p.SimpleStruct = NewSimple() 1208 if err := p.SimpleStruct.Read(iprot); err != nil { 1209 return err 1210 } 1211 return nil 1212 } 1213 1214 func (p *Nesting) ReadField9(iprot thrift.TProtocol) error { 1215 _, _, size, err := iprot.ReadMapBegin() 1216 if err != nil { 1217 return err 1218 } 1219 p.MapI32I64 = make(map[int32]int64, size) 1220 for i := 0; i < size; i++ { 1221 var _key int32 1222 if v, err := iprot.ReadI32(); err != nil { 1223 return err 1224 } else { 1225 _key = v 1226 } 1227 1228 var _val int64 1229 if v, err := iprot.ReadI64(); err != nil { 1230 return err 1231 } else { 1232 _val = v 1233 } 1234 1235 p.MapI32I64[_key] = _val 1236 } 1237 if err := iprot.ReadMapEnd(); err != nil { 1238 return err 1239 } 1240 return nil 1241 } 1242 1243 func (p *Nesting) ReadField10(iprot thrift.TProtocol) error { 1244 _, size, err := iprot.ReadListBegin() 1245 if err != nil { 1246 return err 1247 } 1248 p.ListString = make([]string, 0, size) 1249 for i := 0; i < size; i++ { 1250 var _elem string 1251 if v, err := iprot.ReadString(); err != nil { 1252 return err 1253 } else { 1254 _elem = v 1255 } 1256 1257 p.ListString = append(p.ListString, _elem) 1258 } 1259 if err := iprot.ReadListEnd(); err != nil { 1260 return err 1261 } 1262 return nil 1263 } 1264 1265 func (p *Nesting) ReadField11(iprot thrift.TProtocol) error { 1266 if v, err := iprot.ReadBinary(); err != nil { 1267 return err 1268 } else { 1269 p.Binary = []byte(v) 1270 } 1271 return nil 1272 } 1273 1274 func (p *Nesting) ReadField12(iprot thrift.TProtocol) error { 1275 _, _, size, err := iprot.ReadMapBegin() 1276 if err != nil { 1277 return err 1278 } 1279 p.MapI64String = make(map[int64]string, size) 1280 for i := 0; i < size; i++ { 1281 var _key int64 1282 if v, err := iprot.ReadI64(); err != nil { 1283 return err 1284 } else { 1285 _key = v 1286 } 1287 1288 var _val string 1289 if v, err := iprot.ReadString(); err != nil { 1290 return err 1291 } else { 1292 _val = v 1293 } 1294 1295 p.MapI64String[_key] = _val 1296 } 1297 if err := iprot.ReadMapEnd(); err != nil { 1298 return err 1299 } 1300 return nil 1301 } 1302 1303 func (p *Nesting) ReadField13(iprot thrift.TProtocol) error { 1304 _, size, err := iprot.ReadListBegin() 1305 if err != nil { 1306 return err 1307 } 1308 p.ListI64 = make([]int64, 0, size) 1309 for i := 0; i < size; i++ { 1310 var _elem int64 1311 if v, err := iprot.ReadI64(); err != nil { 1312 return err 1313 } else { 1314 _elem = v 1315 } 1316 1317 p.ListI64 = append(p.ListI64, _elem) 1318 } 1319 if err := iprot.ReadListEnd(); err != nil { 1320 return err 1321 } 1322 return nil 1323 } 1324 1325 func (p *Nesting) ReadField14(iprot thrift.TProtocol) error { 1326 if v, err := iprot.ReadByte(); err != nil { 1327 return err 1328 } else { 1329 p.Byte = v 1330 } 1331 return nil 1332 } 1333 1334 func (p *Nesting) ReadField15(iprot thrift.TProtocol) error { 1335 _, _, size, err := iprot.ReadMapBegin() 1336 if err != nil { 1337 return err 1338 } 1339 p.MapStringSimple = make(map[string]*Simple, size) 1340 for i := 0; i < size; i++ { 1341 var _key string 1342 if v, err := iprot.ReadString(); err != nil { 1343 return err 1344 } else { 1345 _key = v 1346 } 1347 _val := NewSimple() 1348 if err := _val.Read(iprot); err != nil { 1349 return err 1350 } 1351 1352 p.MapStringSimple[_key] = _val 1353 } 1354 if err := iprot.ReadMapEnd(); err != nil { 1355 return err 1356 } 1357 return nil 1358 } 1359 1360 func (p *Nesting) Write(oprot thrift.TProtocol) (err error) { 1361 var fieldId int16 1362 if err = oprot.WriteStructBegin("Nesting"); err != nil { 1363 goto WriteStructBeginError 1364 } 1365 if p != nil { 1366 if err = p.writeField1(oprot); err != nil { 1367 fieldId = 1 1368 goto WriteFieldError 1369 } 1370 if err = p.writeField2(oprot); err != nil { 1371 fieldId = 2 1372 goto WriteFieldError 1373 } 1374 if err = p.writeField3(oprot); err != nil { 1375 fieldId = 3 1376 goto WriteFieldError 1377 } 1378 if err = p.writeField4(oprot); err != nil { 1379 fieldId = 4 1380 goto WriteFieldError 1381 } 1382 if err = p.writeField5(oprot); err != nil { 1383 fieldId = 5 1384 goto WriteFieldError 1385 } 1386 if err = p.writeField6(oprot); err != nil { 1387 fieldId = 6 1388 goto WriteFieldError 1389 } 1390 if err = p.writeField7(oprot); err != nil { 1391 fieldId = 7 1392 goto WriteFieldError 1393 } 1394 if err = p.writeField8(oprot); err != nil { 1395 fieldId = 8 1396 goto WriteFieldError 1397 } 1398 if err = p.writeField9(oprot); err != nil { 1399 fieldId = 9 1400 goto WriteFieldError 1401 } 1402 if err = p.writeField10(oprot); err != nil { 1403 fieldId = 10 1404 goto WriteFieldError 1405 } 1406 if err = p.writeField11(oprot); err != nil { 1407 fieldId = 11 1408 goto WriteFieldError 1409 } 1410 if err = p.writeField12(oprot); err != nil { 1411 fieldId = 12 1412 goto WriteFieldError 1413 } 1414 if err = p.writeField13(oprot); err != nil { 1415 fieldId = 13 1416 goto WriteFieldError 1417 } 1418 if err = p.writeField14(oprot); err != nil { 1419 fieldId = 14 1420 goto WriteFieldError 1421 } 1422 if err = p.writeField15(oprot); err != nil { 1423 fieldId = 15 1424 goto WriteFieldError 1425 } 1426 1427 } 1428 if err = oprot.WriteFieldStop(); err != nil { 1429 goto WriteFieldStopError 1430 } 1431 if err = oprot.WriteStructEnd(); err != nil { 1432 goto WriteStructEndError 1433 } 1434 return nil 1435 WriteStructBeginError: 1436 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 1437 WriteFieldError: 1438 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 1439 WriteFieldStopError: 1440 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 1441 WriteStructEndError: 1442 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 1443 } 1444 1445 func (p *Nesting) writeField1(oprot thrift.TProtocol) (err error) { 1446 if err = oprot.WriteFieldBegin("String", thrift.STRING, 1); err != nil { 1447 goto WriteFieldBeginError 1448 } 1449 if err := oprot.WriteString(p.String_); err != nil { 1450 return err 1451 } 1452 if err = oprot.WriteFieldEnd(); err != nil { 1453 goto WriteFieldEndError 1454 } 1455 return nil 1456 WriteFieldBeginError: 1457 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 1458 WriteFieldEndError: 1459 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 1460 } 1461 1462 func (p *Nesting) writeField2(oprot thrift.TProtocol) (err error) { 1463 if err = oprot.WriteFieldBegin("ListSimple", thrift.LIST, 2); err != nil { 1464 goto WriteFieldBeginError 1465 } 1466 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.ListSimple)); err != nil { 1467 return err 1468 } 1469 for _, v := range p.ListSimple { 1470 if err := v.Write(oprot); err != nil { 1471 return err 1472 } 1473 } 1474 if err := oprot.WriteListEnd(); err != nil { 1475 return err 1476 } 1477 if err = oprot.WriteFieldEnd(); err != nil { 1478 goto WriteFieldEndError 1479 } 1480 return nil 1481 WriteFieldBeginError: 1482 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 1483 WriteFieldEndError: 1484 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 1485 } 1486 1487 func (p *Nesting) writeField3(oprot thrift.TProtocol) (err error) { 1488 if err = oprot.WriteFieldBegin("Double", thrift.DOUBLE, 3); err != nil { 1489 goto WriteFieldBeginError 1490 } 1491 if err := oprot.WriteDouble(p.Double); err != nil { 1492 return err 1493 } 1494 if err = oprot.WriteFieldEnd(); err != nil { 1495 goto WriteFieldEndError 1496 } 1497 return nil 1498 WriteFieldBeginError: 1499 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 1500 WriteFieldEndError: 1501 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 1502 } 1503 1504 func (p *Nesting) writeField4(oprot thrift.TProtocol) (err error) { 1505 if err = oprot.WriteFieldBegin("I32", thrift.I32, 4); err != nil { 1506 goto WriteFieldBeginError 1507 } 1508 if err := oprot.WriteI32(p.I32); err != nil { 1509 return err 1510 } 1511 if err = oprot.WriteFieldEnd(); err != nil { 1512 goto WriteFieldEndError 1513 } 1514 return nil 1515 WriteFieldBeginError: 1516 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 1517 WriteFieldEndError: 1518 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 1519 } 1520 1521 func (p *Nesting) writeField5(oprot thrift.TProtocol) (err error) { 1522 if err = oprot.WriteFieldBegin("ListI32", thrift.LIST, 5); err != nil { 1523 goto WriteFieldBeginError 1524 } 1525 if err := oprot.WriteListBegin(thrift.I32, len(p.ListI32)); err != nil { 1526 return err 1527 } 1528 for _, v := range p.ListI32 { 1529 if err := oprot.WriteI32(v); err != nil { 1530 return err 1531 } 1532 } 1533 if err := oprot.WriteListEnd(); err != nil { 1534 return err 1535 } 1536 if err = oprot.WriteFieldEnd(); err != nil { 1537 goto WriteFieldEndError 1538 } 1539 return nil 1540 WriteFieldBeginError: 1541 return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) 1542 WriteFieldEndError: 1543 return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) 1544 } 1545 1546 func (p *Nesting) writeField6(oprot thrift.TProtocol) (err error) { 1547 if err = oprot.WriteFieldBegin("I64", thrift.I64, 6); err != nil { 1548 goto WriteFieldBeginError 1549 } 1550 if err := oprot.WriteI64(p.I64); err != nil { 1551 return err 1552 } 1553 if err = oprot.WriteFieldEnd(); err != nil { 1554 goto WriteFieldEndError 1555 } 1556 return nil 1557 WriteFieldBeginError: 1558 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 1559 WriteFieldEndError: 1560 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 1561 } 1562 1563 func (p *Nesting) writeField7(oprot thrift.TProtocol) (err error) { 1564 if err = oprot.WriteFieldBegin("MapStringString", thrift.MAP, 7); err != nil { 1565 goto WriteFieldBeginError 1566 } 1567 if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.MapStringString)); err != nil { 1568 return err 1569 } 1570 for k, v := range p.MapStringString { 1571 1572 if err := oprot.WriteString(k); err != nil { 1573 return err 1574 } 1575 1576 if err := oprot.WriteString(v); err != nil { 1577 return err 1578 } 1579 } 1580 if err := oprot.WriteMapEnd(); err != nil { 1581 return err 1582 } 1583 if err = oprot.WriteFieldEnd(); err != nil { 1584 goto WriteFieldEndError 1585 } 1586 return nil 1587 WriteFieldBeginError: 1588 return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) 1589 WriteFieldEndError: 1590 return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) 1591 } 1592 1593 func (p *Nesting) writeField8(oprot thrift.TProtocol) (err error) { 1594 if err = oprot.WriteFieldBegin("SimpleStruct", thrift.STRUCT, 8); err != nil { 1595 goto WriteFieldBeginError 1596 } 1597 if err := p.SimpleStruct.Write(oprot); err != nil { 1598 return err 1599 } 1600 if err = oprot.WriteFieldEnd(); err != nil { 1601 goto WriteFieldEndError 1602 } 1603 return nil 1604 WriteFieldBeginError: 1605 return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err) 1606 WriteFieldEndError: 1607 return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err) 1608 } 1609 1610 func (p *Nesting) writeField9(oprot thrift.TProtocol) (err error) { 1611 if err = oprot.WriteFieldBegin("MapI32I64", thrift.MAP, 9); err != nil { 1612 goto WriteFieldBeginError 1613 } 1614 if err := oprot.WriteMapBegin(thrift.I32, thrift.I64, len(p.MapI32I64)); err != nil { 1615 return err 1616 } 1617 for k, v := range p.MapI32I64 { 1618 1619 if err := oprot.WriteI32(k); err != nil { 1620 return err 1621 } 1622 1623 if err := oprot.WriteI64(v); err != nil { 1624 return err 1625 } 1626 } 1627 if err := oprot.WriteMapEnd(); err != nil { 1628 return err 1629 } 1630 if err = oprot.WriteFieldEnd(); err != nil { 1631 goto WriteFieldEndError 1632 } 1633 return nil 1634 WriteFieldBeginError: 1635 return thrift.PrependError(fmt.Sprintf("%T write field 9 begin error: ", p), err) 1636 WriteFieldEndError: 1637 return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err) 1638 } 1639 1640 func (p *Nesting) writeField10(oprot thrift.TProtocol) (err error) { 1641 if err = oprot.WriteFieldBegin("ListString", thrift.LIST, 10); err != nil { 1642 goto WriteFieldBeginError 1643 } 1644 if err := oprot.WriteListBegin(thrift.STRING, len(p.ListString)); err != nil { 1645 return err 1646 } 1647 for _, v := range p.ListString { 1648 if err := oprot.WriteString(v); err != nil { 1649 return err 1650 } 1651 } 1652 if err := oprot.WriteListEnd(); err != nil { 1653 return err 1654 } 1655 if err = oprot.WriteFieldEnd(); err != nil { 1656 goto WriteFieldEndError 1657 } 1658 return nil 1659 WriteFieldBeginError: 1660 return thrift.PrependError(fmt.Sprintf("%T write field 10 begin error: ", p), err) 1661 WriteFieldEndError: 1662 return thrift.PrependError(fmt.Sprintf("%T write field 10 end error: ", p), err) 1663 } 1664 1665 func (p *Nesting) writeField11(oprot thrift.TProtocol) (err error) { 1666 if err = oprot.WriteFieldBegin("Binary", thrift.STRING, 11); err != nil { 1667 goto WriteFieldBeginError 1668 } 1669 if err := oprot.WriteBinary([]byte(p.Binary)); err != nil { 1670 return err 1671 } 1672 if err = oprot.WriteFieldEnd(); err != nil { 1673 goto WriteFieldEndError 1674 } 1675 return nil 1676 WriteFieldBeginError: 1677 return thrift.PrependError(fmt.Sprintf("%T write field 11 begin error: ", p), err) 1678 WriteFieldEndError: 1679 return thrift.PrependError(fmt.Sprintf("%T write field 11 end error: ", p), err) 1680 } 1681 1682 func (p *Nesting) writeField12(oprot thrift.TProtocol) (err error) { 1683 if err = oprot.WriteFieldBegin("MapI64String", thrift.MAP, 12); err != nil { 1684 goto WriteFieldBeginError 1685 } 1686 if err := oprot.WriteMapBegin(thrift.I64, thrift.STRING, len(p.MapI64String)); err != nil { 1687 return err 1688 } 1689 for k, v := range p.MapI64String { 1690 1691 if err := oprot.WriteI64(k); err != nil { 1692 return err 1693 } 1694 1695 if err := oprot.WriteString(v); err != nil { 1696 return err 1697 } 1698 } 1699 if err := oprot.WriteMapEnd(); err != nil { 1700 return err 1701 } 1702 if err = oprot.WriteFieldEnd(); err != nil { 1703 goto WriteFieldEndError 1704 } 1705 return nil 1706 WriteFieldBeginError: 1707 return thrift.PrependError(fmt.Sprintf("%T write field 12 begin error: ", p), err) 1708 WriteFieldEndError: 1709 return thrift.PrependError(fmt.Sprintf("%T write field 12 end error: ", p), err) 1710 } 1711 1712 func (p *Nesting) writeField13(oprot thrift.TProtocol) (err error) { 1713 if err = oprot.WriteFieldBegin("ListI64", thrift.LIST, 13); err != nil { 1714 goto WriteFieldBeginError 1715 } 1716 if err := oprot.WriteListBegin(thrift.I64, len(p.ListI64)); err != nil { 1717 return err 1718 } 1719 for _, v := range p.ListI64 { 1720 if err := oprot.WriteI64(v); err != nil { 1721 return err 1722 } 1723 } 1724 if err := oprot.WriteListEnd(); err != nil { 1725 return err 1726 } 1727 if err = oprot.WriteFieldEnd(); err != nil { 1728 goto WriteFieldEndError 1729 } 1730 return nil 1731 WriteFieldBeginError: 1732 return thrift.PrependError(fmt.Sprintf("%T write field 13 begin error: ", p), err) 1733 WriteFieldEndError: 1734 return thrift.PrependError(fmt.Sprintf("%T write field 13 end error: ", p), err) 1735 } 1736 1737 func (p *Nesting) writeField14(oprot thrift.TProtocol) (err error) { 1738 if err = oprot.WriteFieldBegin("Byte", thrift.BYTE, 14); err != nil { 1739 goto WriteFieldBeginError 1740 } 1741 if err := oprot.WriteByte(p.Byte); err != nil { 1742 return err 1743 } 1744 if err = oprot.WriteFieldEnd(); err != nil { 1745 goto WriteFieldEndError 1746 } 1747 return nil 1748 WriteFieldBeginError: 1749 return thrift.PrependError(fmt.Sprintf("%T write field 14 begin error: ", p), err) 1750 WriteFieldEndError: 1751 return thrift.PrependError(fmt.Sprintf("%T write field 14 end error: ", p), err) 1752 } 1753 1754 func (p *Nesting) writeField15(oprot thrift.TProtocol) (err error) { 1755 if err = oprot.WriteFieldBegin("MapStringSimple", thrift.MAP, 15); err != nil { 1756 goto WriteFieldBeginError 1757 } 1758 if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.MapStringSimple)); err != nil { 1759 return err 1760 } 1761 for k, v := range p.MapStringSimple { 1762 1763 if err := oprot.WriteString(k); err != nil { 1764 return err 1765 } 1766 1767 if err := v.Write(oprot); err != nil { 1768 return err 1769 } 1770 } 1771 if err := oprot.WriteMapEnd(); err != nil { 1772 return err 1773 } 1774 if err = oprot.WriteFieldEnd(); err != nil { 1775 goto WriteFieldEndError 1776 } 1777 return nil 1778 WriteFieldBeginError: 1779 return thrift.PrependError(fmt.Sprintf("%T write field 15 begin error: ", p), err) 1780 WriteFieldEndError: 1781 return thrift.PrependError(fmt.Sprintf("%T write field 15 end error: ", p), err) 1782 } 1783 1784 func (p *Nesting) String() string { 1785 if p == nil { 1786 return "<nil>" 1787 } 1788 return fmt.Sprintf("Nesting(%+v)", *p) 1789 } 1790 1791 func (p *Nesting) DeepEqual(ano *Nesting) bool { 1792 if p == ano { 1793 return true 1794 } else if p == nil || ano == nil { 1795 return false 1796 } 1797 if !p.Field1DeepEqual(ano.String_) { 1798 return false 1799 } 1800 if !p.Field2DeepEqual(ano.ListSimple) { 1801 return false 1802 } 1803 if !p.Field3DeepEqual(ano.Double) { 1804 return false 1805 } 1806 if !p.Field4DeepEqual(ano.I32) { 1807 return false 1808 } 1809 if !p.Field5DeepEqual(ano.ListI32) { 1810 return false 1811 } 1812 if !p.Field6DeepEqual(ano.I64) { 1813 return false 1814 } 1815 if !p.Field7DeepEqual(ano.MapStringString) { 1816 return false 1817 } 1818 if !p.Field8DeepEqual(ano.SimpleStruct) { 1819 return false 1820 } 1821 if !p.Field9DeepEqual(ano.MapI32I64) { 1822 return false 1823 } 1824 if !p.Field10DeepEqual(ano.ListString) { 1825 return false 1826 } 1827 if !p.Field11DeepEqual(ano.Binary) { 1828 return false 1829 } 1830 if !p.Field12DeepEqual(ano.MapI64String) { 1831 return false 1832 } 1833 if !p.Field13DeepEqual(ano.ListI64) { 1834 return false 1835 } 1836 if !p.Field14DeepEqual(ano.Byte) { 1837 return false 1838 } 1839 if !p.Field15DeepEqual(ano.MapStringSimple) { 1840 return false 1841 } 1842 return true 1843 } 1844 1845 func (p *Nesting) Field1DeepEqual(src string) bool { 1846 1847 if strings.Compare(p.String_, src) != 0 { 1848 return false 1849 } 1850 return true 1851 } 1852 func (p *Nesting) Field2DeepEqual(src []*Simple) bool { 1853 1854 if len(p.ListSimple) != len(src) { 1855 return false 1856 } 1857 for i, v := range p.ListSimple { 1858 _src := src[i] 1859 if !v.DeepEqual(_src) { 1860 return false 1861 } 1862 } 1863 return true 1864 } 1865 func (p *Nesting) Field3DeepEqual(src float64) bool { 1866 1867 if p.Double != src { 1868 return false 1869 } 1870 return true 1871 } 1872 func (p *Nesting) Field4DeepEqual(src int32) bool { 1873 1874 if p.I32 != src { 1875 return false 1876 } 1877 return true 1878 } 1879 func (p *Nesting) Field5DeepEqual(src []int32) bool { 1880 1881 if len(p.ListI32) != len(src) { 1882 return false 1883 } 1884 for i, v := range p.ListI32 { 1885 _src := src[i] 1886 if v != _src { 1887 return false 1888 } 1889 } 1890 return true 1891 } 1892 func (p *Nesting) Field6DeepEqual(src int64) bool { 1893 1894 if p.I64 != src { 1895 return false 1896 } 1897 return true 1898 } 1899 func (p *Nesting) Field7DeepEqual(src map[string]string) bool { 1900 1901 if len(p.MapStringString) != len(src) { 1902 return false 1903 } 1904 for k, v := range p.MapStringString { 1905 _src := src[k] 1906 if strings.Compare(v, _src) != 0 { 1907 return false 1908 } 1909 } 1910 return true 1911 } 1912 func (p *Nesting) Field8DeepEqual(src *Simple) bool { 1913 1914 if !p.SimpleStruct.DeepEqual(src) { 1915 return false 1916 } 1917 return true 1918 } 1919 func (p *Nesting) Field9DeepEqual(src map[int32]int64) bool { 1920 1921 if len(p.MapI32I64) != len(src) { 1922 return false 1923 } 1924 for k, v := range p.MapI32I64 { 1925 _src := src[k] 1926 if v != _src { 1927 return false 1928 } 1929 } 1930 return true 1931 } 1932 func (p *Nesting) Field10DeepEqual(src []string) bool { 1933 1934 if len(p.ListString) != len(src) { 1935 return false 1936 } 1937 for i, v := range p.ListString { 1938 _src := src[i] 1939 if strings.Compare(v, _src) != 0 { 1940 return false 1941 } 1942 } 1943 return true 1944 } 1945 func (p *Nesting) Field11DeepEqual(src []byte) bool { 1946 1947 if bytes.Compare(p.Binary, src) != 0 { 1948 return false 1949 } 1950 return true 1951 } 1952 func (p *Nesting) Field12DeepEqual(src map[int64]string) bool { 1953 1954 if len(p.MapI64String) != len(src) { 1955 return false 1956 } 1957 for k, v := range p.MapI64String { 1958 _src := src[k] 1959 if strings.Compare(v, _src) != 0 { 1960 return false 1961 } 1962 } 1963 return true 1964 } 1965 func (p *Nesting) Field13DeepEqual(src []int64) bool { 1966 1967 if len(p.ListI64) != len(src) { 1968 return false 1969 } 1970 for i, v := range p.ListI64 { 1971 _src := src[i] 1972 if v != _src { 1973 return false 1974 } 1975 } 1976 return true 1977 } 1978 func (p *Nesting) Field14DeepEqual(src int8) bool { 1979 1980 if p.Byte != src { 1981 return false 1982 } 1983 return true 1984 } 1985 func (p *Nesting) Field15DeepEqual(src map[string]*Simple) bool { 1986 1987 if len(p.MapStringSimple) != len(src) { 1988 return false 1989 } 1990 for k, v := range p.MapStringSimple { 1991 _src := src[k] 1992 if !v.DeepEqual(_src) { 1993 return false 1994 } 1995 } 1996 return true 1997 } 1998 1999 type PartialNesting struct { 2000 ListSimple []*PartialSimple `thrift:"ListSimple,2" json:"ListSimple"` 2001 SimpleStruct *PartialSimple `thrift:"SimpleStruct,8" json:"SimpleStruct"` 2002 MapStringSimple map[string]*PartialSimple `thrift:"MapStringSimple,15" json:"MapStringSimple"` 2003 } 2004 2005 func NewPartialNesting() *PartialNesting { 2006 return &PartialNesting{} 2007 } 2008 2009 func (p *PartialNesting) GetListSimple() (v []*PartialSimple) { 2010 return p.ListSimple 2011 } 2012 2013 var PartialNesting_SimpleStruct_DEFAULT *PartialSimple 2014 2015 func (p *PartialNesting) GetSimpleStruct() (v *PartialSimple) { 2016 if !p.IsSetSimpleStruct() { 2017 return PartialNesting_SimpleStruct_DEFAULT 2018 } 2019 return p.SimpleStruct 2020 } 2021 2022 func (p *PartialNesting) GetMapStringSimple() (v map[string]*PartialSimple) { 2023 return p.MapStringSimple 2024 } 2025 func (p *PartialNesting) SetListSimple(val []*PartialSimple) { 2026 p.ListSimple = val 2027 } 2028 func (p *PartialNesting) SetSimpleStruct(val *PartialSimple) { 2029 p.SimpleStruct = val 2030 } 2031 func (p *PartialNesting) SetMapStringSimple(val map[string]*PartialSimple) { 2032 p.MapStringSimple = val 2033 } 2034 2035 var fieldIDToName_PartialNesting = map[int16]string{ 2036 2: "ListSimple", 2037 8: "SimpleStruct", 2038 15: "MapStringSimple", 2039 } 2040 2041 func (p *PartialNesting) IsSetSimpleStruct() bool { 2042 return p.SimpleStruct != nil 2043 } 2044 2045 func (p *PartialNesting) Read(iprot thrift.TProtocol) (err error) { 2046 2047 var fieldTypeId thrift.TType 2048 var fieldId int16 2049 2050 if _, err = iprot.ReadStructBegin(); err != nil { 2051 goto ReadStructBeginError 2052 } 2053 2054 for { 2055 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 2056 if err != nil { 2057 goto ReadFieldBeginError 2058 } 2059 if fieldTypeId == thrift.STOP { 2060 break 2061 } 2062 2063 switch fieldId { 2064 case 2: 2065 if fieldTypeId == thrift.LIST { 2066 if err = p.ReadField2(iprot); err != nil { 2067 goto ReadFieldError 2068 } 2069 } else { 2070 if err = iprot.Skip(fieldTypeId); err != nil { 2071 goto SkipFieldError 2072 } 2073 } 2074 case 8: 2075 if fieldTypeId == thrift.STRUCT { 2076 if err = p.ReadField8(iprot); err != nil { 2077 goto ReadFieldError 2078 } 2079 } else { 2080 if err = iprot.Skip(fieldTypeId); err != nil { 2081 goto SkipFieldError 2082 } 2083 } 2084 case 15: 2085 if fieldTypeId == thrift.MAP { 2086 if err = p.ReadField15(iprot); err != nil { 2087 goto ReadFieldError 2088 } 2089 } else { 2090 if err = iprot.Skip(fieldTypeId); err != nil { 2091 goto SkipFieldError 2092 } 2093 } 2094 default: 2095 if err = iprot.Skip(fieldTypeId); err != nil { 2096 goto SkipFieldError 2097 } 2098 } 2099 2100 if err = iprot.ReadFieldEnd(); err != nil { 2101 goto ReadFieldEndError 2102 } 2103 } 2104 if err = iprot.ReadStructEnd(); err != nil { 2105 goto ReadStructEndError 2106 } 2107 2108 return nil 2109 ReadStructBeginError: 2110 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 2111 ReadFieldBeginError: 2112 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 2113 ReadFieldError: 2114 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PartialNesting[fieldId]), err) 2115 SkipFieldError: 2116 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 2117 2118 ReadFieldEndError: 2119 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 2120 ReadStructEndError: 2121 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2122 } 2123 2124 func (p *PartialNesting) ReadField2(iprot thrift.TProtocol) error { 2125 _, size, err := iprot.ReadListBegin() 2126 if err != nil { 2127 return err 2128 } 2129 p.ListSimple = make([]*PartialSimple, 0, size) 2130 for i := 0; i < size; i++ { 2131 _elem := NewPartialSimple() 2132 if err := _elem.Read(iprot); err != nil { 2133 return err 2134 } 2135 2136 p.ListSimple = append(p.ListSimple, _elem) 2137 } 2138 if err := iprot.ReadListEnd(); err != nil { 2139 return err 2140 } 2141 return nil 2142 } 2143 2144 func (p *PartialNesting) ReadField8(iprot thrift.TProtocol) error { 2145 p.SimpleStruct = NewPartialSimple() 2146 if err := p.SimpleStruct.Read(iprot); err != nil { 2147 return err 2148 } 2149 return nil 2150 } 2151 2152 func (p *PartialNesting) ReadField15(iprot thrift.TProtocol) error { 2153 _, _, size, err := iprot.ReadMapBegin() 2154 if err != nil { 2155 return err 2156 } 2157 p.MapStringSimple = make(map[string]*PartialSimple, size) 2158 for i := 0; i < size; i++ { 2159 var _key string 2160 if v, err := iprot.ReadString(); err != nil { 2161 return err 2162 } else { 2163 _key = v 2164 } 2165 _val := NewPartialSimple() 2166 if err := _val.Read(iprot); err != nil { 2167 return err 2168 } 2169 2170 p.MapStringSimple[_key] = _val 2171 } 2172 if err := iprot.ReadMapEnd(); err != nil { 2173 return err 2174 } 2175 return nil 2176 } 2177 2178 func (p *PartialNesting) Write(oprot thrift.TProtocol) (err error) { 2179 var fieldId int16 2180 if err = oprot.WriteStructBegin("PartialNesting"); err != nil { 2181 goto WriteStructBeginError 2182 } 2183 if p != nil { 2184 if err = p.writeField2(oprot); err != nil { 2185 fieldId = 2 2186 goto WriteFieldError 2187 } 2188 if err = p.writeField8(oprot); err != nil { 2189 fieldId = 8 2190 goto WriteFieldError 2191 } 2192 if err = p.writeField15(oprot); err != nil { 2193 fieldId = 15 2194 goto WriteFieldError 2195 } 2196 2197 } 2198 if err = oprot.WriteFieldStop(); err != nil { 2199 goto WriteFieldStopError 2200 } 2201 if err = oprot.WriteStructEnd(); err != nil { 2202 goto WriteStructEndError 2203 } 2204 return nil 2205 WriteStructBeginError: 2206 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2207 WriteFieldError: 2208 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 2209 WriteFieldStopError: 2210 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 2211 WriteStructEndError: 2212 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 2213 } 2214 2215 func (p *PartialNesting) writeField2(oprot thrift.TProtocol) (err error) { 2216 if err = oprot.WriteFieldBegin("ListSimple", thrift.LIST, 2); err != nil { 2217 goto WriteFieldBeginError 2218 } 2219 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.ListSimple)); err != nil { 2220 return err 2221 } 2222 for _, v := range p.ListSimple { 2223 if err := v.Write(oprot); err != nil { 2224 return err 2225 } 2226 } 2227 if err := oprot.WriteListEnd(); err != nil { 2228 return err 2229 } 2230 if err = oprot.WriteFieldEnd(); err != nil { 2231 goto WriteFieldEndError 2232 } 2233 return nil 2234 WriteFieldBeginError: 2235 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 2236 WriteFieldEndError: 2237 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 2238 } 2239 2240 func (p *PartialNesting) writeField8(oprot thrift.TProtocol) (err error) { 2241 if err = oprot.WriteFieldBegin("SimpleStruct", thrift.STRUCT, 8); err != nil { 2242 goto WriteFieldBeginError 2243 } 2244 if err := p.SimpleStruct.Write(oprot); err != nil { 2245 return err 2246 } 2247 if err = oprot.WriteFieldEnd(); err != nil { 2248 goto WriteFieldEndError 2249 } 2250 return nil 2251 WriteFieldBeginError: 2252 return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err) 2253 WriteFieldEndError: 2254 return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err) 2255 } 2256 2257 func (p *PartialNesting) writeField15(oprot thrift.TProtocol) (err error) { 2258 if err = oprot.WriteFieldBegin("MapStringSimple", thrift.MAP, 15); err != nil { 2259 goto WriteFieldBeginError 2260 } 2261 if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.MapStringSimple)); err != nil { 2262 return err 2263 } 2264 for k, v := range p.MapStringSimple { 2265 2266 if err := oprot.WriteString(k); err != nil { 2267 return err 2268 } 2269 2270 if err := v.Write(oprot); err != nil { 2271 return err 2272 } 2273 } 2274 if err := oprot.WriteMapEnd(); err != nil { 2275 return err 2276 } 2277 if err = oprot.WriteFieldEnd(); err != nil { 2278 goto WriteFieldEndError 2279 } 2280 return nil 2281 WriteFieldBeginError: 2282 return thrift.PrependError(fmt.Sprintf("%T write field 15 begin error: ", p), err) 2283 WriteFieldEndError: 2284 return thrift.PrependError(fmt.Sprintf("%T write field 15 end error: ", p), err) 2285 } 2286 2287 func (p *PartialNesting) String() string { 2288 if p == nil { 2289 return "<nil>" 2290 } 2291 return fmt.Sprintf("PartialNesting(%+v)", *p) 2292 } 2293 2294 func (p *PartialNesting) DeepEqual(ano *PartialNesting) bool { 2295 if p == ano { 2296 return true 2297 } else if p == nil || ano == nil { 2298 return false 2299 } 2300 if !p.Field2DeepEqual(ano.ListSimple) { 2301 return false 2302 } 2303 if !p.Field8DeepEqual(ano.SimpleStruct) { 2304 return false 2305 } 2306 if !p.Field15DeepEqual(ano.MapStringSimple) { 2307 return false 2308 } 2309 return true 2310 } 2311 2312 func (p *PartialNesting) Field2DeepEqual(src []*PartialSimple) bool { 2313 2314 if len(p.ListSimple) != len(src) { 2315 return false 2316 } 2317 for i, v := range p.ListSimple { 2318 _src := src[i] 2319 if !v.DeepEqual(_src) { 2320 return false 2321 } 2322 } 2323 return true 2324 } 2325 func (p *PartialNesting) Field8DeepEqual(src *PartialSimple) bool { 2326 2327 if !p.SimpleStruct.DeepEqual(src) { 2328 return false 2329 } 2330 return true 2331 } 2332 func (p *PartialNesting) Field15DeepEqual(src map[string]*PartialSimple) bool { 2333 2334 if len(p.MapStringSimple) != len(src) { 2335 return false 2336 } 2337 for k, v := range p.MapStringSimple { 2338 _src := src[k] 2339 if !v.DeepEqual(_src) { 2340 return false 2341 } 2342 } 2343 return true 2344 } 2345 2346 type Nesting2 struct { 2347 MapSimpleNesting map[*Simple]*Nesting `thrift:"MapSimpleNesting,1" json:"MapSimpleNesting"` 2348 SimpleStruct *Simple `thrift:"SimpleStruct,2" json:"SimpleStruct"` 2349 Byte int8 `thrift:"Byte,3" json:"Byte"` 2350 Double float64 `thrift:"Double,4" json:"Double"` 2351 ListNesting []*Nesting `thrift:"ListNesting,5" json:"ListNesting"` 2352 I64 int64 `thrift:"I64,6" json:"I64"` 2353 NestingStruct *Nesting `thrift:"NestingStruct,7" json:"NestingStruct"` 2354 Binary []byte `thrift:"Binary,8" json:"Binary"` 2355 String_ string `thrift:"String,9" json:"String"` 2356 SetNesting []*Nesting `thrift:"SetNesting,10" json:"SetNesting"` 2357 I32 int32 `thrift:"I32,11" json:"I32"` 2358 } 2359 2360 func NewNesting2() *Nesting2 { 2361 return &Nesting2{} 2362 } 2363 2364 func (p *Nesting2) GetMapSimpleNesting() (v map[*Simple]*Nesting) { 2365 return p.MapSimpleNesting 2366 } 2367 2368 var Nesting2_SimpleStruct_DEFAULT *Simple 2369 2370 func (p *Nesting2) GetSimpleStruct() (v *Simple) { 2371 if !p.IsSetSimpleStruct() { 2372 return Nesting2_SimpleStruct_DEFAULT 2373 } 2374 return p.SimpleStruct 2375 } 2376 2377 func (p *Nesting2) GetByte() (v int8) { 2378 return p.Byte 2379 } 2380 2381 func (p *Nesting2) GetDouble() (v float64) { 2382 return p.Double 2383 } 2384 2385 func (p *Nesting2) GetListNesting() (v []*Nesting) { 2386 return p.ListNesting 2387 } 2388 2389 func (p *Nesting2) GetI64() (v int64) { 2390 return p.I64 2391 } 2392 2393 var Nesting2_NestingStruct_DEFAULT *Nesting 2394 2395 func (p *Nesting2) GetNestingStruct() (v *Nesting) { 2396 if !p.IsSetNestingStruct() { 2397 return Nesting2_NestingStruct_DEFAULT 2398 } 2399 return p.NestingStruct 2400 } 2401 2402 func (p *Nesting2) GetBinary() (v []byte) { 2403 return p.Binary 2404 } 2405 2406 func (p *Nesting2) GetString() (v string) { 2407 return p.String_ 2408 } 2409 2410 func (p *Nesting2) GetSetNesting() (v []*Nesting) { 2411 return p.SetNesting 2412 } 2413 2414 func (p *Nesting2) GetI32() (v int32) { 2415 return p.I32 2416 } 2417 func (p *Nesting2) SetMapSimpleNesting(val map[*Simple]*Nesting) { 2418 p.MapSimpleNesting = val 2419 } 2420 func (p *Nesting2) SetSimpleStruct(val *Simple) { 2421 p.SimpleStruct = val 2422 } 2423 func (p *Nesting2) SetByte(val int8) { 2424 p.Byte = val 2425 } 2426 func (p *Nesting2) SetDouble(val float64) { 2427 p.Double = val 2428 } 2429 func (p *Nesting2) SetListNesting(val []*Nesting) { 2430 p.ListNesting = val 2431 } 2432 func (p *Nesting2) SetI64(val int64) { 2433 p.I64 = val 2434 } 2435 func (p *Nesting2) SetNestingStruct(val *Nesting) { 2436 p.NestingStruct = val 2437 } 2438 func (p *Nesting2) SetBinary(val []byte) { 2439 p.Binary = val 2440 } 2441 func (p *Nesting2) SetString(val string) { 2442 p.String_ = val 2443 } 2444 func (p *Nesting2) SetSetNesting(val []*Nesting) { 2445 p.SetNesting = val 2446 } 2447 func (p *Nesting2) SetI32(val int32) { 2448 p.I32 = val 2449 } 2450 2451 var fieldIDToName_Nesting2 = map[int16]string{ 2452 1: "MapSimpleNesting", 2453 2: "SimpleStruct", 2454 3: "Byte", 2455 4: "Double", 2456 5: "ListNesting", 2457 6: "I64", 2458 7: "NestingStruct", 2459 8: "Binary", 2460 9: "String", 2461 10: "SetNesting", 2462 11: "I32", 2463 } 2464 2465 func (p *Nesting2) IsSetSimpleStruct() bool { 2466 return p.SimpleStruct != nil 2467 } 2468 2469 func (p *Nesting2) IsSetNestingStruct() bool { 2470 return p.NestingStruct != nil 2471 } 2472 2473 func (p *Nesting2) Read(iprot thrift.TProtocol) (err error) { 2474 2475 var fieldTypeId thrift.TType 2476 var fieldId int16 2477 2478 if _, err = iprot.ReadStructBegin(); err != nil { 2479 goto ReadStructBeginError 2480 } 2481 2482 for { 2483 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 2484 if err != nil { 2485 goto ReadFieldBeginError 2486 } 2487 if fieldTypeId == thrift.STOP { 2488 break 2489 } 2490 2491 switch fieldId { 2492 case 1: 2493 if fieldTypeId == thrift.MAP { 2494 if err = p.ReadField1(iprot); err != nil { 2495 goto ReadFieldError 2496 } 2497 } else { 2498 if err = iprot.Skip(fieldTypeId); err != nil { 2499 goto SkipFieldError 2500 } 2501 } 2502 case 2: 2503 if fieldTypeId == thrift.STRUCT { 2504 if err = p.ReadField2(iprot); err != nil { 2505 goto ReadFieldError 2506 } 2507 } else { 2508 if err = iprot.Skip(fieldTypeId); err != nil { 2509 goto SkipFieldError 2510 } 2511 } 2512 case 3: 2513 if fieldTypeId == thrift.BYTE { 2514 if err = p.ReadField3(iprot); err != nil { 2515 goto ReadFieldError 2516 } 2517 } else { 2518 if err = iprot.Skip(fieldTypeId); err != nil { 2519 goto SkipFieldError 2520 } 2521 } 2522 case 4: 2523 if fieldTypeId == thrift.DOUBLE { 2524 if err = p.ReadField4(iprot); err != nil { 2525 goto ReadFieldError 2526 } 2527 } else { 2528 if err = iprot.Skip(fieldTypeId); err != nil { 2529 goto SkipFieldError 2530 } 2531 } 2532 case 5: 2533 if fieldTypeId == thrift.LIST { 2534 if err = p.ReadField5(iprot); err != nil { 2535 goto ReadFieldError 2536 } 2537 } else { 2538 if err = iprot.Skip(fieldTypeId); err != nil { 2539 goto SkipFieldError 2540 } 2541 } 2542 case 6: 2543 if fieldTypeId == thrift.I64 { 2544 if err = p.ReadField6(iprot); err != nil { 2545 goto ReadFieldError 2546 } 2547 } else { 2548 if err = iprot.Skip(fieldTypeId); err != nil { 2549 goto SkipFieldError 2550 } 2551 } 2552 case 7: 2553 if fieldTypeId == thrift.STRUCT { 2554 if err = p.ReadField7(iprot); err != nil { 2555 goto ReadFieldError 2556 } 2557 } else { 2558 if err = iprot.Skip(fieldTypeId); err != nil { 2559 goto SkipFieldError 2560 } 2561 } 2562 case 8: 2563 if fieldTypeId == thrift.STRING { 2564 if err = p.ReadField8(iprot); err != nil { 2565 goto ReadFieldError 2566 } 2567 } else { 2568 if err = iprot.Skip(fieldTypeId); err != nil { 2569 goto SkipFieldError 2570 } 2571 } 2572 case 9: 2573 if fieldTypeId == thrift.STRING { 2574 if err = p.ReadField9(iprot); err != nil { 2575 goto ReadFieldError 2576 } 2577 } else { 2578 if err = iprot.Skip(fieldTypeId); err != nil { 2579 goto SkipFieldError 2580 } 2581 } 2582 case 10: 2583 if fieldTypeId == thrift.SET { 2584 if err = p.ReadField10(iprot); err != nil { 2585 goto ReadFieldError 2586 } 2587 } else { 2588 if err = iprot.Skip(fieldTypeId); err != nil { 2589 goto SkipFieldError 2590 } 2591 } 2592 case 11: 2593 if fieldTypeId == thrift.I32 { 2594 if err = p.ReadField11(iprot); err != nil { 2595 goto ReadFieldError 2596 } 2597 } else { 2598 if err = iprot.Skip(fieldTypeId); err != nil { 2599 goto SkipFieldError 2600 } 2601 } 2602 default: 2603 if err = iprot.Skip(fieldTypeId); err != nil { 2604 goto SkipFieldError 2605 } 2606 } 2607 2608 if err = iprot.ReadFieldEnd(); err != nil { 2609 goto ReadFieldEndError 2610 } 2611 } 2612 if err = iprot.ReadStructEnd(); err != nil { 2613 goto ReadStructEndError 2614 } 2615 2616 return nil 2617 ReadStructBeginError: 2618 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 2619 ReadFieldBeginError: 2620 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 2621 ReadFieldError: 2622 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Nesting2[fieldId]), err) 2623 SkipFieldError: 2624 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 2625 2626 ReadFieldEndError: 2627 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 2628 ReadStructEndError: 2629 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2630 } 2631 2632 func (p *Nesting2) ReadField1(iprot thrift.TProtocol) error { 2633 _, _, size, err := iprot.ReadMapBegin() 2634 if err != nil { 2635 return err 2636 } 2637 p.MapSimpleNesting = make(map[*Simple]*Nesting, size) 2638 for i := 0; i < size; i++ { 2639 _key := NewSimple() 2640 if err := _key.Read(iprot); err != nil { 2641 return err 2642 } 2643 _val := NewNesting() 2644 if err := _val.Read(iprot); err != nil { 2645 return err 2646 } 2647 2648 p.MapSimpleNesting[_key] = _val 2649 } 2650 if err := iprot.ReadMapEnd(); err != nil { 2651 return err 2652 } 2653 return nil 2654 } 2655 2656 func (p *Nesting2) ReadField2(iprot thrift.TProtocol) error { 2657 p.SimpleStruct = NewSimple() 2658 if err := p.SimpleStruct.Read(iprot); err != nil { 2659 return err 2660 } 2661 return nil 2662 } 2663 2664 func (p *Nesting2) ReadField3(iprot thrift.TProtocol) error { 2665 if v, err := iprot.ReadByte(); err != nil { 2666 return err 2667 } else { 2668 p.Byte = v 2669 } 2670 return nil 2671 } 2672 2673 func (p *Nesting2) ReadField4(iprot thrift.TProtocol) error { 2674 if v, err := iprot.ReadDouble(); err != nil { 2675 return err 2676 } else { 2677 p.Double = v 2678 } 2679 return nil 2680 } 2681 2682 func (p *Nesting2) ReadField5(iprot thrift.TProtocol) error { 2683 _, size, err := iprot.ReadListBegin() 2684 if err != nil { 2685 return err 2686 } 2687 p.ListNesting = make([]*Nesting, 0, size) 2688 for i := 0; i < size; i++ { 2689 _elem := NewNesting() 2690 if err := _elem.Read(iprot); err != nil { 2691 return err 2692 } 2693 2694 p.ListNesting = append(p.ListNesting, _elem) 2695 } 2696 if err := iprot.ReadListEnd(); err != nil { 2697 return err 2698 } 2699 return nil 2700 } 2701 2702 func (p *Nesting2) ReadField6(iprot thrift.TProtocol) error { 2703 if v, err := iprot.ReadI64(); err != nil { 2704 return err 2705 } else { 2706 p.I64 = v 2707 } 2708 return nil 2709 } 2710 2711 func (p *Nesting2) ReadField7(iprot thrift.TProtocol) error { 2712 p.NestingStruct = NewNesting() 2713 if err := p.NestingStruct.Read(iprot); err != nil { 2714 return err 2715 } 2716 return nil 2717 } 2718 2719 func (p *Nesting2) ReadField8(iprot thrift.TProtocol) error { 2720 if v, err := iprot.ReadBinary(); err != nil { 2721 return err 2722 } else { 2723 p.Binary = []byte(v) 2724 } 2725 return nil 2726 } 2727 2728 func (p *Nesting2) ReadField9(iprot thrift.TProtocol) error { 2729 if v, err := iprot.ReadString(); err != nil { 2730 return err 2731 } else { 2732 p.String_ = v 2733 } 2734 return nil 2735 } 2736 2737 func (p *Nesting2) ReadField10(iprot thrift.TProtocol) error { 2738 _, size, err := iprot.ReadSetBegin() 2739 if err != nil { 2740 return err 2741 } 2742 p.SetNesting = make([]*Nesting, 0, size) 2743 for i := 0; i < size; i++ { 2744 _elem := NewNesting() 2745 if err := _elem.Read(iprot); err != nil { 2746 return err 2747 } 2748 2749 p.SetNesting = append(p.SetNesting, _elem) 2750 } 2751 if err := iprot.ReadSetEnd(); err != nil { 2752 return err 2753 } 2754 return nil 2755 } 2756 2757 func (p *Nesting2) ReadField11(iprot thrift.TProtocol) error { 2758 if v, err := iprot.ReadI32(); err != nil { 2759 return err 2760 } else { 2761 p.I32 = v 2762 } 2763 return nil 2764 } 2765 2766 func (p *Nesting2) Write(oprot thrift.TProtocol) (err error) { 2767 var fieldId int16 2768 if err = oprot.WriteStructBegin("Nesting2"); err != nil { 2769 goto WriteStructBeginError 2770 } 2771 if p != nil { 2772 if err = p.writeField1(oprot); err != nil { 2773 fieldId = 1 2774 goto WriteFieldError 2775 } 2776 if err = p.writeField2(oprot); err != nil { 2777 fieldId = 2 2778 goto WriteFieldError 2779 } 2780 if err = p.writeField3(oprot); err != nil { 2781 fieldId = 3 2782 goto WriteFieldError 2783 } 2784 if err = p.writeField4(oprot); err != nil { 2785 fieldId = 4 2786 goto WriteFieldError 2787 } 2788 if err = p.writeField5(oprot); err != nil { 2789 fieldId = 5 2790 goto WriteFieldError 2791 } 2792 if err = p.writeField6(oprot); err != nil { 2793 fieldId = 6 2794 goto WriteFieldError 2795 } 2796 if err = p.writeField7(oprot); err != nil { 2797 fieldId = 7 2798 goto WriteFieldError 2799 } 2800 if err = p.writeField8(oprot); err != nil { 2801 fieldId = 8 2802 goto WriteFieldError 2803 } 2804 if err = p.writeField9(oprot); err != nil { 2805 fieldId = 9 2806 goto WriteFieldError 2807 } 2808 if err = p.writeField10(oprot); err != nil { 2809 fieldId = 10 2810 goto WriteFieldError 2811 } 2812 if err = p.writeField11(oprot); err != nil { 2813 fieldId = 11 2814 goto WriteFieldError 2815 } 2816 2817 } 2818 if err = oprot.WriteFieldStop(); err != nil { 2819 goto WriteFieldStopError 2820 } 2821 if err = oprot.WriteStructEnd(); err != nil { 2822 goto WriteStructEndError 2823 } 2824 return nil 2825 WriteStructBeginError: 2826 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2827 WriteFieldError: 2828 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 2829 WriteFieldStopError: 2830 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 2831 WriteStructEndError: 2832 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 2833 } 2834 2835 func (p *Nesting2) writeField1(oprot thrift.TProtocol) (err error) { 2836 if err = oprot.WriteFieldBegin("MapSimpleNesting", thrift.MAP, 1); err != nil { 2837 goto WriteFieldBeginError 2838 } 2839 if err := oprot.WriteMapBegin(thrift.STRUCT, thrift.STRUCT, len(p.MapSimpleNesting)); err != nil { 2840 return err 2841 } 2842 for k, v := range p.MapSimpleNesting { 2843 2844 if err := k.Write(oprot); err != nil { 2845 return err 2846 } 2847 2848 if err := v.Write(oprot); err != nil { 2849 return err 2850 } 2851 } 2852 if err := oprot.WriteMapEnd(); err != nil { 2853 return err 2854 } 2855 if err = oprot.WriteFieldEnd(); err != nil { 2856 goto WriteFieldEndError 2857 } 2858 return nil 2859 WriteFieldBeginError: 2860 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 2861 WriteFieldEndError: 2862 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 2863 } 2864 2865 func (p *Nesting2) writeField2(oprot thrift.TProtocol) (err error) { 2866 if err = oprot.WriteFieldBegin("SimpleStruct", thrift.STRUCT, 2); err != nil { 2867 goto WriteFieldBeginError 2868 } 2869 if err := p.SimpleStruct.Write(oprot); err != nil { 2870 return err 2871 } 2872 if err = oprot.WriteFieldEnd(); err != nil { 2873 goto WriteFieldEndError 2874 } 2875 return nil 2876 WriteFieldBeginError: 2877 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 2878 WriteFieldEndError: 2879 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 2880 } 2881 2882 func (p *Nesting2) writeField3(oprot thrift.TProtocol) (err error) { 2883 if err = oprot.WriteFieldBegin("Byte", thrift.BYTE, 3); err != nil { 2884 goto WriteFieldBeginError 2885 } 2886 if err := oprot.WriteByte(p.Byte); err != nil { 2887 return err 2888 } 2889 if err = oprot.WriteFieldEnd(); err != nil { 2890 goto WriteFieldEndError 2891 } 2892 return nil 2893 WriteFieldBeginError: 2894 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 2895 WriteFieldEndError: 2896 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 2897 } 2898 2899 func (p *Nesting2) writeField4(oprot thrift.TProtocol) (err error) { 2900 if err = oprot.WriteFieldBegin("Double", thrift.DOUBLE, 4); err != nil { 2901 goto WriteFieldBeginError 2902 } 2903 if err := oprot.WriteDouble(p.Double); err != nil { 2904 return err 2905 } 2906 if err = oprot.WriteFieldEnd(); err != nil { 2907 goto WriteFieldEndError 2908 } 2909 return nil 2910 WriteFieldBeginError: 2911 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 2912 WriteFieldEndError: 2913 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 2914 } 2915 2916 func (p *Nesting2) writeField5(oprot thrift.TProtocol) (err error) { 2917 if err = oprot.WriteFieldBegin("ListNesting", thrift.LIST, 5); err != nil { 2918 goto WriteFieldBeginError 2919 } 2920 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.ListNesting)); err != nil { 2921 return err 2922 } 2923 for _, v := range p.ListNesting { 2924 if err := v.Write(oprot); err != nil { 2925 return err 2926 } 2927 } 2928 if err := oprot.WriteListEnd(); err != nil { 2929 return err 2930 } 2931 if err = oprot.WriteFieldEnd(); err != nil { 2932 goto WriteFieldEndError 2933 } 2934 return nil 2935 WriteFieldBeginError: 2936 return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) 2937 WriteFieldEndError: 2938 return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) 2939 } 2940 2941 func (p *Nesting2) writeField6(oprot thrift.TProtocol) (err error) { 2942 if err = oprot.WriteFieldBegin("I64", thrift.I64, 6); err != nil { 2943 goto WriteFieldBeginError 2944 } 2945 if err := oprot.WriteI64(p.I64); err != nil { 2946 return err 2947 } 2948 if err = oprot.WriteFieldEnd(); err != nil { 2949 goto WriteFieldEndError 2950 } 2951 return nil 2952 WriteFieldBeginError: 2953 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 2954 WriteFieldEndError: 2955 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 2956 } 2957 2958 func (p *Nesting2) writeField7(oprot thrift.TProtocol) (err error) { 2959 if err = oprot.WriteFieldBegin("NestingStruct", thrift.STRUCT, 7); err != nil { 2960 goto WriteFieldBeginError 2961 } 2962 if err := p.NestingStruct.Write(oprot); err != nil { 2963 return err 2964 } 2965 if err = oprot.WriteFieldEnd(); err != nil { 2966 goto WriteFieldEndError 2967 } 2968 return nil 2969 WriteFieldBeginError: 2970 return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) 2971 WriteFieldEndError: 2972 return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) 2973 } 2974 2975 func (p *Nesting2) writeField8(oprot thrift.TProtocol) (err error) { 2976 if err = oprot.WriteFieldBegin("Binary", thrift.STRING, 8); err != nil { 2977 goto WriteFieldBeginError 2978 } 2979 if err := oprot.WriteBinary([]byte(p.Binary)); err != nil { 2980 return err 2981 } 2982 if err = oprot.WriteFieldEnd(); err != nil { 2983 goto WriteFieldEndError 2984 } 2985 return nil 2986 WriteFieldBeginError: 2987 return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err) 2988 WriteFieldEndError: 2989 return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err) 2990 } 2991 2992 func (p *Nesting2) writeField9(oprot thrift.TProtocol) (err error) { 2993 if err = oprot.WriteFieldBegin("String", thrift.STRING, 9); err != nil { 2994 goto WriteFieldBeginError 2995 } 2996 if err := oprot.WriteString(p.String_); err != nil { 2997 return err 2998 } 2999 if err = oprot.WriteFieldEnd(); err != nil { 3000 goto WriteFieldEndError 3001 } 3002 return nil 3003 WriteFieldBeginError: 3004 return thrift.PrependError(fmt.Sprintf("%T write field 9 begin error: ", p), err) 3005 WriteFieldEndError: 3006 return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err) 3007 } 3008 3009 func (p *Nesting2) writeField10(oprot thrift.TProtocol) (err error) { 3010 if err = oprot.WriteFieldBegin("SetNesting", thrift.SET, 10); err != nil { 3011 goto WriteFieldBeginError 3012 } 3013 if err := oprot.WriteSetBegin(thrift.STRUCT, len(p.SetNesting)); err != nil { 3014 return err 3015 } 3016 for i := 0; i < len(p.SetNesting); i++ { 3017 for j := i + 1; j < len(p.SetNesting); j++ { 3018 if func(tgt, src *Nesting) bool { 3019 if !tgt.DeepEqual(src) { 3020 return false 3021 } 3022 return true 3023 }(p.SetNesting[i], p.SetNesting[j]) { 3024 return thrift.PrependError("", fmt.Errorf("%T error writing set field: slice is not unique", p.SetNesting[i])) 3025 } 3026 } 3027 } 3028 for _, v := range p.SetNesting { 3029 if err := v.Write(oprot); err != nil { 3030 return err 3031 } 3032 } 3033 if err := oprot.WriteSetEnd(); err != nil { 3034 return err 3035 } 3036 if err = oprot.WriteFieldEnd(); err != nil { 3037 goto WriteFieldEndError 3038 } 3039 return nil 3040 WriteFieldBeginError: 3041 return thrift.PrependError(fmt.Sprintf("%T write field 10 begin error: ", p), err) 3042 WriteFieldEndError: 3043 return thrift.PrependError(fmt.Sprintf("%T write field 10 end error: ", p), err) 3044 } 3045 3046 func (p *Nesting2) writeField11(oprot thrift.TProtocol) (err error) { 3047 if err = oprot.WriteFieldBegin("I32", thrift.I32, 11); err != nil { 3048 goto WriteFieldBeginError 3049 } 3050 if err := oprot.WriteI32(p.I32); err != nil { 3051 return err 3052 } 3053 if err = oprot.WriteFieldEnd(); err != nil { 3054 goto WriteFieldEndError 3055 } 3056 return nil 3057 WriteFieldBeginError: 3058 return thrift.PrependError(fmt.Sprintf("%T write field 11 begin error: ", p), err) 3059 WriteFieldEndError: 3060 return thrift.PrependError(fmt.Sprintf("%T write field 11 end error: ", p), err) 3061 } 3062 3063 func (p *Nesting2) String() string { 3064 if p == nil { 3065 return "<nil>" 3066 } 3067 return fmt.Sprintf("Nesting2(%+v)", *p) 3068 } 3069 3070 func (p *Nesting2) DeepEqual(ano *Nesting2) bool { 3071 if p == ano { 3072 return true 3073 } else if p == nil || ano == nil { 3074 return false 3075 } 3076 if !p.Field1DeepEqual(ano.MapSimpleNesting) { 3077 return false 3078 } 3079 if !p.Field2DeepEqual(ano.SimpleStruct) { 3080 return false 3081 } 3082 if !p.Field3DeepEqual(ano.Byte) { 3083 return false 3084 } 3085 if !p.Field4DeepEqual(ano.Double) { 3086 return false 3087 } 3088 if !p.Field5DeepEqual(ano.ListNesting) { 3089 return false 3090 } 3091 if !p.Field6DeepEqual(ano.I64) { 3092 return false 3093 } 3094 if !p.Field7DeepEqual(ano.NestingStruct) { 3095 return false 3096 } 3097 if !p.Field8DeepEqual(ano.Binary) { 3098 return false 3099 } 3100 if !p.Field9DeepEqual(ano.String_) { 3101 return false 3102 } 3103 if !p.Field10DeepEqual(ano.SetNesting) { 3104 return false 3105 } 3106 if !p.Field11DeepEqual(ano.I32) { 3107 return false 3108 } 3109 return true 3110 } 3111 3112 func (p *Nesting2) Field1DeepEqual(src map[*Simple]*Nesting) bool { 3113 3114 if len(p.MapSimpleNesting) != len(src) { 3115 return false 3116 } 3117 for k, v := range p.MapSimpleNesting { 3118 _src := src[k] 3119 if !v.DeepEqual(_src) { 3120 return false 3121 } 3122 } 3123 return true 3124 } 3125 func (p *Nesting2) Field2DeepEqual(src *Simple) bool { 3126 3127 if !p.SimpleStruct.DeepEqual(src) { 3128 return false 3129 } 3130 return true 3131 } 3132 func (p *Nesting2) Field3DeepEqual(src int8) bool { 3133 3134 if p.Byte != src { 3135 return false 3136 } 3137 return true 3138 } 3139 func (p *Nesting2) Field4DeepEqual(src float64) bool { 3140 3141 if p.Double != src { 3142 return false 3143 } 3144 return true 3145 } 3146 func (p *Nesting2) Field5DeepEqual(src []*Nesting) bool { 3147 3148 if len(p.ListNesting) != len(src) { 3149 return false 3150 } 3151 for i, v := range p.ListNesting { 3152 _src := src[i] 3153 if !v.DeepEqual(_src) { 3154 return false 3155 } 3156 } 3157 return true 3158 } 3159 func (p *Nesting2) Field6DeepEqual(src int64) bool { 3160 3161 if p.I64 != src { 3162 return false 3163 } 3164 return true 3165 } 3166 func (p *Nesting2) Field7DeepEqual(src *Nesting) bool { 3167 3168 if !p.NestingStruct.DeepEqual(src) { 3169 return false 3170 } 3171 return true 3172 } 3173 func (p *Nesting2) Field8DeepEqual(src []byte) bool { 3174 3175 if bytes.Compare(p.Binary, src) != 0 { 3176 return false 3177 } 3178 return true 3179 } 3180 func (p *Nesting2) Field9DeepEqual(src string) bool { 3181 3182 if strings.Compare(p.String_, src) != 0 { 3183 return false 3184 } 3185 return true 3186 } 3187 func (p *Nesting2) Field10DeepEqual(src []*Nesting) bool { 3188 3189 if len(p.SetNesting) != len(src) { 3190 return false 3191 } 3192 for i, v := range p.SetNesting { 3193 _src := src[i] 3194 if !v.DeepEqual(_src) { 3195 return false 3196 } 3197 } 3198 return true 3199 } 3200 func (p *Nesting2) Field11DeepEqual(src int32) bool { 3201 3202 if p.I32 != src { 3203 return false 3204 } 3205 return true 3206 } 3207 3208 type BaselineService interface { 3209 SimpleMethod(ctx context.Context, req *Simple) (r *Simple, err error) 3210 3211 PartialSimpleMethod(ctx context.Context, req *PartialSimple) (r *PartialSimple, err error) 3212 3213 NestingMethod(ctx context.Context, req *Nesting) (r *Nesting, err error) 3214 3215 PartialNestingMethod(ctx context.Context, req *PartialNesting) (r *PartialNesting, err error) 3216 3217 Nesting2Method(ctx context.Context, req *Nesting2) (r *Nesting2, err error) 3218 } 3219 3220 type BaselineServiceClient struct { 3221 c thrift.TClient 3222 } 3223 3224 func NewBaselineServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *BaselineServiceClient { 3225 return &BaselineServiceClient{ 3226 c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), 3227 } 3228 } 3229 3230 func NewBaselineServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *BaselineServiceClient { 3231 return &BaselineServiceClient{ 3232 c: thrift.NewTStandardClient(iprot, oprot), 3233 } 3234 } 3235 3236 func NewBaselineServiceClient(c thrift.TClient) *BaselineServiceClient { 3237 return &BaselineServiceClient{ 3238 c: c, 3239 } 3240 } 3241 3242 func (p *BaselineServiceClient) Client_() thrift.TClient { 3243 return p.c 3244 } 3245 3246 func (p *BaselineServiceClient) SimpleMethod(ctx context.Context, req *Simple) (r *Simple, err error) { 3247 var _args BaselineServiceSimpleMethodArgs 3248 _args.Req = req 3249 var _result BaselineServiceSimpleMethodResult 3250 if err = p.Client_().Call(ctx, "SimpleMethod", &_args, &_result); err != nil { 3251 return 3252 } 3253 return _result.GetSuccess(), nil 3254 } 3255 3256 func (p *BaselineServiceClient) PartialSimpleMethod(ctx context.Context, req *PartialSimple) (r *PartialSimple, err error) { 3257 var _args BaselineServicePartialSimpleMethodArgs 3258 _args.Req = req 3259 var _result BaselineServicePartialSimpleMethodResult 3260 if err = p.Client_().Call(ctx, "PartialSimpleMethod", &_args, &_result); err != nil { 3261 return 3262 } 3263 return _result.GetSuccess(), nil 3264 } 3265 3266 func (p *BaselineServiceClient) NestingMethod(ctx context.Context, req *Nesting) (r *Nesting, err error) { 3267 var _args BaselineServiceNestingMethodArgs 3268 _args.Req = req 3269 var _result BaselineServiceNestingMethodResult 3270 if err = p.Client_().Call(ctx, "NestingMethod", &_args, &_result); err != nil { 3271 return 3272 } 3273 return _result.GetSuccess(), nil 3274 } 3275 3276 func (p *BaselineServiceClient) PartialNestingMethod(ctx context.Context, req *PartialNesting) (r *PartialNesting, err error) { 3277 var _args BaselineServicePartialNestingMethodArgs 3278 _args.Req = req 3279 var _result BaselineServicePartialNestingMethodResult 3280 if err = p.Client_().Call(ctx, "PartialNestingMethod", &_args, &_result); err != nil { 3281 return 3282 } 3283 return _result.GetSuccess(), nil 3284 } 3285 3286 func (p *BaselineServiceClient) Nesting2Method(ctx context.Context, req *Nesting2) (r *Nesting2, err error) { 3287 var _args BaselineServiceNesting2MethodArgs 3288 _args.Req = req 3289 var _result BaselineServiceNesting2MethodResult 3290 if err = p.Client_().Call(ctx, "Nesting2Method", &_args, &_result); err != nil { 3291 return 3292 } 3293 return _result.GetSuccess(), nil 3294 } 3295 3296 type BaselineServiceProcessor struct { 3297 processorMap map[string]thrift.TProcessorFunction 3298 handler BaselineService 3299 } 3300 3301 func (p *BaselineServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { 3302 p.processorMap[key] = processor 3303 } 3304 3305 func (p *BaselineServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { 3306 processor, ok = p.processorMap[key] 3307 return processor, ok 3308 } 3309 3310 func (p *BaselineServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { 3311 return p.processorMap 3312 } 3313 3314 func NewBaselineServiceProcessor(handler BaselineService) *BaselineServiceProcessor { 3315 self := &BaselineServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} 3316 self.AddToProcessorMap("SimpleMethod", &baselineServiceProcessorSimpleMethod{handler: handler}) 3317 self.AddToProcessorMap("PartialSimpleMethod", &baselineServiceProcessorPartialSimpleMethod{handler: handler}) 3318 self.AddToProcessorMap("NestingMethod", &baselineServiceProcessorNestingMethod{handler: handler}) 3319 self.AddToProcessorMap("PartialNestingMethod", &baselineServiceProcessorPartialNestingMethod{handler: handler}) 3320 self.AddToProcessorMap("Nesting2Method", &baselineServiceProcessorNesting2Method{handler: handler}) 3321 return self 3322 } 3323 func (p *BaselineServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 3324 name, _, seqId, err := iprot.ReadMessageBegin() 3325 if err != nil { 3326 return false, err 3327 } 3328 if processor, ok := p.GetProcessorFunction(name); ok { 3329 return processor.Process(ctx, seqId, iprot, oprot) 3330 } 3331 iprot.Skip(thrift.STRUCT) 3332 iprot.ReadMessageEnd() 3333 x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) 3334 oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) 3335 x.Write(oprot) 3336 oprot.WriteMessageEnd() 3337 oprot.Flush(ctx) 3338 return false, x 3339 } 3340 3341 type baselineServiceProcessorSimpleMethod struct { 3342 handler BaselineService 3343 } 3344 3345 func (p *baselineServiceProcessorSimpleMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 3346 args := BaselineServiceSimpleMethodArgs{} 3347 if err = args.Read(iprot); err != nil { 3348 iprot.ReadMessageEnd() 3349 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 3350 oprot.WriteMessageBegin("SimpleMethod", thrift.EXCEPTION, seqId) 3351 x.Write(oprot) 3352 oprot.WriteMessageEnd() 3353 oprot.Flush(ctx) 3354 return false, err 3355 } 3356 3357 iprot.ReadMessageEnd() 3358 var err2 error 3359 result := BaselineServiceSimpleMethodResult{} 3360 var retval *Simple 3361 if retval, err2 = p.handler.SimpleMethod(ctx, args.Req); err2 != nil { 3362 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing SimpleMethod: "+err2.Error()) 3363 oprot.WriteMessageBegin("SimpleMethod", thrift.EXCEPTION, seqId) 3364 x.Write(oprot) 3365 oprot.WriteMessageEnd() 3366 oprot.Flush(ctx) 3367 return true, err2 3368 } else { 3369 result.Success = retval 3370 } 3371 if err2 = oprot.WriteMessageBegin("SimpleMethod", thrift.REPLY, seqId); err2 != nil { 3372 err = err2 3373 } 3374 if err2 = result.Write(oprot); err == nil && err2 != nil { 3375 err = err2 3376 } 3377 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 3378 err = err2 3379 } 3380 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 3381 err = err2 3382 } 3383 if err != nil { 3384 return 3385 } 3386 return true, err 3387 } 3388 3389 type baselineServiceProcessorPartialSimpleMethod struct { 3390 handler BaselineService 3391 } 3392 3393 func (p *baselineServiceProcessorPartialSimpleMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 3394 args := BaselineServicePartialSimpleMethodArgs{} 3395 if err = args.Read(iprot); err != nil { 3396 iprot.ReadMessageEnd() 3397 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 3398 oprot.WriteMessageBegin("PartialSimpleMethod", thrift.EXCEPTION, seqId) 3399 x.Write(oprot) 3400 oprot.WriteMessageEnd() 3401 oprot.Flush(ctx) 3402 return false, err 3403 } 3404 3405 iprot.ReadMessageEnd() 3406 var err2 error 3407 result := BaselineServicePartialSimpleMethodResult{} 3408 var retval *PartialSimple 3409 if retval, err2 = p.handler.PartialSimpleMethod(ctx, args.Req); err2 != nil { 3410 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing PartialSimpleMethod: "+err2.Error()) 3411 oprot.WriteMessageBegin("PartialSimpleMethod", thrift.EXCEPTION, seqId) 3412 x.Write(oprot) 3413 oprot.WriteMessageEnd() 3414 oprot.Flush(ctx) 3415 return true, err2 3416 } else { 3417 result.Success = retval 3418 } 3419 if err2 = oprot.WriteMessageBegin("PartialSimpleMethod", thrift.REPLY, seqId); err2 != nil { 3420 err = err2 3421 } 3422 if err2 = result.Write(oprot); err == nil && err2 != nil { 3423 err = err2 3424 } 3425 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 3426 err = err2 3427 } 3428 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 3429 err = err2 3430 } 3431 if err != nil { 3432 return 3433 } 3434 return true, err 3435 } 3436 3437 type baselineServiceProcessorNestingMethod struct { 3438 handler BaselineService 3439 } 3440 3441 func (p *baselineServiceProcessorNestingMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 3442 args := BaselineServiceNestingMethodArgs{} 3443 if err = args.Read(iprot); err != nil { 3444 iprot.ReadMessageEnd() 3445 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 3446 oprot.WriteMessageBegin("NestingMethod", thrift.EXCEPTION, seqId) 3447 x.Write(oprot) 3448 oprot.WriteMessageEnd() 3449 oprot.Flush(ctx) 3450 return false, err 3451 } 3452 3453 iprot.ReadMessageEnd() 3454 var err2 error 3455 result := BaselineServiceNestingMethodResult{} 3456 var retval *Nesting 3457 if retval, err2 = p.handler.NestingMethod(ctx, args.Req); err2 != nil { 3458 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing NestingMethod: "+err2.Error()) 3459 oprot.WriteMessageBegin("NestingMethod", thrift.EXCEPTION, seqId) 3460 x.Write(oprot) 3461 oprot.WriteMessageEnd() 3462 oprot.Flush(ctx) 3463 return true, err2 3464 } else { 3465 result.Success = retval 3466 } 3467 if err2 = oprot.WriteMessageBegin("NestingMethod", thrift.REPLY, seqId); err2 != nil { 3468 err = err2 3469 } 3470 if err2 = result.Write(oprot); err == nil && err2 != nil { 3471 err = err2 3472 } 3473 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 3474 err = err2 3475 } 3476 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 3477 err = err2 3478 } 3479 if err != nil { 3480 return 3481 } 3482 return true, err 3483 } 3484 3485 type baselineServiceProcessorPartialNestingMethod struct { 3486 handler BaselineService 3487 } 3488 3489 func (p *baselineServiceProcessorPartialNestingMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 3490 args := BaselineServicePartialNestingMethodArgs{} 3491 if err = args.Read(iprot); err != nil { 3492 iprot.ReadMessageEnd() 3493 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 3494 oprot.WriteMessageBegin("PartialNestingMethod", thrift.EXCEPTION, seqId) 3495 x.Write(oprot) 3496 oprot.WriteMessageEnd() 3497 oprot.Flush(ctx) 3498 return false, err 3499 } 3500 3501 iprot.ReadMessageEnd() 3502 var err2 error 3503 result := BaselineServicePartialNestingMethodResult{} 3504 var retval *PartialNesting 3505 if retval, err2 = p.handler.PartialNestingMethod(ctx, args.Req); err2 != nil { 3506 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing PartialNestingMethod: "+err2.Error()) 3507 oprot.WriteMessageBegin("PartialNestingMethod", thrift.EXCEPTION, seqId) 3508 x.Write(oprot) 3509 oprot.WriteMessageEnd() 3510 oprot.Flush(ctx) 3511 return true, err2 3512 } else { 3513 result.Success = retval 3514 } 3515 if err2 = oprot.WriteMessageBegin("PartialNestingMethod", thrift.REPLY, seqId); err2 != nil { 3516 err = err2 3517 } 3518 if err2 = result.Write(oprot); err == nil && err2 != nil { 3519 err = err2 3520 } 3521 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 3522 err = err2 3523 } 3524 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 3525 err = err2 3526 } 3527 if err != nil { 3528 return 3529 } 3530 return true, err 3531 } 3532 3533 type baselineServiceProcessorNesting2Method struct { 3534 handler BaselineService 3535 } 3536 3537 func (p *baselineServiceProcessorNesting2Method) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 3538 args := BaselineServiceNesting2MethodArgs{} 3539 if err = args.Read(iprot); err != nil { 3540 iprot.ReadMessageEnd() 3541 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 3542 oprot.WriteMessageBegin("Nesting2Method", thrift.EXCEPTION, seqId) 3543 x.Write(oprot) 3544 oprot.WriteMessageEnd() 3545 oprot.Flush(ctx) 3546 return false, err 3547 } 3548 3549 iprot.ReadMessageEnd() 3550 var err2 error 3551 result := BaselineServiceNesting2MethodResult{} 3552 var retval *Nesting2 3553 if retval, err2 = p.handler.Nesting2Method(ctx, args.Req); err2 != nil { 3554 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Nesting2Method: "+err2.Error()) 3555 oprot.WriteMessageBegin("Nesting2Method", thrift.EXCEPTION, seqId) 3556 x.Write(oprot) 3557 oprot.WriteMessageEnd() 3558 oprot.Flush(ctx) 3559 return true, err2 3560 } else { 3561 result.Success = retval 3562 } 3563 if err2 = oprot.WriteMessageBegin("Nesting2Method", thrift.REPLY, seqId); err2 != nil { 3564 err = err2 3565 } 3566 if err2 = result.Write(oprot); err == nil && err2 != nil { 3567 err = err2 3568 } 3569 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 3570 err = err2 3571 } 3572 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 3573 err = err2 3574 } 3575 if err != nil { 3576 return 3577 } 3578 return true, err 3579 } 3580 3581 type BaselineServiceSimpleMethodArgs struct { 3582 Req *Simple `thrift:"req,1" json:"req"` 3583 } 3584 3585 func NewBaselineServiceSimpleMethodArgs() *BaselineServiceSimpleMethodArgs { 3586 return &BaselineServiceSimpleMethodArgs{} 3587 } 3588 3589 var BaselineServiceSimpleMethodArgs_Req_DEFAULT *Simple 3590 3591 func (p *BaselineServiceSimpleMethodArgs) GetReq() (v *Simple) { 3592 if !p.IsSetReq() { 3593 return BaselineServiceSimpleMethodArgs_Req_DEFAULT 3594 } 3595 return p.Req 3596 } 3597 func (p *BaselineServiceSimpleMethodArgs) SetReq(val *Simple) { 3598 p.Req = val 3599 } 3600 3601 var fieldIDToName_BaselineServiceSimpleMethodArgs = map[int16]string{ 3602 1: "req", 3603 } 3604 3605 func (p *BaselineServiceSimpleMethodArgs) IsSetReq() bool { 3606 return p.Req != nil 3607 } 3608 3609 func (p *BaselineServiceSimpleMethodArgs) Read(iprot thrift.TProtocol) (err error) { 3610 3611 var fieldTypeId thrift.TType 3612 var fieldId int16 3613 3614 if _, err = iprot.ReadStructBegin(); err != nil { 3615 goto ReadStructBeginError 3616 } 3617 3618 for { 3619 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 3620 if err != nil { 3621 goto ReadFieldBeginError 3622 } 3623 if fieldTypeId == thrift.STOP { 3624 break 3625 } 3626 3627 switch fieldId { 3628 case 1: 3629 if fieldTypeId == thrift.STRUCT { 3630 if err = p.ReadField1(iprot); err != nil { 3631 goto ReadFieldError 3632 } 3633 } else { 3634 if err = iprot.Skip(fieldTypeId); err != nil { 3635 goto SkipFieldError 3636 } 3637 } 3638 default: 3639 if err = iprot.Skip(fieldTypeId); err != nil { 3640 goto SkipFieldError 3641 } 3642 } 3643 3644 if err = iprot.ReadFieldEnd(); err != nil { 3645 goto ReadFieldEndError 3646 } 3647 } 3648 if err = iprot.ReadStructEnd(); err != nil { 3649 goto ReadStructEndError 3650 } 3651 3652 return nil 3653 ReadStructBeginError: 3654 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3655 ReadFieldBeginError: 3656 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3657 ReadFieldError: 3658 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceSimpleMethodArgs[fieldId]), err) 3659 SkipFieldError: 3660 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3661 3662 ReadFieldEndError: 3663 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3664 ReadStructEndError: 3665 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3666 } 3667 3668 func (p *BaselineServiceSimpleMethodArgs) ReadField1(iprot thrift.TProtocol) error { 3669 p.Req = NewSimple() 3670 if err := p.Req.Read(iprot); err != nil { 3671 return err 3672 } 3673 return nil 3674 } 3675 3676 func (p *BaselineServiceSimpleMethodArgs) Write(oprot thrift.TProtocol) (err error) { 3677 var fieldId int16 3678 if err = oprot.WriteStructBegin("SimpleMethod_args"); err != nil { 3679 goto WriteStructBeginError 3680 } 3681 if p != nil { 3682 if err = p.writeField1(oprot); err != nil { 3683 fieldId = 1 3684 goto WriteFieldError 3685 } 3686 3687 } 3688 if err = oprot.WriteFieldStop(); err != nil { 3689 goto WriteFieldStopError 3690 } 3691 if err = oprot.WriteStructEnd(); err != nil { 3692 goto WriteStructEndError 3693 } 3694 return nil 3695 WriteStructBeginError: 3696 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 3697 WriteFieldError: 3698 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 3699 WriteFieldStopError: 3700 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 3701 WriteStructEndError: 3702 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 3703 } 3704 3705 func (p *BaselineServiceSimpleMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 3706 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 3707 goto WriteFieldBeginError 3708 } 3709 if err := p.Req.Write(oprot); err != nil { 3710 return err 3711 } 3712 if err = oprot.WriteFieldEnd(); err != nil { 3713 goto WriteFieldEndError 3714 } 3715 return nil 3716 WriteFieldBeginError: 3717 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 3718 WriteFieldEndError: 3719 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 3720 } 3721 3722 func (p *BaselineServiceSimpleMethodArgs) String() string { 3723 if p == nil { 3724 return "<nil>" 3725 } 3726 return fmt.Sprintf("BaselineServiceSimpleMethodArgs(%+v)", *p) 3727 } 3728 3729 func (p *BaselineServiceSimpleMethodArgs) DeepEqual(ano *BaselineServiceSimpleMethodArgs) bool { 3730 if p == ano { 3731 return true 3732 } else if p == nil || ano == nil { 3733 return false 3734 } 3735 if !p.Field1DeepEqual(ano.Req) { 3736 return false 3737 } 3738 return true 3739 } 3740 3741 func (p *BaselineServiceSimpleMethodArgs) Field1DeepEqual(src *Simple) bool { 3742 3743 if !p.Req.DeepEqual(src) { 3744 return false 3745 } 3746 return true 3747 } 3748 3749 type BaselineServiceSimpleMethodResult struct { 3750 Success *Simple `thrift:"success,0" json:"success,omitempty"` 3751 } 3752 3753 func NewBaselineServiceSimpleMethodResult() *BaselineServiceSimpleMethodResult { 3754 return &BaselineServiceSimpleMethodResult{} 3755 } 3756 3757 var BaselineServiceSimpleMethodResult_Success_DEFAULT *Simple 3758 3759 func (p *BaselineServiceSimpleMethodResult) GetSuccess() (v *Simple) { 3760 if !p.IsSetSuccess() { 3761 return BaselineServiceSimpleMethodResult_Success_DEFAULT 3762 } 3763 return p.Success 3764 } 3765 func (p *BaselineServiceSimpleMethodResult) SetSuccess(x interface{}) { 3766 p.Success = x.(*Simple) 3767 } 3768 3769 var fieldIDToName_BaselineServiceSimpleMethodResult = map[int16]string{ 3770 0: "success", 3771 } 3772 3773 func (p *BaselineServiceSimpleMethodResult) IsSetSuccess() bool { 3774 return p.Success != nil 3775 } 3776 3777 func (p *BaselineServiceSimpleMethodResult) Read(iprot thrift.TProtocol) (err error) { 3778 3779 var fieldTypeId thrift.TType 3780 var fieldId int16 3781 3782 if _, err = iprot.ReadStructBegin(); err != nil { 3783 goto ReadStructBeginError 3784 } 3785 3786 for { 3787 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 3788 if err != nil { 3789 goto ReadFieldBeginError 3790 } 3791 if fieldTypeId == thrift.STOP { 3792 break 3793 } 3794 3795 switch fieldId { 3796 case 0: 3797 if fieldTypeId == thrift.STRUCT { 3798 if err = p.ReadField0(iprot); err != nil { 3799 goto ReadFieldError 3800 } 3801 } else { 3802 if err = iprot.Skip(fieldTypeId); err != nil { 3803 goto SkipFieldError 3804 } 3805 } 3806 default: 3807 if err = iprot.Skip(fieldTypeId); err != nil { 3808 goto SkipFieldError 3809 } 3810 } 3811 3812 if err = iprot.ReadFieldEnd(); err != nil { 3813 goto ReadFieldEndError 3814 } 3815 } 3816 if err = iprot.ReadStructEnd(); err != nil { 3817 goto ReadStructEndError 3818 } 3819 3820 return nil 3821 ReadStructBeginError: 3822 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3823 ReadFieldBeginError: 3824 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3825 ReadFieldError: 3826 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceSimpleMethodResult[fieldId]), err) 3827 SkipFieldError: 3828 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3829 3830 ReadFieldEndError: 3831 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3832 ReadStructEndError: 3833 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3834 } 3835 3836 func (p *BaselineServiceSimpleMethodResult) ReadField0(iprot thrift.TProtocol) error { 3837 p.Success = NewSimple() 3838 if err := p.Success.Read(iprot); err != nil { 3839 return err 3840 } 3841 return nil 3842 } 3843 3844 func (p *BaselineServiceSimpleMethodResult) Write(oprot thrift.TProtocol) (err error) { 3845 var fieldId int16 3846 if err = oprot.WriteStructBegin("SimpleMethod_result"); err != nil { 3847 goto WriteStructBeginError 3848 } 3849 if p != nil { 3850 if err = p.writeField0(oprot); err != nil { 3851 fieldId = 0 3852 goto WriteFieldError 3853 } 3854 3855 } 3856 if err = oprot.WriteFieldStop(); err != nil { 3857 goto WriteFieldStopError 3858 } 3859 if err = oprot.WriteStructEnd(); err != nil { 3860 goto WriteStructEndError 3861 } 3862 return nil 3863 WriteStructBeginError: 3864 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 3865 WriteFieldError: 3866 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 3867 WriteFieldStopError: 3868 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 3869 WriteStructEndError: 3870 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 3871 } 3872 3873 func (p *BaselineServiceSimpleMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 3874 if p.IsSetSuccess() { 3875 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 3876 goto WriteFieldBeginError 3877 } 3878 if err := p.Success.Write(oprot); err != nil { 3879 return err 3880 } 3881 if err = oprot.WriteFieldEnd(); err != nil { 3882 goto WriteFieldEndError 3883 } 3884 } 3885 return nil 3886 WriteFieldBeginError: 3887 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 3888 WriteFieldEndError: 3889 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 3890 } 3891 3892 func (p *BaselineServiceSimpleMethodResult) String() string { 3893 if p == nil { 3894 return "<nil>" 3895 } 3896 return fmt.Sprintf("BaselineServiceSimpleMethodResult(%+v)", *p) 3897 } 3898 3899 func (p *BaselineServiceSimpleMethodResult) DeepEqual(ano *BaselineServiceSimpleMethodResult) bool { 3900 if p == ano { 3901 return true 3902 } else if p == nil || ano == nil { 3903 return false 3904 } 3905 if !p.Field0DeepEqual(ano.Success) { 3906 return false 3907 } 3908 return true 3909 } 3910 3911 func (p *BaselineServiceSimpleMethodResult) Field0DeepEqual(src *Simple) bool { 3912 3913 if !p.Success.DeepEqual(src) { 3914 return false 3915 } 3916 return true 3917 } 3918 3919 type BaselineServicePartialSimpleMethodArgs struct { 3920 Req *PartialSimple `thrift:"req,1" json:"req"` 3921 } 3922 3923 func NewBaselineServicePartialSimpleMethodArgs() *BaselineServicePartialSimpleMethodArgs { 3924 return &BaselineServicePartialSimpleMethodArgs{} 3925 } 3926 3927 var BaselineServicePartialSimpleMethodArgs_Req_DEFAULT *PartialSimple 3928 3929 func (p *BaselineServicePartialSimpleMethodArgs) GetReq() (v *PartialSimple) { 3930 if !p.IsSetReq() { 3931 return BaselineServicePartialSimpleMethodArgs_Req_DEFAULT 3932 } 3933 return p.Req 3934 } 3935 func (p *BaselineServicePartialSimpleMethodArgs) SetReq(val *PartialSimple) { 3936 p.Req = val 3937 } 3938 3939 var fieldIDToName_BaselineServicePartialSimpleMethodArgs = map[int16]string{ 3940 1: "req", 3941 } 3942 3943 func (p *BaselineServicePartialSimpleMethodArgs) IsSetReq() bool { 3944 return p.Req != nil 3945 } 3946 3947 func (p *BaselineServicePartialSimpleMethodArgs) Read(iprot thrift.TProtocol) (err error) { 3948 3949 var fieldTypeId thrift.TType 3950 var fieldId int16 3951 3952 if _, err = iprot.ReadStructBegin(); err != nil { 3953 goto ReadStructBeginError 3954 } 3955 3956 for { 3957 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 3958 if err != nil { 3959 goto ReadFieldBeginError 3960 } 3961 if fieldTypeId == thrift.STOP { 3962 break 3963 } 3964 3965 switch fieldId { 3966 case 1: 3967 if fieldTypeId == thrift.STRUCT { 3968 if err = p.ReadField1(iprot); err != nil { 3969 goto ReadFieldError 3970 } 3971 } else { 3972 if err = iprot.Skip(fieldTypeId); err != nil { 3973 goto SkipFieldError 3974 } 3975 } 3976 default: 3977 if err = iprot.Skip(fieldTypeId); err != nil { 3978 goto SkipFieldError 3979 } 3980 } 3981 3982 if err = iprot.ReadFieldEnd(); err != nil { 3983 goto ReadFieldEndError 3984 } 3985 } 3986 if err = iprot.ReadStructEnd(); err != nil { 3987 goto ReadStructEndError 3988 } 3989 3990 return nil 3991 ReadStructBeginError: 3992 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3993 ReadFieldBeginError: 3994 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3995 ReadFieldError: 3996 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServicePartialSimpleMethodArgs[fieldId]), err) 3997 SkipFieldError: 3998 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3999 4000 ReadFieldEndError: 4001 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 4002 ReadStructEndError: 4003 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4004 } 4005 4006 func (p *BaselineServicePartialSimpleMethodArgs) ReadField1(iprot thrift.TProtocol) error { 4007 p.Req = NewPartialSimple() 4008 if err := p.Req.Read(iprot); err != nil { 4009 return err 4010 } 4011 return nil 4012 } 4013 4014 func (p *BaselineServicePartialSimpleMethodArgs) Write(oprot thrift.TProtocol) (err error) { 4015 var fieldId int16 4016 if err = oprot.WriteStructBegin("PartialSimpleMethod_args"); err != nil { 4017 goto WriteStructBeginError 4018 } 4019 if p != nil { 4020 if err = p.writeField1(oprot); err != nil { 4021 fieldId = 1 4022 goto WriteFieldError 4023 } 4024 4025 } 4026 if err = oprot.WriteFieldStop(); err != nil { 4027 goto WriteFieldStopError 4028 } 4029 if err = oprot.WriteStructEnd(); err != nil { 4030 goto WriteStructEndError 4031 } 4032 return nil 4033 WriteStructBeginError: 4034 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4035 WriteFieldError: 4036 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 4037 WriteFieldStopError: 4038 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 4039 WriteStructEndError: 4040 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 4041 } 4042 4043 func (p *BaselineServicePartialSimpleMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 4044 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 4045 goto WriteFieldBeginError 4046 } 4047 if err := p.Req.Write(oprot); err != nil { 4048 return err 4049 } 4050 if err = oprot.WriteFieldEnd(); err != nil { 4051 goto WriteFieldEndError 4052 } 4053 return nil 4054 WriteFieldBeginError: 4055 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 4056 WriteFieldEndError: 4057 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 4058 } 4059 4060 func (p *BaselineServicePartialSimpleMethodArgs) String() string { 4061 if p == nil { 4062 return "<nil>" 4063 } 4064 return fmt.Sprintf("BaselineServicePartialSimpleMethodArgs(%+v)", *p) 4065 } 4066 4067 func (p *BaselineServicePartialSimpleMethodArgs) DeepEqual(ano *BaselineServicePartialSimpleMethodArgs) bool { 4068 if p == ano { 4069 return true 4070 } else if p == nil || ano == nil { 4071 return false 4072 } 4073 if !p.Field1DeepEqual(ano.Req) { 4074 return false 4075 } 4076 return true 4077 } 4078 4079 func (p *BaselineServicePartialSimpleMethodArgs) Field1DeepEqual(src *PartialSimple) bool { 4080 4081 if !p.Req.DeepEqual(src) { 4082 return false 4083 } 4084 return true 4085 } 4086 4087 type BaselineServicePartialSimpleMethodResult struct { 4088 Success *PartialSimple `thrift:"success,0" json:"success,omitempty"` 4089 } 4090 4091 func NewBaselineServicePartialSimpleMethodResult() *BaselineServicePartialSimpleMethodResult { 4092 return &BaselineServicePartialSimpleMethodResult{} 4093 } 4094 4095 var BaselineServicePartialSimpleMethodResult_Success_DEFAULT *PartialSimple 4096 4097 func (p *BaselineServicePartialSimpleMethodResult) GetSuccess() (v *PartialSimple) { 4098 if !p.IsSetSuccess() { 4099 return BaselineServicePartialSimpleMethodResult_Success_DEFAULT 4100 } 4101 return p.Success 4102 } 4103 func (p *BaselineServicePartialSimpleMethodResult) SetSuccess(x interface{}) { 4104 p.Success = x.(*PartialSimple) 4105 } 4106 4107 var fieldIDToName_BaselineServicePartialSimpleMethodResult = map[int16]string{ 4108 0: "success", 4109 } 4110 4111 func (p *BaselineServicePartialSimpleMethodResult) IsSetSuccess() bool { 4112 return p.Success != nil 4113 } 4114 4115 func (p *BaselineServicePartialSimpleMethodResult) Read(iprot thrift.TProtocol) (err error) { 4116 4117 var fieldTypeId thrift.TType 4118 var fieldId int16 4119 4120 if _, err = iprot.ReadStructBegin(); err != nil { 4121 goto ReadStructBeginError 4122 } 4123 4124 for { 4125 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 4126 if err != nil { 4127 goto ReadFieldBeginError 4128 } 4129 if fieldTypeId == thrift.STOP { 4130 break 4131 } 4132 4133 switch fieldId { 4134 case 0: 4135 if fieldTypeId == thrift.STRUCT { 4136 if err = p.ReadField0(iprot); err != nil { 4137 goto ReadFieldError 4138 } 4139 } else { 4140 if err = iprot.Skip(fieldTypeId); err != nil { 4141 goto SkipFieldError 4142 } 4143 } 4144 default: 4145 if err = iprot.Skip(fieldTypeId); err != nil { 4146 goto SkipFieldError 4147 } 4148 } 4149 4150 if err = iprot.ReadFieldEnd(); err != nil { 4151 goto ReadFieldEndError 4152 } 4153 } 4154 if err = iprot.ReadStructEnd(); err != nil { 4155 goto ReadStructEndError 4156 } 4157 4158 return nil 4159 ReadStructBeginError: 4160 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 4161 ReadFieldBeginError: 4162 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 4163 ReadFieldError: 4164 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServicePartialSimpleMethodResult[fieldId]), err) 4165 SkipFieldError: 4166 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 4167 4168 ReadFieldEndError: 4169 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 4170 ReadStructEndError: 4171 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4172 } 4173 4174 func (p *BaselineServicePartialSimpleMethodResult) ReadField0(iprot thrift.TProtocol) error { 4175 p.Success = NewPartialSimple() 4176 if err := p.Success.Read(iprot); err != nil { 4177 return err 4178 } 4179 return nil 4180 } 4181 4182 func (p *BaselineServicePartialSimpleMethodResult) Write(oprot thrift.TProtocol) (err error) { 4183 var fieldId int16 4184 if err = oprot.WriteStructBegin("PartialSimpleMethod_result"); err != nil { 4185 goto WriteStructBeginError 4186 } 4187 if p != nil { 4188 if err = p.writeField0(oprot); err != nil { 4189 fieldId = 0 4190 goto WriteFieldError 4191 } 4192 4193 } 4194 if err = oprot.WriteFieldStop(); err != nil { 4195 goto WriteFieldStopError 4196 } 4197 if err = oprot.WriteStructEnd(); err != nil { 4198 goto WriteStructEndError 4199 } 4200 return nil 4201 WriteStructBeginError: 4202 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4203 WriteFieldError: 4204 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 4205 WriteFieldStopError: 4206 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 4207 WriteStructEndError: 4208 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 4209 } 4210 4211 func (p *BaselineServicePartialSimpleMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 4212 if p.IsSetSuccess() { 4213 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 4214 goto WriteFieldBeginError 4215 } 4216 if err := p.Success.Write(oprot); err != nil { 4217 return err 4218 } 4219 if err = oprot.WriteFieldEnd(); err != nil { 4220 goto WriteFieldEndError 4221 } 4222 } 4223 return nil 4224 WriteFieldBeginError: 4225 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 4226 WriteFieldEndError: 4227 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 4228 } 4229 4230 func (p *BaselineServicePartialSimpleMethodResult) String() string { 4231 if p == nil { 4232 return "<nil>" 4233 } 4234 return fmt.Sprintf("BaselineServicePartialSimpleMethodResult(%+v)", *p) 4235 } 4236 4237 func (p *BaselineServicePartialSimpleMethodResult) DeepEqual(ano *BaselineServicePartialSimpleMethodResult) bool { 4238 if p == ano { 4239 return true 4240 } else if p == nil || ano == nil { 4241 return false 4242 } 4243 if !p.Field0DeepEqual(ano.Success) { 4244 return false 4245 } 4246 return true 4247 } 4248 4249 func (p *BaselineServicePartialSimpleMethodResult) Field0DeepEqual(src *PartialSimple) bool { 4250 4251 if !p.Success.DeepEqual(src) { 4252 return false 4253 } 4254 return true 4255 } 4256 4257 type BaselineServiceNestingMethodArgs struct { 4258 Req *Nesting `thrift:"req,1" json:"req"` 4259 } 4260 4261 func NewBaselineServiceNestingMethodArgs() *BaselineServiceNestingMethodArgs { 4262 return &BaselineServiceNestingMethodArgs{} 4263 } 4264 4265 var BaselineServiceNestingMethodArgs_Req_DEFAULT *Nesting 4266 4267 func (p *BaselineServiceNestingMethodArgs) GetReq() (v *Nesting) { 4268 if !p.IsSetReq() { 4269 return BaselineServiceNestingMethodArgs_Req_DEFAULT 4270 } 4271 return p.Req 4272 } 4273 func (p *BaselineServiceNestingMethodArgs) SetReq(val *Nesting) { 4274 p.Req = val 4275 } 4276 4277 var fieldIDToName_BaselineServiceNestingMethodArgs = map[int16]string{ 4278 1: "req", 4279 } 4280 4281 func (p *BaselineServiceNestingMethodArgs) IsSetReq() bool { 4282 return p.Req != nil 4283 } 4284 4285 func (p *BaselineServiceNestingMethodArgs) Read(iprot thrift.TProtocol) (err error) { 4286 4287 var fieldTypeId thrift.TType 4288 var fieldId int16 4289 4290 if _, err = iprot.ReadStructBegin(); err != nil { 4291 goto ReadStructBeginError 4292 } 4293 4294 for { 4295 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 4296 if err != nil { 4297 goto ReadFieldBeginError 4298 } 4299 if fieldTypeId == thrift.STOP { 4300 break 4301 } 4302 4303 switch fieldId { 4304 case 1: 4305 if fieldTypeId == thrift.STRUCT { 4306 if err = p.ReadField1(iprot); err != nil { 4307 goto ReadFieldError 4308 } 4309 } else { 4310 if err = iprot.Skip(fieldTypeId); err != nil { 4311 goto SkipFieldError 4312 } 4313 } 4314 default: 4315 if err = iprot.Skip(fieldTypeId); err != nil { 4316 goto SkipFieldError 4317 } 4318 } 4319 4320 if err = iprot.ReadFieldEnd(); err != nil { 4321 goto ReadFieldEndError 4322 } 4323 } 4324 if err = iprot.ReadStructEnd(); err != nil { 4325 goto ReadStructEndError 4326 } 4327 4328 return nil 4329 ReadStructBeginError: 4330 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 4331 ReadFieldBeginError: 4332 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 4333 ReadFieldError: 4334 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceNestingMethodArgs[fieldId]), err) 4335 SkipFieldError: 4336 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 4337 4338 ReadFieldEndError: 4339 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 4340 ReadStructEndError: 4341 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4342 } 4343 4344 func (p *BaselineServiceNestingMethodArgs) ReadField1(iprot thrift.TProtocol) error { 4345 p.Req = NewNesting() 4346 if err := p.Req.Read(iprot); err != nil { 4347 return err 4348 } 4349 return nil 4350 } 4351 4352 func (p *BaselineServiceNestingMethodArgs) Write(oprot thrift.TProtocol) (err error) { 4353 var fieldId int16 4354 if err = oprot.WriteStructBegin("NestingMethod_args"); err != nil { 4355 goto WriteStructBeginError 4356 } 4357 if p != nil { 4358 if err = p.writeField1(oprot); err != nil { 4359 fieldId = 1 4360 goto WriteFieldError 4361 } 4362 4363 } 4364 if err = oprot.WriteFieldStop(); err != nil { 4365 goto WriteFieldStopError 4366 } 4367 if err = oprot.WriteStructEnd(); err != nil { 4368 goto WriteStructEndError 4369 } 4370 return nil 4371 WriteStructBeginError: 4372 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4373 WriteFieldError: 4374 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 4375 WriteFieldStopError: 4376 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 4377 WriteStructEndError: 4378 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 4379 } 4380 4381 func (p *BaselineServiceNestingMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 4382 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 4383 goto WriteFieldBeginError 4384 } 4385 if err := p.Req.Write(oprot); err != nil { 4386 return err 4387 } 4388 if err = oprot.WriteFieldEnd(); err != nil { 4389 goto WriteFieldEndError 4390 } 4391 return nil 4392 WriteFieldBeginError: 4393 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 4394 WriteFieldEndError: 4395 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 4396 } 4397 4398 func (p *BaselineServiceNestingMethodArgs) String() string { 4399 if p == nil { 4400 return "<nil>" 4401 } 4402 return fmt.Sprintf("BaselineServiceNestingMethodArgs(%+v)", *p) 4403 } 4404 4405 func (p *BaselineServiceNestingMethodArgs) DeepEqual(ano *BaselineServiceNestingMethodArgs) bool { 4406 if p == ano { 4407 return true 4408 } else if p == nil || ano == nil { 4409 return false 4410 } 4411 if !p.Field1DeepEqual(ano.Req) { 4412 return false 4413 } 4414 return true 4415 } 4416 4417 func (p *BaselineServiceNestingMethodArgs) Field1DeepEqual(src *Nesting) bool { 4418 4419 if !p.Req.DeepEqual(src) { 4420 return false 4421 } 4422 return true 4423 } 4424 4425 type BaselineServiceNestingMethodResult struct { 4426 Success *Nesting `thrift:"success,0" json:"success,omitempty"` 4427 } 4428 4429 func NewBaselineServiceNestingMethodResult() *BaselineServiceNestingMethodResult { 4430 return &BaselineServiceNestingMethodResult{} 4431 } 4432 4433 var BaselineServiceNestingMethodResult_Success_DEFAULT *Nesting 4434 4435 func (p *BaselineServiceNestingMethodResult) GetSuccess() (v *Nesting) { 4436 if !p.IsSetSuccess() { 4437 return BaselineServiceNestingMethodResult_Success_DEFAULT 4438 } 4439 return p.Success 4440 } 4441 func (p *BaselineServiceNestingMethodResult) SetSuccess(x interface{}) { 4442 p.Success = x.(*Nesting) 4443 } 4444 4445 var fieldIDToName_BaselineServiceNestingMethodResult = map[int16]string{ 4446 0: "success", 4447 } 4448 4449 func (p *BaselineServiceNestingMethodResult) IsSetSuccess() bool { 4450 return p.Success != nil 4451 } 4452 4453 func (p *BaselineServiceNestingMethodResult) Read(iprot thrift.TProtocol) (err error) { 4454 4455 var fieldTypeId thrift.TType 4456 var fieldId int16 4457 4458 if _, err = iprot.ReadStructBegin(); err != nil { 4459 goto ReadStructBeginError 4460 } 4461 4462 for { 4463 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 4464 if err != nil { 4465 goto ReadFieldBeginError 4466 } 4467 if fieldTypeId == thrift.STOP { 4468 break 4469 } 4470 4471 switch fieldId { 4472 case 0: 4473 if fieldTypeId == thrift.STRUCT { 4474 if err = p.ReadField0(iprot); err != nil { 4475 goto ReadFieldError 4476 } 4477 } else { 4478 if err = iprot.Skip(fieldTypeId); err != nil { 4479 goto SkipFieldError 4480 } 4481 } 4482 default: 4483 if err = iprot.Skip(fieldTypeId); err != nil { 4484 goto SkipFieldError 4485 } 4486 } 4487 4488 if err = iprot.ReadFieldEnd(); err != nil { 4489 goto ReadFieldEndError 4490 } 4491 } 4492 if err = iprot.ReadStructEnd(); err != nil { 4493 goto ReadStructEndError 4494 } 4495 4496 return nil 4497 ReadStructBeginError: 4498 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 4499 ReadFieldBeginError: 4500 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 4501 ReadFieldError: 4502 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceNestingMethodResult[fieldId]), err) 4503 SkipFieldError: 4504 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 4505 4506 ReadFieldEndError: 4507 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 4508 ReadStructEndError: 4509 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4510 } 4511 4512 func (p *BaselineServiceNestingMethodResult) ReadField0(iprot thrift.TProtocol) error { 4513 p.Success = NewNesting() 4514 if err := p.Success.Read(iprot); err != nil { 4515 return err 4516 } 4517 return nil 4518 } 4519 4520 func (p *BaselineServiceNestingMethodResult) Write(oprot thrift.TProtocol) (err error) { 4521 var fieldId int16 4522 if err = oprot.WriteStructBegin("NestingMethod_result"); err != nil { 4523 goto WriteStructBeginError 4524 } 4525 if p != nil { 4526 if err = p.writeField0(oprot); err != nil { 4527 fieldId = 0 4528 goto WriteFieldError 4529 } 4530 4531 } 4532 if err = oprot.WriteFieldStop(); err != nil { 4533 goto WriteFieldStopError 4534 } 4535 if err = oprot.WriteStructEnd(); err != nil { 4536 goto WriteStructEndError 4537 } 4538 return nil 4539 WriteStructBeginError: 4540 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4541 WriteFieldError: 4542 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 4543 WriteFieldStopError: 4544 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 4545 WriteStructEndError: 4546 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 4547 } 4548 4549 func (p *BaselineServiceNestingMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 4550 if p.IsSetSuccess() { 4551 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 4552 goto WriteFieldBeginError 4553 } 4554 if err := p.Success.Write(oprot); err != nil { 4555 return err 4556 } 4557 if err = oprot.WriteFieldEnd(); err != nil { 4558 goto WriteFieldEndError 4559 } 4560 } 4561 return nil 4562 WriteFieldBeginError: 4563 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 4564 WriteFieldEndError: 4565 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 4566 } 4567 4568 func (p *BaselineServiceNestingMethodResult) String() string { 4569 if p == nil { 4570 return "<nil>" 4571 } 4572 return fmt.Sprintf("BaselineServiceNestingMethodResult(%+v)", *p) 4573 } 4574 4575 func (p *BaselineServiceNestingMethodResult) DeepEqual(ano *BaselineServiceNestingMethodResult) bool { 4576 if p == ano { 4577 return true 4578 } else if p == nil || ano == nil { 4579 return false 4580 } 4581 if !p.Field0DeepEqual(ano.Success) { 4582 return false 4583 } 4584 return true 4585 } 4586 4587 func (p *BaselineServiceNestingMethodResult) Field0DeepEqual(src *Nesting) bool { 4588 4589 if !p.Success.DeepEqual(src) { 4590 return false 4591 } 4592 return true 4593 } 4594 4595 type BaselineServicePartialNestingMethodArgs struct { 4596 Req *PartialNesting `thrift:"req,1" json:"req"` 4597 } 4598 4599 func NewBaselineServicePartialNestingMethodArgs() *BaselineServicePartialNestingMethodArgs { 4600 return &BaselineServicePartialNestingMethodArgs{} 4601 } 4602 4603 var BaselineServicePartialNestingMethodArgs_Req_DEFAULT *PartialNesting 4604 4605 func (p *BaselineServicePartialNestingMethodArgs) GetReq() (v *PartialNesting) { 4606 if !p.IsSetReq() { 4607 return BaselineServicePartialNestingMethodArgs_Req_DEFAULT 4608 } 4609 return p.Req 4610 } 4611 func (p *BaselineServicePartialNestingMethodArgs) SetReq(val *PartialNesting) { 4612 p.Req = val 4613 } 4614 4615 var fieldIDToName_BaselineServicePartialNestingMethodArgs = map[int16]string{ 4616 1: "req", 4617 } 4618 4619 func (p *BaselineServicePartialNestingMethodArgs) IsSetReq() bool { 4620 return p.Req != nil 4621 } 4622 4623 func (p *BaselineServicePartialNestingMethodArgs) Read(iprot thrift.TProtocol) (err error) { 4624 4625 var fieldTypeId thrift.TType 4626 var fieldId int16 4627 4628 if _, err = iprot.ReadStructBegin(); err != nil { 4629 goto ReadStructBeginError 4630 } 4631 4632 for { 4633 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 4634 if err != nil { 4635 goto ReadFieldBeginError 4636 } 4637 if fieldTypeId == thrift.STOP { 4638 break 4639 } 4640 4641 switch fieldId { 4642 case 1: 4643 if fieldTypeId == thrift.STRUCT { 4644 if err = p.ReadField1(iprot); err != nil { 4645 goto ReadFieldError 4646 } 4647 } else { 4648 if err = iprot.Skip(fieldTypeId); err != nil { 4649 goto SkipFieldError 4650 } 4651 } 4652 default: 4653 if err = iprot.Skip(fieldTypeId); err != nil { 4654 goto SkipFieldError 4655 } 4656 } 4657 4658 if err = iprot.ReadFieldEnd(); err != nil { 4659 goto ReadFieldEndError 4660 } 4661 } 4662 if err = iprot.ReadStructEnd(); err != nil { 4663 goto ReadStructEndError 4664 } 4665 4666 return nil 4667 ReadStructBeginError: 4668 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 4669 ReadFieldBeginError: 4670 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 4671 ReadFieldError: 4672 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServicePartialNestingMethodArgs[fieldId]), err) 4673 SkipFieldError: 4674 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 4675 4676 ReadFieldEndError: 4677 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 4678 ReadStructEndError: 4679 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4680 } 4681 4682 func (p *BaselineServicePartialNestingMethodArgs) ReadField1(iprot thrift.TProtocol) error { 4683 p.Req = NewPartialNesting() 4684 if err := p.Req.Read(iprot); err != nil { 4685 return err 4686 } 4687 return nil 4688 } 4689 4690 func (p *BaselineServicePartialNestingMethodArgs) Write(oprot thrift.TProtocol) (err error) { 4691 var fieldId int16 4692 if err = oprot.WriteStructBegin("PartialNestingMethod_args"); err != nil { 4693 goto WriteStructBeginError 4694 } 4695 if p != nil { 4696 if err = p.writeField1(oprot); err != nil { 4697 fieldId = 1 4698 goto WriteFieldError 4699 } 4700 4701 } 4702 if err = oprot.WriteFieldStop(); err != nil { 4703 goto WriteFieldStopError 4704 } 4705 if err = oprot.WriteStructEnd(); err != nil { 4706 goto WriteStructEndError 4707 } 4708 return nil 4709 WriteStructBeginError: 4710 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4711 WriteFieldError: 4712 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 4713 WriteFieldStopError: 4714 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 4715 WriteStructEndError: 4716 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 4717 } 4718 4719 func (p *BaselineServicePartialNestingMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 4720 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 4721 goto WriteFieldBeginError 4722 } 4723 if err := p.Req.Write(oprot); err != nil { 4724 return err 4725 } 4726 if err = oprot.WriteFieldEnd(); err != nil { 4727 goto WriteFieldEndError 4728 } 4729 return nil 4730 WriteFieldBeginError: 4731 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 4732 WriteFieldEndError: 4733 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 4734 } 4735 4736 func (p *BaselineServicePartialNestingMethodArgs) String() string { 4737 if p == nil { 4738 return "<nil>" 4739 } 4740 return fmt.Sprintf("BaselineServicePartialNestingMethodArgs(%+v)", *p) 4741 } 4742 4743 func (p *BaselineServicePartialNestingMethodArgs) DeepEqual(ano *BaselineServicePartialNestingMethodArgs) bool { 4744 if p == ano { 4745 return true 4746 } else if p == nil || ano == nil { 4747 return false 4748 } 4749 if !p.Field1DeepEqual(ano.Req) { 4750 return false 4751 } 4752 return true 4753 } 4754 4755 func (p *BaselineServicePartialNestingMethodArgs) Field1DeepEqual(src *PartialNesting) bool { 4756 4757 if !p.Req.DeepEqual(src) { 4758 return false 4759 } 4760 return true 4761 } 4762 4763 type BaselineServicePartialNestingMethodResult struct { 4764 Success *PartialNesting `thrift:"success,0" json:"success,omitempty"` 4765 } 4766 4767 func NewBaselineServicePartialNestingMethodResult() *BaselineServicePartialNestingMethodResult { 4768 return &BaselineServicePartialNestingMethodResult{} 4769 } 4770 4771 var BaselineServicePartialNestingMethodResult_Success_DEFAULT *PartialNesting 4772 4773 func (p *BaselineServicePartialNestingMethodResult) GetSuccess() (v *PartialNesting) { 4774 if !p.IsSetSuccess() { 4775 return BaselineServicePartialNestingMethodResult_Success_DEFAULT 4776 } 4777 return p.Success 4778 } 4779 func (p *BaselineServicePartialNestingMethodResult) SetSuccess(x interface{}) { 4780 p.Success = x.(*PartialNesting) 4781 } 4782 4783 var fieldIDToName_BaselineServicePartialNestingMethodResult = map[int16]string{ 4784 0: "success", 4785 } 4786 4787 func (p *BaselineServicePartialNestingMethodResult) IsSetSuccess() bool { 4788 return p.Success != nil 4789 } 4790 4791 func (p *BaselineServicePartialNestingMethodResult) Read(iprot thrift.TProtocol) (err error) { 4792 4793 var fieldTypeId thrift.TType 4794 var fieldId int16 4795 4796 if _, err = iprot.ReadStructBegin(); err != nil { 4797 goto ReadStructBeginError 4798 } 4799 4800 for { 4801 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 4802 if err != nil { 4803 goto ReadFieldBeginError 4804 } 4805 if fieldTypeId == thrift.STOP { 4806 break 4807 } 4808 4809 switch fieldId { 4810 case 0: 4811 if fieldTypeId == thrift.STRUCT { 4812 if err = p.ReadField0(iprot); err != nil { 4813 goto ReadFieldError 4814 } 4815 } else { 4816 if err = iprot.Skip(fieldTypeId); err != nil { 4817 goto SkipFieldError 4818 } 4819 } 4820 default: 4821 if err = iprot.Skip(fieldTypeId); err != nil { 4822 goto SkipFieldError 4823 } 4824 } 4825 4826 if err = iprot.ReadFieldEnd(); err != nil { 4827 goto ReadFieldEndError 4828 } 4829 } 4830 if err = iprot.ReadStructEnd(); err != nil { 4831 goto ReadStructEndError 4832 } 4833 4834 return nil 4835 ReadStructBeginError: 4836 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 4837 ReadFieldBeginError: 4838 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 4839 ReadFieldError: 4840 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServicePartialNestingMethodResult[fieldId]), err) 4841 SkipFieldError: 4842 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 4843 4844 ReadFieldEndError: 4845 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 4846 ReadStructEndError: 4847 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4848 } 4849 4850 func (p *BaselineServicePartialNestingMethodResult) ReadField0(iprot thrift.TProtocol) error { 4851 p.Success = NewPartialNesting() 4852 if err := p.Success.Read(iprot); err != nil { 4853 return err 4854 } 4855 return nil 4856 } 4857 4858 func (p *BaselineServicePartialNestingMethodResult) Write(oprot thrift.TProtocol) (err error) { 4859 var fieldId int16 4860 if err = oprot.WriteStructBegin("PartialNestingMethod_result"); err != nil { 4861 goto WriteStructBeginError 4862 } 4863 if p != nil { 4864 if err = p.writeField0(oprot); err != nil { 4865 fieldId = 0 4866 goto WriteFieldError 4867 } 4868 4869 } 4870 if err = oprot.WriteFieldStop(); err != nil { 4871 goto WriteFieldStopError 4872 } 4873 if err = oprot.WriteStructEnd(); err != nil { 4874 goto WriteStructEndError 4875 } 4876 return nil 4877 WriteStructBeginError: 4878 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4879 WriteFieldError: 4880 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 4881 WriteFieldStopError: 4882 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 4883 WriteStructEndError: 4884 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 4885 } 4886 4887 func (p *BaselineServicePartialNestingMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 4888 if p.IsSetSuccess() { 4889 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 4890 goto WriteFieldBeginError 4891 } 4892 if err := p.Success.Write(oprot); err != nil { 4893 return err 4894 } 4895 if err = oprot.WriteFieldEnd(); err != nil { 4896 goto WriteFieldEndError 4897 } 4898 } 4899 return nil 4900 WriteFieldBeginError: 4901 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 4902 WriteFieldEndError: 4903 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 4904 } 4905 4906 func (p *BaselineServicePartialNestingMethodResult) String() string { 4907 if p == nil { 4908 return "<nil>" 4909 } 4910 return fmt.Sprintf("BaselineServicePartialNestingMethodResult(%+v)", *p) 4911 } 4912 4913 func (p *BaselineServicePartialNestingMethodResult) DeepEqual(ano *BaselineServicePartialNestingMethodResult) bool { 4914 if p == ano { 4915 return true 4916 } else if p == nil || ano == nil { 4917 return false 4918 } 4919 if !p.Field0DeepEqual(ano.Success) { 4920 return false 4921 } 4922 return true 4923 } 4924 4925 func (p *BaselineServicePartialNestingMethodResult) Field0DeepEqual(src *PartialNesting) bool { 4926 4927 if !p.Success.DeepEqual(src) { 4928 return false 4929 } 4930 return true 4931 } 4932 4933 type BaselineServiceNesting2MethodArgs struct { 4934 Req *Nesting2 `thrift:"req,1" json:"req"` 4935 } 4936 4937 func NewBaselineServiceNesting2MethodArgs() *BaselineServiceNesting2MethodArgs { 4938 return &BaselineServiceNesting2MethodArgs{} 4939 } 4940 4941 var BaselineServiceNesting2MethodArgs_Req_DEFAULT *Nesting2 4942 4943 func (p *BaselineServiceNesting2MethodArgs) GetReq() (v *Nesting2) { 4944 if !p.IsSetReq() { 4945 return BaselineServiceNesting2MethodArgs_Req_DEFAULT 4946 } 4947 return p.Req 4948 } 4949 func (p *BaselineServiceNesting2MethodArgs) SetReq(val *Nesting2) { 4950 p.Req = val 4951 } 4952 4953 var fieldIDToName_BaselineServiceNesting2MethodArgs = map[int16]string{ 4954 1: "req", 4955 } 4956 4957 func (p *BaselineServiceNesting2MethodArgs) IsSetReq() bool { 4958 return p.Req != nil 4959 } 4960 4961 func (p *BaselineServiceNesting2MethodArgs) Read(iprot thrift.TProtocol) (err error) { 4962 4963 var fieldTypeId thrift.TType 4964 var fieldId int16 4965 4966 if _, err = iprot.ReadStructBegin(); err != nil { 4967 goto ReadStructBeginError 4968 } 4969 4970 for { 4971 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 4972 if err != nil { 4973 goto ReadFieldBeginError 4974 } 4975 if fieldTypeId == thrift.STOP { 4976 break 4977 } 4978 4979 switch fieldId { 4980 case 1: 4981 if fieldTypeId == thrift.STRUCT { 4982 if err = p.ReadField1(iprot); err != nil { 4983 goto ReadFieldError 4984 } 4985 } else { 4986 if err = iprot.Skip(fieldTypeId); err != nil { 4987 goto SkipFieldError 4988 } 4989 } 4990 default: 4991 if err = iprot.Skip(fieldTypeId); err != nil { 4992 goto SkipFieldError 4993 } 4994 } 4995 4996 if err = iprot.ReadFieldEnd(); err != nil { 4997 goto ReadFieldEndError 4998 } 4999 } 5000 if err = iprot.ReadStructEnd(); err != nil { 5001 goto ReadStructEndError 5002 } 5003 5004 return nil 5005 ReadStructBeginError: 5006 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 5007 ReadFieldBeginError: 5008 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 5009 ReadFieldError: 5010 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceNesting2MethodArgs[fieldId]), err) 5011 SkipFieldError: 5012 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 5013 5014 ReadFieldEndError: 5015 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 5016 ReadStructEndError: 5017 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5018 } 5019 5020 func (p *BaselineServiceNesting2MethodArgs) ReadField1(iprot thrift.TProtocol) error { 5021 p.Req = NewNesting2() 5022 if err := p.Req.Read(iprot); err != nil { 5023 return err 5024 } 5025 return nil 5026 } 5027 5028 func (p *BaselineServiceNesting2MethodArgs) Write(oprot thrift.TProtocol) (err error) { 5029 var fieldId int16 5030 if err = oprot.WriteStructBegin("Nesting2Method_args"); err != nil { 5031 goto WriteStructBeginError 5032 } 5033 if p != nil { 5034 if err = p.writeField1(oprot); err != nil { 5035 fieldId = 1 5036 goto WriteFieldError 5037 } 5038 5039 } 5040 if err = oprot.WriteFieldStop(); err != nil { 5041 goto WriteFieldStopError 5042 } 5043 if err = oprot.WriteStructEnd(); err != nil { 5044 goto WriteStructEndError 5045 } 5046 return nil 5047 WriteStructBeginError: 5048 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5049 WriteFieldError: 5050 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 5051 WriteFieldStopError: 5052 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 5053 WriteStructEndError: 5054 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 5055 } 5056 5057 func (p *BaselineServiceNesting2MethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 5058 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 5059 goto WriteFieldBeginError 5060 } 5061 if err := p.Req.Write(oprot); err != nil { 5062 return err 5063 } 5064 if err = oprot.WriteFieldEnd(); err != nil { 5065 goto WriteFieldEndError 5066 } 5067 return nil 5068 WriteFieldBeginError: 5069 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 5070 WriteFieldEndError: 5071 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 5072 } 5073 5074 func (p *BaselineServiceNesting2MethodArgs) String() string { 5075 if p == nil { 5076 return "<nil>" 5077 } 5078 return fmt.Sprintf("BaselineServiceNesting2MethodArgs(%+v)", *p) 5079 } 5080 5081 func (p *BaselineServiceNesting2MethodArgs) DeepEqual(ano *BaselineServiceNesting2MethodArgs) bool { 5082 if p == ano { 5083 return true 5084 } else if p == nil || ano == nil { 5085 return false 5086 } 5087 if !p.Field1DeepEqual(ano.Req) { 5088 return false 5089 } 5090 return true 5091 } 5092 5093 func (p *BaselineServiceNesting2MethodArgs) Field1DeepEqual(src *Nesting2) bool { 5094 5095 if !p.Req.DeepEqual(src) { 5096 return false 5097 } 5098 return true 5099 } 5100 5101 type BaselineServiceNesting2MethodResult struct { 5102 Success *Nesting2 `thrift:"success,0" json:"success,omitempty"` 5103 } 5104 5105 func NewBaselineServiceNesting2MethodResult() *BaselineServiceNesting2MethodResult { 5106 return &BaselineServiceNesting2MethodResult{} 5107 } 5108 5109 var BaselineServiceNesting2MethodResult_Success_DEFAULT *Nesting2 5110 5111 func (p *BaselineServiceNesting2MethodResult) GetSuccess() (v *Nesting2) { 5112 if !p.IsSetSuccess() { 5113 return BaselineServiceNesting2MethodResult_Success_DEFAULT 5114 } 5115 return p.Success 5116 } 5117 func (p *BaselineServiceNesting2MethodResult) SetSuccess(x interface{}) { 5118 p.Success = x.(*Nesting2) 5119 } 5120 5121 var fieldIDToName_BaselineServiceNesting2MethodResult = map[int16]string{ 5122 0: "success", 5123 } 5124 5125 func (p *BaselineServiceNesting2MethodResult) IsSetSuccess() bool { 5126 return p.Success != nil 5127 } 5128 5129 func (p *BaselineServiceNesting2MethodResult) Read(iprot thrift.TProtocol) (err error) { 5130 5131 var fieldTypeId thrift.TType 5132 var fieldId int16 5133 5134 if _, err = iprot.ReadStructBegin(); err != nil { 5135 goto ReadStructBeginError 5136 } 5137 5138 for { 5139 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 5140 if err != nil { 5141 goto ReadFieldBeginError 5142 } 5143 if fieldTypeId == thrift.STOP { 5144 break 5145 } 5146 5147 switch fieldId { 5148 case 0: 5149 if fieldTypeId == thrift.STRUCT { 5150 if err = p.ReadField0(iprot); err != nil { 5151 goto ReadFieldError 5152 } 5153 } else { 5154 if err = iprot.Skip(fieldTypeId); err != nil { 5155 goto SkipFieldError 5156 } 5157 } 5158 default: 5159 if err = iprot.Skip(fieldTypeId); err != nil { 5160 goto SkipFieldError 5161 } 5162 } 5163 5164 if err = iprot.ReadFieldEnd(); err != nil { 5165 goto ReadFieldEndError 5166 } 5167 } 5168 if err = iprot.ReadStructEnd(); err != nil { 5169 goto ReadStructEndError 5170 } 5171 5172 return nil 5173 ReadStructBeginError: 5174 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 5175 ReadFieldBeginError: 5176 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 5177 ReadFieldError: 5178 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceNesting2MethodResult[fieldId]), err) 5179 SkipFieldError: 5180 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 5181 5182 ReadFieldEndError: 5183 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 5184 ReadStructEndError: 5185 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5186 } 5187 5188 func (p *BaselineServiceNesting2MethodResult) ReadField0(iprot thrift.TProtocol) error { 5189 p.Success = NewNesting2() 5190 if err := p.Success.Read(iprot); err != nil { 5191 return err 5192 } 5193 return nil 5194 } 5195 5196 func (p *BaselineServiceNesting2MethodResult) Write(oprot thrift.TProtocol) (err error) { 5197 var fieldId int16 5198 if err = oprot.WriteStructBegin("Nesting2Method_result"); err != nil { 5199 goto WriteStructBeginError 5200 } 5201 if p != nil { 5202 if err = p.writeField0(oprot); err != nil { 5203 fieldId = 0 5204 goto WriteFieldError 5205 } 5206 5207 } 5208 if err = oprot.WriteFieldStop(); err != nil { 5209 goto WriteFieldStopError 5210 } 5211 if err = oprot.WriteStructEnd(); err != nil { 5212 goto WriteStructEndError 5213 } 5214 return nil 5215 WriteStructBeginError: 5216 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5217 WriteFieldError: 5218 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 5219 WriteFieldStopError: 5220 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 5221 WriteStructEndError: 5222 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 5223 } 5224 5225 func (p *BaselineServiceNesting2MethodResult) writeField0(oprot thrift.TProtocol) (err error) { 5226 if p.IsSetSuccess() { 5227 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 5228 goto WriteFieldBeginError 5229 } 5230 if err := p.Success.Write(oprot); err != nil { 5231 return err 5232 } 5233 if err = oprot.WriteFieldEnd(); err != nil { 5234 goto WriteFieldEndError 5235 } 5236 } 5237 return nil 5238 WriteFieldBeginError: 5239 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 5240 WriteFieldEndError: 5241 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 5242 } 5243 5244 func (p *BaselineServiceNesting2MethodResult) String() string { 5245 if p == nil { 5246 return "<nil>" 5247 } 5248 return fmt.Sprintf("BaselineServiceNesting2MethodResult(%+v)", *p) 5249 } 5250 5251 func (p *BaselineServiceNesting2MethodResult) DeepEqual(ano *BaselineServiceNesting2MethodResult) bool { 5252 if p == ano { 5253 return true 5254 } else if p == nil || ano == nil { 5255 return false 5256 } 5257 if !p.Field0DeepEqual(ano.Success) { 5258 return false 5259 } 5260 return true 5261 } 5262 5263 func (p *BaselineServiceNesting2MethodResult) Field0DeepEqual(src *Nesting2) bool { 5264 5265 if !p.Success.DeepEqual(src) { 5266 return false 5267 } 5268 return true 5269 }