github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/kitex_gen/baseline/k-baseline.go (about) 1 // Code generated by Kitex v0.0.3. DO NOT EDIT. 2 3 package baseline 4 5 import ( 6 "bytes" 7 "fmt" 8 "reflect" 9 "strings" 10 11 "github.com/apache/thrift/lib/go/thrift" 12 13 "github.com/cloudwego/kitex/pkg/protocol/bthrift" 14 ) 15 16 // unused protection 17 var ( 18 _ = fmt.Formatter(nil) 19 _ = (*bytes.Buffer)(nil) 20 _ = (*strings.Builder)(nil) 21 _ = reflect.Type(nil) 22 _ = thrift.TProtocol(nil) 23 _ = bthrift.BinaryWriter(nil) 24 ) 25 26 func (p *Simple) FastRead(buf []byte) (int, error) { 27 var err error 28 var offset int 29 var l int 30 var fieldTypeId thrift.TType 31 var fieldId int16 32 _, l, err = bthrift.Binary.ReadStructBegin(buf) 33 offset += l 34 if err != nil { 35 goto ReadStructBeginError 36 } 37 38 for { 39 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 40 offset += l 41 if err != nil { 42 goto ReadFieldBeginError 43 } 44 if fieldTypeId == thrift.STOP { 45 break 46 } 47 switch fieldId { 48 case 1: 49 if fieldTypeId == thrift.BYTE { 50 l, err = p.FastReadField1(buf[offset:]) 51 offset += l 52 if err != nil { 53 goto ReadFieldError 54 } 55 } else { 56 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 57 offset += l 58 if err != nil { 59 goto SkipFieldError 60 } 61 } 62 case 2: 63 if fieldTypeId == thrift.I64 { 64 l, err = p.FastReadField2(buf[offset:]) 65 offset += l 66 if err != nil { 67 goto ReadFieldError 68 } 69 } else { 70 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 71 offset += l 72 if err != nil { 73 goto SkipFieldError 74 } 75 } 76 case 3: 77 if fieldTypeId == thrift.DOUBLE { 78 l, err = p.FastReadField3(buf[offset:]) 79 offset += l 80 if err != nil { 81 goto ReadFieldError 82 } 83 } else { 84 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 85 offset += l 86 if err != nil { 87 goto SkipFieldError 88 } 89 } 90 case 4: 91 if fieldTypeId == thrift.I32 { 92 l, err = p.FastReadField4(buf[offset:]) 93 offset += l 94 if err != nil { 95 goto ReadFieldError 96 } 97 } else { 98 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 99 offset += l 100 if err != nil { 101 goto SkipFieldError 102 } 103 } 104 case 5: 105 if fieldTypeId == thrift.STRING { 106 l, err = p.FastReadField5(buf[offset:]) 107 offset += l 108 if err != nil { 109 goto ReadFieldError 110 } 111 } else { 112 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 113 offset += l 114 if err != nil { 115 goto SkipFieldError 116 } 117 } 118 case 6: 119 if fieldTypeId == thrift.STRING { 120 l, err = p.FastReadField6(buf[offset:]) 121 offset += l 122 if err != nil { 123 goto ReadFieldError 124 } 125 } else { 126 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 127 offset += l 128 if err != nil { 129 goto SkipFieldError 130 } 131 } 132 default: 133 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 134 offset += l 135 if err != nil { 136 goto SkipFieldError 137 } 138 } 139 140 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 141 offset += l 142 if err != nil { 143 goto ReadFieldEndError 144 } 145 } 146 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 147 offset += l 148 if err != nil { 149 goto ReadStructEndError 150 } 151 152 return offset, nil 153 ReadStructBeginError: 154 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 155 ReadFieldBeginError: 156 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 157 ReadFieldError: 158 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Simple[fieldId]), err) 159 SkipFieldError: 160 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 161 ReadFieldEndError: 162 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 163 ReadStructEndError: 164 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 165 } 166 167 func (p *Simple) FastReadField1(buf []byte) (int, error) { 168 offset := 0 169 170 if v, l, err := bthrift.Binary.ReadByte(buf[offset:]); err != nil { 171 return offset, err 172 } else { 173 offset += l 174 175 p.ByteField = v 176 177 } 178 return offset, nil 179 } 180 181 func (p *Simple) FastReadField2(buf []byte) (int, error) { 182 offset := 0 183 184 if v, l, err := bthrift.Binary.ReadI64(buf[offset:]); err != nil { 185 return offset, err 186 } else { 187 offset += l 188 189 p.I64Field = v 190 191 } 192 return offset, nil 193 } 194 195 func (p *Simple) FastReadField3(buf []byte) (int, error) { 196 offset := 0 197 198 if v, l, err := bthrift.Binary.ReadDouble(buf[offset:]); err != nil { 199 return offset, err 200 } else { 201 offset += l 202 203 p.DoubleField = v 204 205 } 206 return offset, nil 207 } 208 209 func (p *Simple) FastReadField4(buf []byte) (int, error) { 210 offset := 0 211 212 if v, l, err := bthrift.Binary.ReadI32(buf[offset:]); err != nil { 213 return offset, err 214 } else { 215 offset += l 216 217 p.I32Field = v 218 219 } 220 return offset, nil 221 } 222 223 func (p *Simple) FastReadField5(buf []byte) (int, error) { 224 offset := 0 225 226 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { 227 return offset, err 228 } else { 229 offset += l 230 231 p.StringField = v 232 233 } 234 return offset, nil 235 } 236 237 func (p *Simple) FastReadField6(buf []byte) (int, error) { 238 offset := 0 239 240 if v, l, err := bthrift.Binary.ReadBinary(buf[offset:]); err != nil { 241 return offset, err 242 } else { 243 offset += l 244 245 p.BinaryField = []byte(v) 246 247 } 248 return offset, nil 249 } 250 251 // for compatibility 252 func (p *Simple) FastWrite(buf []byte) int { 253 return 0 254 } 255 256 func (p *Simple) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 257 offset := 0 258 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "Simple") 259 if p != nil { 260 offset += p.fastWriteField1(buf[offset:], binaryWriter) 261 offset += p.fastWriteField2(buf[offset:], binaryWriter) 262 offset += p.fastWriteField3(buf[offset:], binaryWriter) 263 offset += p.fastWriteField4(buf[offset:], binaryWriter) 264 offset += p.fastWriteField5(buf[offset:], binaryWriter) 265 offset += p.fastWriteField6(buf[offset:], binaryWriter) 266 } 267 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 268 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 269 return offset 270 } 271 272 func (p *Simple) BLength() int { 273 l := 0 274 l += bthrift.Binary.StructBeginLength("Simple") 275 if p != nil { 276 l += p.field1Length() 277 l += p.field2Length() 278 l += p.field3Length() 279 l += p.field4Length() 280 l += p.field5Length() 281 l += p.field6Length() 282 } 283 l += bthrift.Binary.FieldStopLength() 284 l += bthrift.Binary.StructEndLength() 285 return l 286 } 287 288 func (p *Simple) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { 289 offset := 0 290 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "ByteField", thrift.BYTE, 1) 291 offset += bthrift.Binary.WriteByte(buf[offset:], p.ByteField) 292 293 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 294 return offset 295 } 296 297 func (p *Simple) fastWriteField2(buf []byte, binaryWriter bthrift.BinaryWriter) int { 298 offset := 0 299 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "I64Field", thrift.I64, 2) 300 offset += bthrift.Binary.WriteI64(buf[offset:], p.I64Field) 301 302 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 303 return offset 304 } 305 306 func (p *Simple) fastWriteField3(buf []byte, binaryWriter bthrift.BinaryWriter) int { 307 offset := 0 308 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "DoubleField", thrift.DOUBLE, 3) 309 offset += bthrift.Binary.WriteDouble(buf[offset:], p.DoubleField) 310 311 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 312 return offset 313 } 314 315 func (p *Simple) fastWriteField4(buf []byte, binaryWriter bthrift.BinaryWriter) int { 316 offset := 0 317 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "I32Field", thrift.I32, 4) 318 offset += bthrift.Binary.WriteI32(buf[offset:], p.I32Field) 319 320 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 321 return offset 322 } 323 324 func (p *Simple) fastWriteField5(buf []byte, binaryWriter bthrift.BinaryWriter) int { 325 offset := 0 326 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "StringField", thrift.STRING, 5) 327 offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.StringField) 328 329 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 330 return offset 331 } 332 333 func (p *Simple) fastWriteField6(buf []byte, binaryWriter bthrift.BinaryWriter) int { 334 offset := 0 335 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "BinaryField", thrift.STRING, 6) 336 offset += bthrift.Binary.WriteBinaryNocopy(buf[offset:], binaryWriter, []byte(p.BinaryField)) 337 338 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 339 return offset 340 } 341 342 func (p *Simple) field1Length() int { 343 l := 0 344 l += bthrift.Binary.FieldBeginLength("ByteField", thrift.BYTE, 1) 345 l += bthrift.Binary.ByteLength(p.ByteField) 346 347 l += bthrift.Binary.FieldEndLength() 348 return l 349 } 350 351 func (p *Simple) field2Length() int { 352 l := 0 353 l += bthrift.Binary.FieldBeginLength("I64Field", thrift.I64, 2) 354 l += bthrift.Binary.I64Length(p.I64Field) 355 356 l += bthrift.Binary.FieldEndLength() 357 return l 358 } 359 360 func (p *Simple) field3Length() int { 361 l := 0 362 l += bthrift.Binary.FieldBeginLength("DoubleField", thrift.DOUBLE, 3) 363 l += bthrift.Binary.DoubleLength(p.DoubleField) 364 365 l += bthrift.Binary.FieldEndLength() 366 return l 367 } 368 369 func (p *Simple) field4Length() int { 370 l := 0 371 l += bthrift.Binary.FieldBeginLength("I32Field", thrift.I32, 4) 372 l += bthrift.Binary.I32Length(p.I32Field) 373 374 l += bthrift.Binary.FieldEndLength() 375 return l 376 } 377 378 func (p *Simple) field5Length() int { 379 l := 0 380 l += bthrift.Binary.FieldBeginLength("StringField", thrift.STRING, 5) 381 l += bthrift.Binary.StringLength(p.StringField) 382 383 l += bthrift.Binary.FieldEndLength() 384 return l 385 } 386 387 func (p *Simple) field6Length() int { 388 l := 0 389 l += bthrift.Binary.FieldBeginLength("BinaryField", thrift.STRING, 6) 390 l += bthrift.Binary.BinaryLengthNocopy([]byte(p.BinaryField)) 391 392 l += bthrift.Binary.FieldEndLength() 393 return l 394 } 395 396 func (p *PartialSimple) FastRead(buf []byte) (int, error) { 397 var err error 398 var offset int 399 var l int 400 var fieldTypeId thrift.TType 401 var fieldId int16 402 _, l, err = bthrift.Binary.ReadStructBegin(buf) 403 offset += l 404 if err != nil { 405 goto ReadStructBeginError 406 } 407 408 for { 409 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 410 offset += l 411 if err != nil { 412 goto ReadFieldBeginError 413 } 414 if fieldTypeId == thrift.STOP { 415 break 416 } 417 switch fieldId { 418 case 1: 419 if fieldTypeId == thrift.BYTE { 420 l, err = p.FastReadField1(buf[offset:]) 421 offset += l 422 if err != nil { 423 goto ReadFieldError 424 } 425 } else { 426 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 427 offset += l 428 if err != nil { 429 goto SkipFieldError 430 } 431 } 432 case 3: 433 if fieldTypeId == thrift.DOUBLE { 434 l, err = p.FastReadField3(buf[offset:]) 435 offset += l 436 if err != nil { 437 goto ReadFieldError 438 } 439 } else { 440 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 441 offset += l 442 if err != nil { 443 goto SkipFieldError 444 } 445 } 446 case 6: 447 if fieldTypeId == thrift.STRING { 448 l, err = p.FastReadField6(buf[offset:]) 449 offset += l 450 if err != nil { 451 goto ReadFieldError 452 } 453 } else { 454 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 455 offset += l 456 if err != nil { 457 goto SkipFieldError 458 } 459 } 460 default: 461 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 462 offset += l 463 if err != nil { 464 goto SkipFieldError 465 } 466 } 467 468 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 469 offset += l 470 if err != nil { 471 goto ReadFieldEndError 472 } 473 } 474 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 475 offset += l 476 if err != nil { 477 goto ReadStructEndError 478 } 479 480 return offset, nil 481 ReadStructBeginError: 482 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 483 ReadFieldBeginError: 484 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 485 ReadFieldError: 486 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PartialSimple[fieldId]), err) 487 SkipFieldError: 488 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 489 ReadFieldEndError: 490 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 491 ReadStructEndError: 492 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 493 } 494 495 func (p *PartialSimple) FastReadField1(buf []byte) (int, error) { 496 offset := 0 497 498 if v, l, err := bthrift.Binary.ReadByte(buf[offset:]); err != nil { 499 return offset, err 500 } else { 501 offset += l 502 503 p.ByteField = v 504 505 } 506 return offset, nil 507 } 508 509 func (p *PartialSimple) FastReadField3(buf []byte) (int, error) { 510 offset := 0 511 512 if v, l, err := bthrift.Binary.ReadDouble(buf[offset:]); err != nil { 513 return offset, err 514 } else { 515 offset += l 516 517 p.DoubleField = v 518 519 } 520 return offset, nil 521 } 522 523 func (p *PartialSimple) FastReadField6(buf []byte) (int, error) { 524 offset := 0 525 526 if v, l, err := bthrift.Binary.ReadBinary(buf[offset:]); err != nil { 527 return offset, err 528 } else { 529 offset += l 530 531 p.BinaryField = []byte(v) 532 533 } 534 return offset, nil 535 } 536 537 // for compatibility 538 func (p *PartialSimple) FastWrite(buf []byte) int { 539 return 0 540 } 541 542 func (p *PartialSimple) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 543 offset := 0 544 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "PartialSimple") 545 if p != nil { 546 offset += p.fastWriteField1(buf[offset:], binaryWriter) 547 offset += p.fastWriteField3(buf[offset:], binaryWriter) 548 offset += p.fastWriteField6(buf[offset:], binaryWriter) 549 } 550 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 551 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 552 return offset 553 } 554 555 func (p *PartialSimple) BLength() int { 556 l := 0 557 l += bthrift.Binary.StructBeginLength("PartialSimple") 558 if p != nil { 559 l += p.field1Length() 560 l += p.field3Length() 561 l += p.field6Length() 562 } 563 l += bthrift.Binary.FieldStopLength() 564 l += bthrift.Binary.StructEndLength() 565 return l 566 } 567 568 func (p *PartialSimple) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { 569 offset := 0 570 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "ByteField", thrift.BYTE, 1) 571 offset += bthrift.Binary.WriteByte(buf[offset:], p.ByteField) 572 573 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 574 return offset 575 } 576 577 func (p *PartialSimple) fastWriteField3(buf []byte, binaryWriter bthrift.BinaryWriter) int { 578 offset := 0 579 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "DoubleField", thrift.DOUBLE, 3) 580 offset += bthrift.Binary.WriteDouble(buf[offset:], p.DoubleField) 581 582 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 583 return offset 584 } 585 586 func (p *PartialSimple) fastWriteField6(buf []byte, binaryWriter bthrift.BinaryWriter) int { 587 offset := 0 588 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "BinaryField", thrift.STRING, 6) 589 offset += bthrift.Binary.WriteBinaryNocopy(buf[offset:], binaryWriter, []byte(p.BinaryField)) 590 591 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 592 return offset 593 } 594 595 func (p *PartialSimple) field1Length() int { 596 l := 0 597 l += bthrift.Binary.FieldBeginLength("ByteField", thrift.BYTE, 1) 598 l += bthrift.Binary.ByteLength(p.ByteField) 599 600 l += bthrift.Binary.FieldEndLength() 601 return l 602 } 603 604 func (p *PartialSimple) field3Length() int { 605 l := 0 606 l += bthrift.Binary.FieldBeginLength("DoubleField", thrift.DOUBLE, 3) 607 l += bthrift.Binary.DoubleLength(p.DoubleField) 608 609 l += bthrift.Binary.FieldEndLength() 610 return l 611 } 612 613 func (p *PartialSimple) field6Length() int { 614 l := 0 615 l += bthrift.Binary.FieldBeginLength("BinaryField", thrift.STRING, 6) 616 l += bthrift.Binary.BinaryLengthNocopy([]byte(p.BinaryField)) 617 618 l += bthrift.Binary.FieldEndLength() 619 return l 620 } 621 622 func (p *Nesting) FastRead(buf []byte) (int, error) { 623 var err error 624 var offset int 625 var l int 626 var fieldTypeId thrift.TType 627 var fieldId int16 628 _, l, err = bthrift.Binary.ReadStructBegin(buf) 629 offset += l 630 if err != nil { 631 goto ReadStructBeginError 632 } 633 634 for { 635 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 636 offset += l 637 if err != nil { 638 goto ReadFieldBeginError 639 } 640 if fieldTypeId == thrift.STOP { 641 break 642 } 643 switch fieldId { 644 case 1: 645 if fieldTypeId == thrift.STRING { 646 l, err = p.FastReadField1(buf[offset:]) 647 offset += l 648 if err != nil { 649 goto ReadFieldError 650 } 651 } else { 652 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 653 offset += l 654 if err != nil { 655 goto SkipFieldError 656 } 657 } 658 case 2: 659 if fieldTypeId == thrift.LIST { 660 l, err = p.FastReadField2(buf[offset:]) 661 offset += l 662 if err != nil { 663 goto ReadFieldError 664 } 665 } else { 666 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 667 offset += l 668 if err != nil { 669 goto SkipFieldError 670 } 671 } 672 case 3: 673 if fieldTypeId == thrift.DOUBLE { 674 l, err = p.FastReadField3(buf[offset:]) 675 offset += l 676 if err != nil { 677 goto ReadFieldError 678 } 679 } else { 680 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 681 offset += l 682 if err != nil { 683 goto SkipFieldError 684 } 685 } 686 case 4: 687 if fieldTypeId == thrift.I32 { 688 l, err = p.FastReadField4(buf[offset:]) 689 offset += l 690 if err != nil { 691 goto ReadFieldError 692 } 693 } else { 694 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 695 offset += l 696 if err != nil { 697 goto SkipFieldError 698 } 699 } 700 case 5: 701 if fieldTypeId == thrift.LIST { 702 l, err = p.FastReadField5(buf[offset:]) 703 offset += l 704 if err != nil { 705 goto ReadFieldError 706 } 707 } else { 708 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 709 offset += l 710 if err != nil { 711 goto SkipFieldError 712 } 713 } 714 case 6: 715 if fieldTypeId == thrift.I64 { 716 l, err = p.FastReadField6(buf[offset:]) 717 offset += l 718 if err != nil { 719 goto ReadFieldError 720 } 721 } else { 722 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 723 offset += l 724 if err != nil { 725 goto SkipFieldError 726 } 727 } 728 case 7: 729 if fieldTypeId == thrift.MAP { 730 l, err = p.FastReadField7(buf[offset:]) 731 offset += l 732 if err != nil { 733 goto ReadFieldError 734 } 735 } else { 736 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 737 offset += l 738 if err != nil { 739 goto SkipFieldError 740 } 741 } 742 case 8: 743 if fieldTypeId == thrift.STRUCT { 744 l, err = p.FastReadField8(buf[offset:]) 745 offset += l 746 if err != nil { 747 goto ReadFieldError 748 } 749 } else { 750 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 751 offset += l 752 if err != nil { 753 goto SkipFieldError 754 } 755 } 756 case 9: 757 if fieldTypeId == thrift.MAP { 758 l, err = p.FastReadField9(buf[offset:]) 759 offset += l 760 if err != nil { 761 goto ReadFieldError 762 } 763 } else { 764 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 765 offset += l 766 if err != nil { 767 goto SkipFieldError 768 } 769 } 770 case 10: 771 if fieldTypeId == thrift.LIST { 772 l, err = p.FastReadField10(buf[offset:]) 773 offset += l 774 if err != nil { 775 goto ReadFieldError 776 } 777 } else { 778 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 779 offset += l 780 if err != nil { 781 goto SkipFieldError 782 } 783 } 784 case 11: 785 if fieldTypeId == thrift.STRING { 786 l, err = p.FastReadField11(buf[offset:]) 787 offset += l 788 if err != nil { 789 goto ReadFieldError 790 } 791 } else { 792 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 793 offset += l 794 if err != nil { 795 goto SkipFieldError 796 } 797 } 798 case 12: 799 if fieldTypeId == thrift.MAP { 800 l, err = p.FastReadField12(buf[offset:]) 801 offset += l 802 if err != nil { 803 goto ReadFieldError 804 } 805 } else { 806 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 807 offset += l 808 if err != nil { 809 goto SkipFieldError 810 } 811 } 812 case 13: 813 if fieldTypeId == thrift.LIST { 814 l, err = p.FastReadField13(buf[offset:]) 815 offset += l 816 if err != nil { 817 goto ReadFieldError 818 } 819 } else { 820 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 821 offset += l 822 if err != nil { 823 goto SkipFieldError 824 } 825 } 826 case 14: 827 if fieldTypeId == thrift.BYTE { 828 l, err = p.FastReadField14(buf[offset:]) 829 offset += l 830 if err != nil { 831 goto ReadFieldError 832 } 833 } else { 834 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 835 offset += l 836 if err != nil { 837 goto SkipFieldError 838 } 839 } 840 case 15: 841 if fieldTypeId == thrift.MAP { 842 l, err = p.FastReadField15(buf[offset:]) 843 offset += l 844 if err != nil { 845 goto ReadFieldError 846 } 847 } else { 848 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 849 offset += l 850 if err != nil { 851 goto SkipFieldError 852 } 853 } 854 default: 855 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 856 offset += l 857 if err != nil { 858 goto SkipFieldError 859 } 860 } 861 862 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 863 offset += l 864 if err != nil { 865 goto ReadFieldEndError 866 } 867 } 868 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 869 offset += l 870 if err != nil { 871 goto ReadStructEndError 872 } 873 874 return offset, nil 875 ReadStructBeginError: 876 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 877 ReadFieldBeginError: 878 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 879 ReadFieldError: 880 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Nesting[fieldId]), err) 881 SkipFieldError: 882 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 883 ReadFieldEndError: 884 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 885 ReadStructEndError: 886 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 887 } 888 889 func (p *Nesting) FastReadField1(buf []byte) (int, error) { 890 offset := 0 891 892 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { 893 return offset, err 894 } else { 895 offset += l 896 897 p.String_ = v 898 899 } 900 return offset, nil 901 } 902 903 func (p *Nesting) FastReadField2(buf []byte) (int, error) { 904 offset := 0 905 906 _, size, l, err := bthrift.Binary.ReadListBegin(buf[offset:]) 907 offset += l 908 if err != nil { 909 return offset, err 910 } 911 p.ListSimple = make([]*Simple, 0, size) 912 for i := 0; i < size; i++ { 913 _elem := NewSimple() 914 if l, err := _elem.FastRead(buf[offset:]); err != nil { 915 return offset, err 916 } else { 917 offset += l 918 } 919 920 p.ListSimple = append(p.ListSimple, _elem) 921 } 922 if l, err := bthrift.Binary.ReadListEnd(buf[offset:]); err != nil { 923 return offset, err 924 } else { 925 offset += l 926 } 927 return offset, nil 928 } 929 930 func (p *Nesting) FastReadField3(buf []byte) (int, error) { 931 offset := 0 932 933 if v, l, err := bthrift.Binary.ReadDouble(buf[offset:]); err != nil { 934 return offset, err 935 } else { 936 offset += l 937 938 p.Double = v 939 940 } 941 return offset, nil 942 } 943 944 func (p *Nesting) FastReadField4(buf []byte) (int, error) { 945 offset := 0 946 947 if v, l, err := bthrift.Binary.ReadI32(buf[offset:]); err != nil { 948 return offset, err 949 } else { 950 offset += l 951 952 p.I32 = v 953 954 } 955 return offset, nil 956 } 957 958 func (p *Nesting) FastReadField5(buf []byte) (int, error) { 959 offset := 0 960 961 _, size, l, err := bthrift.Binary.ReadListBegin(buf[offset:]) 962 offset += l 963 if err != nil { 964 return offset, err 965 } 966 p.ListI32 = make([]int32, 0, size) 967 for i := 0; i < size; i++ { 968 var _elem int32 969 if v, l, err := bthrift.Binary.ReadI32(buf[offset:]); err != nil { 970 return offset, err 971 } else { 972 offset += l 973 974 _elem = v 975 976 } 977 978 p.ListI32 = append(p.ListI32, _elem) 979 } 980 if l, err := bthrift.Binary.ReadListEnd(buf[offset:]); err != nil { 981 return offset, err 982 } else { 983 offset += l 984 } 985 return offset, nil 986 } 987 988 func (p *Nesting) FastReadField6(buf []byte) (int, error) { 989 offset := 0 990 991 if v, l, err := bthrift.Binary.ReadI64(buf[offset:]); err != nil { 992 return offset, err 993 } else { 994 offset += l 995 996 p.I64 = v 997 998 } 999 return offset, nil 1000 } 1001 1002 func (p *Nesting) FastReadField7(buf []byte) (int, error) { 1003 offset := 0 1004 1005 _, _, size, l, err := bthrift.Binary.ReadMapBegin(buf[offset:]) 1006 offset += l 1007 if err != nil { 1008 return offset, err 1009 } 1010 p.MapStringString = make(map[string]string, size) 1011 for i := 0; i < size; i++ { 1012 var _key string 1013 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { 1014 return offset, err 1015 } else { 1016 offset += l 1017 1018 _key = v 1019 1020 } 1021 1022 var _val string 1023 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { 1024 return offset, err 1025 } else { 1026 offset += l 1027 1028 _val = v 1029 1030 } 1031 1032 p.MapStringString[_key] = _val 1033 } 1034 if l, err := bthrift.Binary.ReadMapEnd(buf[offset:]); err != nil { 1035 return offset, err 1036 } else { 1037 offset += l 1038 } 1039 return offset, nil 1040 } 1041 1042 func (p *Nesting) FastReadField8(buf []byte) (int, error) { 1043 offset := 0 1044 p.SimpleStruct = NewSimple() 1045 if l, err := p.SimpleStruct.FastRead(buf[offset:]); err != nil { 1046 return offset, err 1047 } else { 1048 offset += l 1049 } 1050 return offset, nil 1051 } 1052 1053 func (p *Nesting) FastReadField9(buf []byte) (int, error) { 1054 offset := 0 1055 1056 _, _, size, l, err := bthrift.Binary.ReadMapBegin(buf[offset:]) 1057 offset += l 1058 if err != nil { 1059 return offset, err 1060 } 1061 p.MapI32I64 = make(map[int32]int64, size) 1062 for i := 0; i < size; i++ { 1063 var _key int32 1064 if v, l, err := bthrift.Binary.ReadI32(buf[offset:]); err != nil { 1065 return offset, err 1066 } else { 1067 offset += l 1068 1069 _key = v 1070 1071 } 1072 1073 var _val int64 1074 if v, l, err := bthrift.Binary.ReadI64(buf[offset:]); err != nil { 1075 return offset, err 1076 } else { 1077 offset += l 1078 1079 _val = v 1080 1081 } 1082 1083 p.MapI32I64[_key] = _val 1084 } 1085 if l, err := bthrift.Binary.ReadMapEnd(buf[offset:]); err != nil { 1086 return offset, err 1087 } else { 1088 offset += l 1089 } 1090 return offset, nil 1091 } 1092 1093 func (p *Nesting) FastReadField10(buf []byte) (int, error) { 1094 offset := 0 1095 1096 _, size, l, err := bthrift.Binary.ReadListBegin(buf[offset:]) 1097 offset += l 1098 if err != nil { 1099 return offset, err 1100 } 1101 p.ListString = make([]string, 0, size) 1102 for i := 0; i < size; i++ { 1103 var _elem string 1104 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { 1105 return offset, err 1106 } else { 1107 offset += l 1108 1109 _elem = v 1110 1111 } 1112 1113 p.ListString = append(p.ListString, _elem) 1114 } 1115 if l, err := bthrift.Binary.ReadListEnd(buf[offset:]); err != nil { 1116 return offset, err 1117 } else { 1118 offset += l 1119 } 1120 return offset, nil 1121 } 1122 1123 func (p *Nesting) FastReadField11(buf []byte) (int, error) { 1124 offset := 0 1125 1126 if v, l, err := bthrift.Binary.ReadBinary(buf[offset:]); err != nil { 1127 return offset, err 1128 } else { 1129 offset += l 1130 1131 p.Binary = []byte(v) 1132 1133 } 1134 return offset, nil 1135 } 1136 1137 func (p *Nesting) FastReadField12(buf []byte) (int, error) { 1138 offset := 0 1139 1140 _, _, size, l, err := bthrift.Binary.ReadMapBegin(buf[offset:]) 1141 offset += l 1142 if err != nil { 1143 return offset, err 1144 } 1145 p.MapI64String = make(map[int64]string, size) 1146 for i := 0; i < size; i++ { 1147 var _key int64 1148 if v, l, err := bthrift.Binary.ReadI64(buf[offset:]); err != nil { 1149 return offset, err 1150 } else { 1151 offset += l 1152 1153 _key = v 1154 1155 } 1156 1157 var _val string 1158 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { 1159 return offset, err 1160 } else { 1161 offset += l 1162 1163 _val = v 1164 1165 } 1166 1167 p.MapI64String[_key] = _val 1168 } 1169 if l, err := bthrift.Binary.ReadMapEnd(buf[offset:]); err != nil { 1170 return offset, err 1171 } else { 1172 offset += l 1173 } 1174 return offset, nil 1175 } 1176 1177 func (p *Nesting) FastReadField13(buf []byte) (int, error) { 1178 offset := 0 1179 1180 _, size, l, err := bthrift.Binary.ReadListBegin(buf[offset:]) 1181 offset += l 1182 if err != nil { 1183 return offset, err 1184 } 1185 p.ListI64 = make([]int64, 0, size) 1186 for i := 0; i < size; i++ { 1187 var _elem int64 1188 if v, l, err := bthrift.Binary.ReadI64(buf[offset:]); err != nil { 1189 return offset, err 1190 } else { 1191 offset += l 1192 1193 _elem = v 1194 1195 } 1196 1197 p.ListI64 = append(p.ListI64, _elem) 1198 } 1199 if l, err := bthrift.Binary.ReadListEnd(buf[offset:]); err != nil { 1200 return offset, err 1201 } else { 1202 offset += l 1203 } 1204 return offset, nil 1205 } 1206 1207 func (p *Nesting) FastReadField14(buf []byte) (int, error) { 1208 offset := 0 1209 1210 if v, l, err := bthrift.Binary.ReadByte(buf[offset:]); err != nil { 1211 return offset, err 1212 } else { 1213 offset += l 1214 1215 p.Byte = v 1216 1217 } 1218 return offset, nil 1219 } 1220 1221 func (p *Nesting) FastReadField15(buf []byte) (int, error) { 1222 offset := 0 1223 1224 _, _, size, l, err := bthrift.Binary.ReadMapBegin(buf[offset:]) 1225 offset += l 1226 if err != nil { 1227 return offset, err 1228 } 1229 p.MapStringSimple = make(map[string]*Simple, size) 1230 for i := 0; i < size; i++ { 1231 var _key string 1232 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { 1233 return offset, err 1234 } else { 1235 offset += l 1236 1237 _key = v 1238 1239 } 1240 _val := NewSimple() 1241 if l, err := _val.FastRead(buf[offset:]); err != nil { 1242 return offset, err 1243 } else { 1244 offset += l 1245 } 1246 1247 p.MapStringSimple[_key] = _val 1248 } 1249 if l, err := bthrift.Binary.ReadMapEnd(buf[offset:]); err != nil { 1250 return offset, err 1251 } else { 1252 offset += l 1253 } 1254 return offset, nil 1255 } 1256 1257 // for compatibility 1258 func (p *Nesting) FastWrite(buf []byte) int { 1259 return 0 1260 } 1261 1262 func (p *Nesting) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1263 offset := 0 1264 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "Nesting") 1265 if p != nil { 1266 offset += p.fastWriteField3(buf[offset:], binaryWriter) 1267 offset += p.fastWriteField4(buf[offset:], binaryWriter) 1268 offset += p.fastWriteField6(buf[offset:], binaryWriter) 1269 offset += p.fastWriteField14(buf[offset:], binaryWriter) 1270 offset += p.fastWriteField1(buf[offset:], binaryWriter) 1271 offset += p.fastWriteField2(buf[offset:], binaryWriter) 1272 offset += p.fastWriteField5(buf[offset:], binaryWriter) 1273 offset += p.fastWriteField7(buf[offset:], binaryWriter) 1274 offset += p.fastWriteField8(buf[offset:], binaryWriter) 1275 offset += p.fastWriteField9(buf[offset:], binaryWriter) 1276 offset += p.fastWriteField10(buf[offset:], binaryWriter) 1277 offset += p.fastWriteField11(buf[offset:], binaryWriter) 1278 offset += p.fastWriteField12(buf[offset:], binaryWriter) 1279 offset += p.fastWriteField13(buf[offset:], binaryWriter) 1280 offset += p.fastWriteField15(buf[offset:], binaryWriter) 1281 } 1282 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 1283 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 1284 return offset 1285 } 1286 1287 func (p *Nesting) BLength() int { 1288 l := 0 1289 l += bthrift.Binary.StructBeginLength("Nesting") 1290 if p != nil { 1291 l += p.field1Length() 1292 l += p.field2Length() 1293 l += p.field3Length() 1294 l += p.field4Length() 1295 l += p.field5Length() 1296 l += p.field6Length() 1297 l += p.field7Length() 1298 l += p.field8Length() 1299 l += p.field9Length() 1300 l += p.field10Length() 1301 l += p.field11Length() 1302 l += p.field12Length() 1303 l += p.field13Length() 1304 l += p.field14Length() 1305 l += p.field15Length() 1306 } 1307 l += bthrift.Binary.FieldStopLength() 1308 l += bthrift.Binary.StructEndLength() 1309 return l 1310 } 1311 1312 func (p *Nesting) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1313 offset := 0 1314 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "String", thrift.STRING, 1) 1315 offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.String_) 1316 1317 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1318 return offset 1319 } 1320 1321 func (p *Nesting) fastWriteField2(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1322 offset := 0 1323 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "ListSimple", thrift.LIST, 2) 1324 offset += bthrift.Binary.WriteListBegin(buf[offset:], thrift.STRUCT, len(p.ListSimple)) 1325 for _, v := range p.ListSimple { 1326 offset += v.FastWriteNocopy(buf[offset:], binaryWriter) 1327 } 1328 offset += bthrift.Binary.WriteListEnd(buf[offset:]) 1329 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1330 return offset 1331 } 1332 1333 func (p *Nesting) fastWriteField3(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1334 offset := 0 1335 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "Double", thrift.DOUBLE, 3) 1336 offset += bthrift.Binary.WriteDouble(buf[offset:], p.Double) 1337 1338 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1339 return offset 1340 } 1341 1342 func (p *Nesting) fastWriteField4(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1343 offset := 0 1344 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "I32", thrift.I32, 4) 1345 offset += bthrift.Binary.WriteI32(buf[offset:], p.I32) 1346 1347 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1348 return offset 1349 } 1350 1351 func (p *Nesting) fastWriteField5(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1352 offset := 0 1353 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "ListI32", thrift.LIST, 5) 1354 offset += bthrift.Binary.WriteListBegin(buf[offset:], thrift.I32, len(p.ListI32)) 1355 for _, v := range p.ListI32 { 1356 offset += bthrift.Binary.WriteI32(buf[offset:], v) 1357 1358 } 1359 offset += bthrift.Binary.WriteListEnd(buf[offset:]) 1360 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1361 return offset 1362 } 1363 1364 func (p *Nesting) fastWriteField6(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1365 offset := 0 1366 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "I64", thrift.I64, 6) 1367 offset += bthrift.Binary.WriteI64(buf[offset:], p.I64) 1368 1369 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1370 return offset 1371 } 1372 1373 func (p *Nesting) fastWriteField7(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1374 offset := 0 1375 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "MapStringString", thrift.MAP, 7) 1376 offset += bthrift.Binary.WriteMapBegin(buf[offset:], thrift.STRING, thrift.STRING, len(p.MapStringString)) 1377 for k, v := range p.MapStringString { 1378 1379 offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, k) 1380 1381 offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, v) 1382 1383 } 1384 offset += bthrift.Binary.WriteMapEnd(buf[offset:]) 1385 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1386 return offset 1387 } 1388 1389 func (p *Nesting) fastWriteField8(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1390 offset := 0 1391 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "SimpleStruct", thrift.STRUCT, 8) 1392 offset += p.SimpleStruct.FastWriteNocopy(buf[offset:], binaryWriter) 1393 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1394 return offset 1395 } 1396 1397 func (p *Nesting) fastWriteField9(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1398 offset := 0 1399 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "MapI32I64", thrift.MAP, 9) 1400 offset += bthrift.Binary.WriteMapBegin(buf[offset:], thrift.I32, thrift.I64, len(p.MapI32I64)) 1401 for k, v := range p.MapI32I64 { 1402 1403 offset += bthrift.Binary.WriteI32(buf[offset:], k) 1404 1405 offset += bthrift.Binary.WriteI64(buf[offset:], v) 1406 1407 } 1408 offset += bthrift.Binary.WriteMapEnd(buf[offset:]) 1409 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1410 return offset 1411 } 1412 1413 func (p *Nesting) fastWriteField10(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1414 offset := 0 1415 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "ListString", thrift.LIST, 10) 1416 offset += bthrift.Binary.WriteListBegin(buf[offset:], thrift.STRING, len(p.ListString)) 1417 for _, v := range p.ListString { 1418 offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, v) 1419 1420 } 1421 offset += bthrift.Binary.WriteListEnd(buf[offset:]) 1422 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1423 return offset 1424 } 1425 1426 func (p *Nesting) fastWriteField11(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1427 offset := 0 1428 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "Binary", thrift.STRING, 11) 1429 offset += bthrift.Binary.WriteBinaryNocopy(buf[offset:], binaryWriter, []byte(p.Binary)) 1430 1431 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1432 return offset 1433 } 1434 1435 func (p *Nesting) fastWriteField12(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1436 offset := 0 1437 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "MapI64String", thrift.MAP, 12) 1438 offset += bthrift.Binary.WriteMapBegin(buf[offset:], thrift.I64, thrift.STRING, len(p.MapI64String)) 1439 for k, v := range p.MapI64String { 1440 1441 offset += bthrift.Binary.WriteI64(buf[offset:], k) 1442 1443 offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, v) 1444 1445 } 1446 offset += bthrift.Binary.WriteMapEnd(buf[offset:]) 1447 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1448 return offset 1449 } 1450 1451 func (p *Nesting) fastWriteField13(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1452 offset := 0 1453 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "ListI64", thrift.LIST, 13) 1454 offset += bthrift.Binary.WriteListBegin(buf[offset:], thrift.I64, len(p.ListI64)) 1455 for _, v := range p.ListI64 { 1456 offset += bthrift.Binary.WriteI64(buf[offset:], v) 1457 1458 } 1459 offset += bthrift.Binary.WriteListEnd(buf[offset:]) 1460 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1461 return offset 1462 } 1463 1464 func (p *Nesting) fastWriteField14(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1465 offset := 0 1466 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "Byte", thrift.BYTE, 14) 1467 offset += bthrift.Binary.WriteByte(buf[offset:], p.Byte) 1468 1469 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1470 return offset 1471 } 1472 1473 func (p *Nesting) fastWriteField15(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1474 offset := 0 1475 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "MapStringSimple", thrift.MAP, 15) 1476 offset += bthrift.Binary.WriteMapBegin(buf[offset:], thrift.STRING, thrift.STRUCT, len(p.MapStringSimple)) 1477 for k, v := range p.MapStringSimple { 1478 1479 offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, k) 1480 1481 offset += v.FastWriteNocopy(buf[offset:], binaryWriter) 1482 } 1483 offset += bthrift.Binary.WriteMapEnd(buf[offset:]) 1484 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1485 return offset 1486 } 1487 1488 func (p *Nesting) field1Length() int { 1489 l := 0 1490 l += bthrift.Binary.FieldBeginLength("String", thrift.STRING, 1) 1491 l += bthrift.Binary.StringLength(p.String_) 1492 1493 l += bthrift.Binary.FieldEndLength() 1494 return l 1495 } 1496 1497 func (p *Nesting) field2Length() int { 1498 l := 0 1499 l += bthrift.Binary.FieldBeginLength("ListSimple", thrift.LIST, 2) 1500 l += bthrift.Binary.ListBeginLength(thrift.STRUCT, len(p.ListSimple)) 1501 for _, v := range p.ListSimple { 1502 l += v.BLength() 1503 } 1504 l += bthrift.Binary.ListEndLength() 1505 l += bthrift.Binary.FieldEndLength() 1506 return l 1507 } 1508 1509 func (p *Nesting) field3Length() int { 1510 l := 0 1511 l += bthrift.Binary.FieldBeginLength("Double", thrift.DOUBLE, 3) 1512 l += bthrift.Binary.DoubleLength(p.Double) 1513 1514 l += bthrift.Binary.FieldEndLength() 1515 return l 1516 } 1517 1518 func (p *Nesting) field4Length() int { 1519 l := 0 1520 l += bthrift.Binary.FieldBeginLength("I32", thrift.I32, 4) 1521 l += bthrift.Binary.I32Length(p.I32) 1522 1523 l += bthrift.Binary.FieldEndLength() 1524 return l 1525 } 1526 1527 func (p *Nesting) field5Length() int { 1528 l := 0 1529 l += bthrift.Binary.FieldBeginLength("ListI32", thrift.LIST, 5) 1530 l += bthrift.Binary.ListBeginLength(thrift.I32, len(p.ListI32)) 1531 var tmpV int32 1532 l += bthrift.Binary.I32Length(int32(tmpV)) * len(p.ListI32) 1533 l += bthrift.Binary.ListEndLength() 1534 l += bthrift.Binary.FieldEndLength() 1535 return l 1536 } 1537 1538 func (p *Nesting) field6Length() int { 1539 l := 0 1540 l += bthrift.Binary.FieldBeginLength("I64", thrift.I64, 6) 1541 l += bthrift.Binary.I64Length(p.I64) 1542 1543 l += bthrift.Binary.FieldEndLength() 1544 return l 1545 } 1546 1547 func (p *Nesting) field7Length() int { 1548 l := 0 1549 l += bthrift.Binary.FieldBeginLength("MapStringString", thrift.MAP, 7) 1550 l += bthrift.Binary.MapBeginLength(thrift.STRING, thrift.STRING, len(p.MapStringString)) 1551 for k, v := range p.MapStringString { 1552 1553 l += bthrift.Binary.StringLength(k) 1554 1555 l += bthrift.Binary.StringLength(v) 1556 1557 } 1558 l += bthrift.Binary.MapEndLength() 1559 l += bthrift.Binary.FieldEndLength() 1560 return l 1561 } 1562 1563 func (p *Nesting) field8Length() int { 1564 l := 0 1565 l += bthrift.Binary.FieldBeginLength("SimpleStruct", thrift.STRUCT, 8) 1566 l += p.SimpleStruct.BLength() 1567 l += bthrift.Binary.FieldEndLength() 1568 return l 1569 } 1570 1571 func (p *Nesting) field9Length() int { 1572 l := 0 1573 l += bthrift.Binary.FieldBeginLength("MapI32I64", thrift.MAP, 9) 1574 l += bthrift.Binary.MapBeginLength(thrift.I32, thrift.I64, len(p.MapI32I64)) 1575 var tmpK int32 1576 var tmpV int64 1577 l += (bthrift.Binary.I32Length(int32(tmpK)) + bthrift.Binary.I64Length(int64(tmpV))) * len(p.MapI32I64) 1578 l += bthrift.Binary.MapEndLength() 1579 l += bthrift.Binary.FieldEndLength() 1580 return l 1581 } 1582 1583 func (p *Nesting) field10Length() int { 1584 l := 0 1585 l += bthrift.Binary.FieldBeginLength("ListString", thrift.LIST, 10) 1586 l += bthrift.Binary.ListBeginLength(thrift.STRING, len(p.ListString)) 1587 for _, v := range p.ListString { 1588 l += bthrift.Binary.StringLength(v) 1589 1590 } 1591 l += bthrift.Binary.ListEndLength() 1592 l += bthrift.Binary.FieldEndLength() 1593 return l 1594 } 1595 1596 func (p *Nesting) field11Length() int { 1597 l := 0 1598 l += bthrift.Binary.FieldBeginLength("Binary", thrift.STRING, 11) 1599 l += bthrift.Binary.BinaryLengthNocopy([]byte(p.Binary)) 1600 1601 l += bthrift.Binary.FieldEndLength() 1602 return l 1603 } 1604 1605 func (p *Nesting) field12Length() int { 1606 l := 0 1607 l += bthrift.Binary.FieldBeginLength("MapI64String", thrift.MAP, 12) 1608 l += bthrift.Binary.MapBeginLength(thrift.I64, thrift.STRING, len(p.MapI64String)) 1609 for k, v := range p.MapI64String { 1610 1611 l += bthrift.Binary.I64Length(k) 1612 1613 l += bthrift.Binary.StringLength(v) 1614 1615 } 1616 l += bthrift.Binary.MapEndLength() 1617 l += bthrift.Binary.FieldEndLength() 1618 return l 1619 } 1620 1621 func (p *Nesting) field13Length() int { 1622 l := 0 1623 l += bthrift.Binary.FieldBeginLength("ListI64", thrift.LIST, 13) 1624 l += bthrift.Binary.ListBeginLength(thrift.I64, len(p.ListI64)) 1625 var tmpV int64 1626 l += bthrift.Binary.I64Length(int64(tmpV)) * len(p.ListI64) 1627 l += bthrift.Binary.ListEndLength() 1628 l += bthrift.Binary.FieldEndLength() 1629 return l 1630 } 1631 1632 func (p *Nesting) field14Length() int { 1633 l := 0 1634 l += bthrift.Binary.FieldBeginLength("Byte", thrift.BYTE, 14) 1635 l += bthrift.Binary.ByteLength(p.Byte) 1636 1637 l += bthrift.Binary.FieldEndLength() 1638 return l 1639 } 1640 1641 func (p *Nesting) field15Length() int { 1642 l := 0 1643 l += bthrift.Binary.FieldBeginLength("MapStringSimple", thrift.MAP, 15) 1644 l += bthrift.Binary.MapBeginLength(thrift.STRING, thrift.STRUCT, len(p.MapStringSimple)) 1645 for k, v := range p.MapStringSimple { 1646 1647 l += bthrift.Binary.StringLength(k) 1648 1649 l += v.BLength() 1650 } 1651 l += bthrift.Binary.MapEndLength() 1652 l += bthrift.Binary.FieldEndLength() 1653 return l 1654 } 1655 1656 func (p *PartialNesting) FastRead(buf []byte) (int, error) { 1657 var err error 1658 var offset int 1659 var l int 1660 var fieldTypeId thrift.TType 1661 var fieldId int16 1662 _, l, err = bthrift.Binary.ReadStructBegin(buf) 1663 offset += l 1664 if err != nil { 1665 goto ReadStructBeginError 1666 } 1667 1668 for { 1669 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 1670 offset += l 1671 if err != nil { 1672 goto ReadFieldBeginError 1673 } 1674 if fieldTypeId == thrift.STOP { 1675 break 1676 } 1677 switch fieldId { 1678 case 2: 1679 if fieldTypeId == thrift.LIST { 1680 l, err = p.FastReadField2(buf[offset:]) 1681 offset += l 1682 if err != nil { 1683 goto ReadFieldError 1684 } 1685 } else { 1686 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 1687 offset += l 1688 if err != nil { 1689 goto SkipFieldError 1690 } 1691 } 1692 case 8: 1693 if fieldTypeId == thrift.STRUCT { 1694 l, err = p.FastReadField8(buf[offset:]) 1695 offset += l 1696 if err != nil { 1697 goto ReadFieldError 1698 } 1699 } else { 1700 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 1701 offset += l 1702 if err != nil { 1703 goto SkipFieldError 1704 } 1705 } 1706 case 15: 1707 if fieldTypeId == thrift.MAP { 1708 l, err = p.FastReadField15(buf[offset:]) 1709 offset += l 1710 if err != nil { 1711 goto ReadFieldError 1712 } 1713 } else { 1714 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 1715 offset += l 1716 if err != nil { 1717 goto SkipFieldError 1718 } 1719 } 1720 default: 1721 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 1722 offset += l 1723 if err != nil { 1724 goto SkipFieldError 1725 } 1726 } 1727 1728 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 1729 offset += l 1730 if err != nil { 1731 goto ReadFieldEndError 1732 } 1733 } 1734 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 1735 offset += l 1736 if err != nil { 1737 goto ReadStructEndError 1738 } 1739 1740 return offset, nil 1741 ReadStructBeginError: 1742 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 1743 ReadFieldBeginError: 1744 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 1745 ReadFieldError: 1746 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PartialNesting[fieldId]), err) 1747 SkipFieldError: 1748 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 1749 ReadFieldEndError: 1750 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 1751 ReadStructEndError: 1752 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1753 } 1754 1755 func (p *PartialNesting) FastReadField2(buf []byte) (int, error) { 1756 offset := 0 1757 1758 _, size, l, err := bthrift.Binary.ReadListBegin(buf[offset:]) 1759 offset += l 1760 if err != nil { 1761 return offset, err 1762 } 1763 p.ListSimple = make([]*PartialSimple, 0, size) 1764 for i := 0; i < size; i++ { 1765 _elem := NewPartialSimple() 1766 if l, err := _elem.FastRead(buf[offset:]); err != nil { 1767 return offset, err 1768 } else { 1769 offset += l 1770 } 1771 1772 p.ListSimple = append(p.ListSimple, _elem) 1773 } 1774 if l, err := bthrift.Binary.ReadListEnd(buf[offset:]); err != nil { 1775 return offset, err 1776 } else { 1777 offset += l 1778 } 1779 return offset, nil 1780 } 1781 1782 func (p *PartialNesting) FastReadField8(buf []byte) (int, error) { 1783 offset := 0 1784 p.SimpleStruct = NewPartialSimple() 1785 if l, err := p.SimpleStruct.FastRead(buf[offset:]); err != nil { 1786 return offset, err 1787 } else { 1788 offset += l 1789 } 1790 return offset, nil 1791 } 1792 1793 func (p *PartialNesting) FastReadField15(buf []byte) (int, error) { 1794 offset := 0 1795 1796 _, _, size, l, err := bthrift.Binary.ReadMapBegin(buf[offset:]) 1797 offset += l 1798 if err != nil { 1799 return offset, err 1800 } 1801 p.MapStringSimple = make(map[string]*PartialSimple, size) 1802 for i := 0; i < size; i++ { 1803 var _key string 1804 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { 1805 return offset, err 1806 } else { 1807 offset += l 1808 1809 _key = v 1810 1811 } 1812 _val := NewPartialSimple() 1813 if l, err := _val.FastRead(buf[offset:]); err != nil { 1814 return offset, err 1815 } else { 1816 offset += l 1817 } 1818 1819 p.MapStringSimple[_key] = _val 1820 } 1821 if l, err := bthrift.Binary.ReadMapEnd(buf[offset:]); err != nil { 1822 return offset, err 1823 } else { 1824 offset += l 1825 } 1826 return offset, nil 1827 } 1828 1829 // for compatibility 1830 func (p *PartialNesting) FastWrite(buf []byte) int { 1831 return 0 1832 } 1833 1834 func (p *PartialNesting) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1835 offset := 0 1836 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "PartialNesting") 1837 if p != nil { 1838 offset += p.fastWriteField2(buf[offset:], binaryWriter) 1839 offset += p.fastWriteField8(buf[offset:], binaryWriter) 1840 offset += p.fastWriteField15(buf[offset:], binaryWriter) 1841 } 1842 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 1843 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 1844 return offset 1845 } 1846 1847 func (p *PartialNesting) BLength() int { 1848 l := 0 1849 l += bthrift.Binary.StructBeginLength("PartialNesting") 1850 if p != nil { 1851 l += p.field2Length() 1852 l += p.field8Length() 1853 l += p.field15Length() 1854 } 1855 l += bthrift.Binary.FieldStopLength() 1856 l += bthrift.Binary.StructEndLength() 1857 return l 1858 } 1859 1860 func (p *PartialNesting) fastWriteField2(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1861 offset := 0 1862 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "ListSimple", thrift.LIST, 2) 1863 offset += bthrift.Binary.WriteListBegin(buf[offset:], thrift.STRUCT, len(p.ListSimple)) 1864 for _, v := range p.ListSimple { 1865 offset += v.FastWriteNocopy(buf[offset:], binaryWriter) 1866 } 1867 offset += bthrift.Binary.WriteListEnd(buf[offset:]) 1868 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1869 return offset 1870 } 1871 1872 func (p *PartialNesting) fastWriteField8(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1873 offset := 0 1874 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "SimpleStruct", thrift.STRUCT, 8) 1875 offset += p.SimpleStruct.FastWriteNocopy(buf[offset:], binaryWriter) 1876 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1877 return offset 1878 } 1879 1880 func (p *PartialNesting) fastWriteField15(buf []byte, binaryWriter bthrift.BinaryWriter) int { 1881 offset := 0 1882 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "MapStringSimple", thrift.MAP, 15) 1883 offset += bthrift.Binary.WriteMapBegin(buf[offset:], thrift.STRING, thrift.STRUCT, len(p.MapStringSimple)) 1884 for k, v := range p.MapStringSimple { 1885 1886 offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, k) 1887 1888 offset += v.FastWriteNocopy(buf[offset:], binaryWriter) 1889 } 1890 offset += bthrift.Binary.WriteMapEnd(buf[offset:]) 1891 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 1892 return offset 1893 } 1894 1895 func (p *PartialNesting) field2Length() int { 1896 l := 0 1897 l += bthrift.Binary.FieldBeginLength("ListSimple", thrift.LIST, 2) 1898 l += bthrift.Binary.ListBeginLength(thrift.STRUCT, len(p.ListSimple)) 1899 for _, v := range p.ListSimple { 1900 l += v.BLength() 1901 } 1902 l += bthrift.Binary.ListEndLength() 1903 l += bthrift.Binary.FieldEndLength() 1904 return l 1905 } 1906 1907 func (p *PartialNesting) field8Length() int { 1908 l := 0 1909 l += bthrift.Binary.FieldBeginLength("SimpleStruct", thrift.STRUCT, 8) 1910 l += p.SimpleStruct.BLength() 1911 l += bthrift.Binary.FieldEndLength() 1912 return l 1913 } 1914 1915 func (p *PartialNesting) field15Length() int { 1916 l := 0 1917 l += bthrift.Binary.FieldBeginLength("MapStringSimple", thrift.MAP, 15) 1918 l += bthrift.Binary.MapBeginLength(thrift.STRING, thrift.STRUCT, len(p.MapStringSimple)) 1919 for k, v := range p.MapStringSimple { 1920 1921 l += bthrift.Binary.StringLength(k) 1922 1923 l += v.BLength() 1924 } 1925 l += bthrift.Binary.MapEndLength() 1926 l += bthrift.Binary.FieldEndLength() 1927 return l 1928 } 1929 1930 func (p *Nesting2) FastRead(buf []byte) (int, error) { 1931 var err error 1932 var offset int 1933 var l int 1934 var fieldTypeId thrift.TType 1935 var fieldId int16 1936 _, l, err = bthrift.Binary.ReadStructBegin(buf) 1937 offset += l 1938 if err != nil { 1939 goto ReadStructBeginError 1940 } 1941 1942 for { 1943 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 1944 offset += l 1945 if err != nil { 1946 goto ReadFieldBeginError 1947 } 1948 if fieldTypeId == thrift.STOP { 1949 break 1950 } 1951 switch fieldId { 1952 case 1: 1953 if fieldTypeId == thrift.MAP { 1954 l, err = p.FastReadField1(buf[offset:]) 1955 offset += l 1956 if err != nil { 1957 goto ReadFieldError 1958 } 1959 } else { 1960 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 1961 offset += l 1962 if err != nil { 1963 goto SkipFieldError 1964 } 1965 } 1966 case 2: 1967 if fieldTypeId == thrift.STRUCT { 1968 l, err = p.FastReadField2(buf[offset:]) 1969 offset += l 1970 if err != nil { 1971 goto ReadFieldError 1972 } 1973 } else { 1974 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 1975 offset += l 1976 if err != nil { 1977 goto SkipFieldError 1978 } 1979 } 1980 case 3: 1981 if fieldTypeId == thrift.BYTE { 1982 l, err = p.FastReadField3(buf[offset:]) 1983 offset += l 1984 if err != nil { 1985 goto ReadFieldError 1986 } 1987 } else { 1988 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 1989 offset += l 1990 if err != nil { 1991 goto SkipFieldError 1992 } 1993 } 1994 case 4: 1995 if fieldTypeId == thrift.DOUBLE { 1996 l, err = p.FastReadField4(buf[offset:]) 1997 offset += l 1998 if err != nil { 1999 goto ReadFieldError 2000 } 2001 } else { 2002 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2003 offset += l 2004 if err != nil { 2005 goto SkipFieldError 2006 } 2007 } 2008 case 5: 2009 if fieldTypeId == thrift.LIST { 2010 l, err = p.FastReadField5(buf[offset:]) 2011 offset += l 2012 if err != nil { 2013 goto ReadFieldError 2014 } 2015 } else { 2016 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2017 offset += l 2018 if err != nil { 2019 goto SkipFieldError 2020 } 2021 } 2022 case 6: 2023 if fieldTypeId == thrift.I64 { 2024 l, err = p.FastReadField6(buf[offset:]) 2025 offset += l 2026 if err != nil { 2027 goto ReadFieldError 2028 } 2029 } else { 2030 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2031 offset += l 2032 if err != nil { 2033 goto SkipFieldError 2034 } 2035 } 2036 case 7: 2037 if fieldTypeId == thrift.STRUCT { 2038 l, err = p.FastReadField7(buf[offset:]) 2039 offset += l 2040 if err != nil { 2041 goto ReadFieldError 2042 } 2043 } else { 2044 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2045 offset += l 2046 if err != nil { 2047 goto SkipFieldError 2048 } 2049 } 2050 case 8: 2051 if fieldTypeId == thrift.STRING { 2052 l, err = p.FastReadField8(buf[offset:]) 2053 offset += l 2054 if err != nil { 2055 goto ReadFieldError 2056 } 2057 } else { 2058 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2059 offset += l 2060 if err != nil { 2061 goto SkipFieldError 2062 } 2063 } 2064 case 9: 2065 if fieldTypeId == thrift.STRING { 2066 l, err = p.FastReadField9(buf[offset:]) 2067 offset += l 2068 if err != nil { 2069 goto ReadFieldError 2070 } 2071 } else { 2072 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2073 offset += l 2074 if err != nil { 2075 goto SkipFieldError 2076 } 2077 } 2078 case 10: 2079 if fieldTypeId == thrift.SET { 2080 l, err = p.FastReadField10(buf[offset:]) 2081 offset += l 2082 if err != nil { 2083 goto ReadFieldError 2084 } 2085 } else { 2086 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2087 offset += l 2088 if err != nil { 2089 goto SkipFieldError 2090 } 2091 } 2092 case 11: 2093 if fieldTypeId == thrift.I32 { 2094 l, err = p.FastReadField11(buf[offset:]) 2095 offset += l 2096 if err != nil { 2097 goto ReadFieldError 2098 } 2099 } else { 2100 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2101 offset += l 2102 if err != nil { 2103 goto SkipFieldError 2104 } 2105 } 2106 default: 2107 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2108 offset += l 2109 if err != nil { 2110 goto SkipFieldError 2111 } 2112 } 2113 2114 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 2115 offset += l 2116 if err != nil { 2117 goto ReadFieldEndError 2118 } 2119 } 2120 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 2121 offset += l 2122 if err != nil { 2123 goto ReadStructEndError 2124 } 2125 2126 return offset, nil 2127 ReadStructBeginError: 2128 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 2129 ReadFieldBeginError: 2130 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 2131 ReadFieldError: 2132 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Nesting2[fieldId]), err) 2133 SkipFieldError: 2134 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 2135 ReadFieldEndError: 2136 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 2137 ReadStructEndError: 2138 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2139 } 2140 2141 func (p *Nesting2) FastReadField1(buf []byte) (int, error) { 2142 offset := 0 2143 2144 _, _, size, l, err := bthrift.Binary.ReadMapBegin(buf[offset:]) 2145 offset += l 2146 if err != nil { 2147 return offset, err 2148 } 2149 p.MapSimpleNesting = make(map[*Simple]*Nesting, size) 2150 for i := 0; i < size; i++ { 2151 _key := NewSimple() 2152 if l, err := _key.FastRead(buf[offset:]); err != nil { 2153 return offset, err 2154 } else { 2155 offset += l 2156 } 2157 _val := NewNesting() 2158 if l, err := _val.FastRead(buf[offset:]); err != nil { 2159 return offset, err 2160 } else { 2161 offset += l 2162 } 2163 2164 p.MapSimpleNesting[_key] = _val 2165 } 2166 if l, err := bthrift.Binary.ReadMapEnd(buf[offset:]); err != nil { 2167 return offset, err 2168 } else { 2169 offset += l 2170 } 2171 return offset, nil 2172 } 2173 2174 func (p *Nesting2) FastReadField2(buf []byte) (int, error) { 2175 offset := 0 2176 p.SimpleStruct = NewSimple() 2177 if l, err := p.SimpleStruct.FastRead(buf[offset:]); err != nil { 2178 return offset, err 2179 } else { 2180 offset += l 2181 } 2182 return offset, nil 2183 } 2184 2185 func (p *Nesting2) FastReadField3(buf []byte) (int, error) { 2186 offset := 0 2187 2188 if v, l, err := bthrift.Binary.ReadByte(buf[offset:]); err != nil { 2189 return offset, err 2190 } else { 2191 offset += l 2192 2193 p.Byte = v 2194 2195 } 2196 return offset, nil 2197 } 2198 2199 func (p *Nesting2) FastReadField4(buf []byte) (int, error) { 2200 offset := 0 2201 2202 if v, l, err := bthrift.Binary.ReadDouble(buf[offset:]); err != nil { 2203 return offset, err 2204 } else { 2205 offset += l 2206 2207 p.Double = v 2208 2209 } 2210 return offset, nil 2211 } 2212 2213 func (p *Nesting2) FastReadField5(buf []byte) (int, error) { 2214 offset := 0 2215 2216 _, size, l, err := bthrift.Binary.ReadListBegin(buf[offset:]) 2217 offset += l 2218 if err != nil { 2219 return offset, err 2220 } 2221 p.ListNesting = make([]*Nesting, 0, size) 2222 for i := 0; i < size; i++ { 2223 _elem := NewNesting() 2224 if l, err := _elem.FastRead(buf[offset:]); err != nil { 2225 return offset, err 2226 } else { 2227 offset += l 2228 } 2229 2230 p.ListNesting = append(p.ListNesting, _elem) 2231 } 2232 if l, err := bthrift.Binary.ReadListEnd(buf[offset:]); err != nil { 2233 return offset, err 2234 } else { 2235 offset += l 2236 } 2237 return offset, nil 2238 } 2239 2240 func (p *Nesting2) FastReadField6(buf []byte) (int, error) { 2241 offset := 0 2242 2243 if v, l, err := bthrift.Binary.ReadI64(buf[offset:]); err != nil { 2244 return offset, err 2245 } else { 2246 offset += l 2247 2248 p.I64 = v 2249 2250 } 2251 return offset, nil 2252 } 2253 2254 func (p *Nesting2) FastReadField7(buf []byte) (int, error) { 2255 offset := 0 2256 p.NestingStruct = NewNesting() 2257 if l, err := p.NestingStruct.FastRead(buf[offset:]); err != nil { 2258 return offset, err 2259 } else { 2260 offset += l 2261 } 2262 return offset, nil 2263 } 2264 2265 func (p *Nesting2) FastReadField8(buf []byte) (int, error) { 2266 offset := 0 2267 2268 if v, l, err := bthrift.Binary.ReadBinary(buf[offset:]); err != nil { 2269 return offset, err 2270 } else { 2271 offset += l 2272 2273 p.Binary = []byte(v) 2274 2275 } 2276 return offset, nil 2277 } 2278 2279 func (p *Nesting2) FastReadField9(buf []byte) (int, error) { 2280 offset := 0 2281 2282 if v, l, err := bthrift.Binary.ReadString(buf[offset:]); err != nil { 2283 return offset, err 2284 } else { 2285 offset += l 2286 2287 p.String_ = v 2288 2289 } 2290 return offset, nil 2291 } 2292 2293 func (p *Nesting2) FastReadField10(buf []byte) (int, error) { 2294 offset := 0 2295 2296 _, size, l, err := bthrift.Binary.ReadSetBegin(buf[offset:]) 2297 offset += l 2298 if err != nil { 2299 return offset, err 2300 } 2301 p.SetNesting = make([]*Nesting, 0, size) 2302 for i := 0; i < size; i++ { 2303 _elem := NewNesting() 2304 if l, err := _elem.FastRead(buf[offset:]); err != nil { 2305 return offset, err 2306 } else { 2307 offset += l 2308 } 2309 2310 p.SetNesting = append(p.SetNesting, _elem) 2311 } 2312 if l, err := bthrift.Binary.ReadSetEnd(buf[offset:]); err != nil { 2313 return offset, err 2314 } else { 2315 offset += l 2316 } 2317 return offset, nil 2318 } 2319 2320 func (p *Nesting2) FastReadField11(buf []byte) (int, error) { 2321 offset := 0 2322 2323 if v, l, err := bthrift.Binary.ReadI32(buf[offset:]); err != nil { 2324 return offset, err 2325 } else { 2326 offset += l 2327 2328 p.I32 = v 2329 2330 } 2331 return offset, nil 2332 } 2333 2334 // for compatibility 2335 func (p *Nesting2) FastWrite(buf []byte) int { 2336 return 0 2337 } 2338 2339 func (p *Nesting2) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2340 offset := 0 2341 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "Nesting2") 2342 if p != nil { 2343 offset += p.fastWriteField3(buf[offset:], binaryWriter) 2344 offset += p.fastWriteField4(buf[offset:], binaryWriter) 2345 offset += p.fastWriteField6(buf[offset:], binaryWriter) 2346 offset += p.fastWriteField11(buf[offset:], binaryWriter) 2347 offset += p.fastWriteField1(buf[offset:], binaryWriter) 2348 offset += p.fastWriteField2(buf[offset:], binaryWriter) 2349 offset += p.fastWriteField5(buf[offset:], binaryWriter) 2350 offset += p.fastWriteField7(buf[offset:], binaryWriter) 2351 offset += p.fastWriteField8(buf[offset:], binaryWriter) 2352 offset += p.fastWriteField9(buf[offset:], binaryWriter) 2353 offset += p.fastWriteField10(buf[offset:], binaryWriter) 2354 } 2355 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 2356 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 2357 return offset 2358 } 2359 2360 func (p *Nesting2) BLength() int { 2361 l := 0 2362 l += bthrift.Binary.StructBeginLength("Nesting2") 2363 if p != nil { 2364 l += p.field1Length() 2365 l += p.field2Length() 2366 l += p.field3Length() 2367 l += p.field4Length() 2368 l += p.field5Length() 2369 l += p.field6Length() 2370 l += p.field7Length() 2371 l += p.field8Length() 2372 l += p.field9Length() 2373 l += p.field10Length() 2374 l += p.field11Length() 2375 } 2376 l += bthrift.Binary.FieldStopLength() 2377 l += bthrift.Binary.StructEndLength() 2378 return l 2379 } 2380 2381 func (p *Nesting2) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2382 offset := 0 2383 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "MapSimpleNesting", thrift.MAP, 1) 2384 offset += bthrift.Binary.WriteMapBegin(buf[offset:], thrift.STRUCT, thrift.STRUCT, len(p.MapSimpleNesting)) 2385 for k, v := range p.MapSimpleNesting { 2386 2387 offset += k.FastWriteNocopy(buf[offset:], binaryWriter) 2388 2389 offset += v.FastWriteNocopy(buf[offset:], binaryWriter) 2390 } 2391 offset += bthrift.Binary.WriteMapEnd(buf[offset:]) 2392 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2393 return offset 2394 } 2395 2396 func (p *Nesting2) fastWriteField2(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2397 offset := 0 2398 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "SimpleStruct", thrift.STRUCT, 2) 2399 offset += p.SimpleStruct.FastWriteNocopy(buf[offset:], binaryWriter) 2400 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2401 return offset 2402 } 2403 2404 func (p *Nesting2) fastWriteField3(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2405 offset := 0 2406 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "Byte", thrift.BYTE, 3) 2407 offset += bthrift.Binary.WriteByte(buf[offset:], p.Byte) 2408 2409 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2410 return offset 2411 } 2412 2413 func (p *Nesting2) fastWriteField4(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2414 offset := 0 2415 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "Double", thrift.DOUBLE, 4) 2416 offset += bthrift.Binary.WriteDouble(buf[offset:], p.Double) 2417 2418 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2419 return offset 2420 } 2421 2422 func (p *Nesting2) fastWriteField5(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2423 offset := 0 2424 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "ListNesting", thrift.LIST, 5) 2425 offset += bthrift.Binary.WriteListBegin(buf[offset:], thrift.STRUCT, len(p.ListNesting)) 2426 for _, v := range p.ListNesting { 2427 offset += v.FastWriteNocopy(buf[offset:], binaryWriter) 2428 } 2429 offset += bthrift.Binary.WriteListEnd(buf[offset:]) 2430 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2431 return offset 2432 } 2433 2434 func (p *Nesting2) fastWriteField6(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2435 offset := 0 2436 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "I64", thrift.I64, 6) 2437 offset += bthrift.Binary.WriteI64(buf[offset:], p.I64) 2438 2439 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2440 return offset 2441 } 2442 2443 func (p *Nesting2) fastWriteField7(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2444 offset := 0 2445 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "NestingStruct", thrift.STRUCT, 7) 2446 offset += p.NestingStruct.FastWriteNocopy(buf[offset:], binaryWriter) 2447 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2448 return offset 2449 } 2450 2451 func (p *Nesting2) fastWriteField8(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2452 offset := 0 2453 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "Binary", thrift.STRING, 8) 2454 offset += bthrift.Binary.WriteBinaryNocopy(buf[offset:], binaryWriter, []byte(p.Binary)) 2455 2456 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2457 return offset 2458 } 2459 2460 func (p *Nesting2) fastWriteField9(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2461 offset := 0 2462 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "String", thrift.STRING, 9) 2463 offset += bthrift.Binary.WriteStringNocopy(buf[offset:], binaryWriter, p.String_) 2464 2465 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2466 return offset 2467 } 2468 2469 func (p *Nesting2) fastWriteField10(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2470 offset := 0 2471 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "SetNesting", thrift.SET, 10) 2472 offset += bthrift.Binary.WriteSetBegin(buf[offset:], thrift.STRUCT, len(p.SetNesting)) 2473 2474 for i := 0; i < len(p.SetNesting); i++ { 2475 for j := i + 1; j < len(p.SetNesting); j++ { 2476 if func(tgt, src *Nesting) bool { 2477 if !tgt.DeepEqual(src) { 2478 return false 2479 } 2480 return true 2481 }(p.SetNesting[i], p.SetNesting[j]) { 2482 panic(fmt.Errorf("%T error writing set field: slice is not unique", p.SetNesting[i])) 2483 } 2484 } 2485 } 2486 for _, v := range p.SetNesting { 2487 offset += v.FastWriteNocopy(buf[offset:], binaryWriter) 2488 } 2489 offset += bthrift.Binary.WriteSetEnd(buf[offset:]) 2490 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2491 return offset 2492 } 2493 2494 func (p *Nesting2) fastWriteField11(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2495 offset := 0 2496 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "I32", thrift.I32, 11) 2497 offset += bthrift.Binary.WriteI32(buf[offset:], p.I32) 2498 2499 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2500 return offset 2501 } 2502 2503 func (p *Nesting2) field1Length() int { 2504 l := 0 2505 l += bthrift.Binary.FieldBeginLength("MapSimpleNesting", thrift.MAP, 1) 2506 l += bthrift.Binary.MapBeginLength(thrift.STRUCT, thrift.STRUCT, len(p.MapSimpleNesting)) 2507 for k, v := range p.MapSimpleNesting { 2508 2509 l += k.BLength() 2510 2511 l += v.BLength() 2512 } 2513 l += bthrift.Binary.MapEndLength() 2514 l += bthrift.Binary.FieldEndLength() 2515 return l 2516 } 2517 2518 func (p *Nesting2) field2Length() int { 2519 l := 0 2520 l += bthrift.Binary.FieldBeginLength("SimpleStruct", thrift.STRUCT, 2) 2521 l += p.SimpleStruct.BLength() 2522 l += bthrift.Binary.FieldEndLength() 2523 return l 2524 } 2525 2526 func (p *Nesting2) field3Length() int { 2527 l := 0 2528 l += bthrift.Binary.FieldBeginLength("Byte", thrift.BYTE, 3) 2529 l += bthrift.Binary.ByteLength(p.Byte) 2530 2531 l += bthrift.Binary.FieldEndLength() 2532 return l 2533 } 2534 2535 func (p *Nesting2) field4Length() int { 2536 l := 0 2537 l += bthrift.Binary.FieldBeginLength("Double", thrift.DOUBLE, 4) 2538 l += bthrift.Binary.DoubleLength(p.Double) 2539 2540 l += bthrift.Binary.FieldEndLength() 2541 return l 2542 } 2543 2544 func (p *Nesting2) field5Length() int { 2545 l := 0 2546 l += bthrift.Binary.FieldBeginLength("ListNesting", thrift.LIST, 5) 2547 l += bthrift.Binary.ListBeginLength(thrift.STRUCT, len(p.ListNesting)) 2548 for _, v := range p.ListNesting { 2549 l += v.BLength() 2550 } 2551 l += bthrift.Binary.ListEndLength() 2552 l += bthrift.Binary.FieldEndLength() 2553 return l 2554 } 2555 2556 func (p *Nesting2) field6Length() int { 2557 l := 0 2558 l += bthrift.Binary.FieldBeginLength("I64", thrift.I64, 6) 2559 l += bthrift.Binary.I64Length(p.I64) 2560 2561 l += bthrift.Binary.FieldEndLength() 2562 return l 2563 } 2564 2565 func (p *Nesting2) field7Length() int { 2566 l := 0 2567 l += bthrift.Binary.FieldBeginLength("NestingStruct", thrift.STRUCT, 7) 2568 l += p.NestingStruct.BLength() 2569 l += bthrift.Binary.FieldEndLength() 2570 return l 2571 } 2572 2573 func (p *Nesting2) field8Length() int { 2574 l := 0 2575 l += bthrift.Binary.FieldBeginLength("Binary", thrift.STRING, 8) 2576 l += bthrift.Binary.BinaryLengthNocopy([]byte(p.Binary)) 2577 2578 l += bthrift.Binary.FieldEndLength() 2579 return l 2580 } 2581 2582 func (p *Nesting2) field9Length() int { 2583 l := 0 2584 l += bthrift.Binary.FieldBeginLength("String", thrift.STRING, 9) 2585 l += bthrift.Binary.StringLength(p.String_) 2586 2587 l += bthrift.Binary.FieldEndLength() 2588 return l 2589 } 2590 2591 func (p *Nesting2) field10Length() int { 2592 l := 0 2593 l += bthrift.Binary.FieldBeginLength("SetNesting", thrift.SET, 10) 2594 l += bthrift.Binary.SetBeginLength(thrift.STRUCT, len(p.SetNesting)) 2595 2596 for i := 0; i < len(p.SetNesting); i++ { 2597 for j := i + 1; j < len(p.SetNesting); j++ { 2598 if func(tgt, src *Nesting) bool { 2599 if !tgt.DeepEqual(src) { 2600 return false 2601 } 2602 return true 2603 }(p.SetNesting[i], p.SetNesting[j]) { 2604 panic(fmt.Errorf("%T error writing set field: slice is not unique", p.SetNesting[i])) 2605 } 2606 } 2607 } 2608 for _, v := range p.SetNesting { 2609 l += v.BLength() 2610 } 2611 l += bthrift.Binary.SetEndLength() 2612 l += bthrift.Binary.FieldEndLength() 2613 return l 2614 } 2615 2616 func (p *Nesting2) field11Length() int { 2617 l := 0 2618 l += bthrift.Binary.FieldBeginLength("I32", thrift.I32, 11) 2619 l += bthrift.Binary.I32Length(p.I32) 2620 2621 l += bthrift.Binary.FieldEndLength() 2622 return l 2623 } 2624 2625 func (p *BaselineServiceSimpleMethodArgs) FastRead(buf []byte) (int, error) { 2626 var err error 2627 var offset int 2628 var l int 2629 var fieldTypeId thrift.TType 2630 var fieldId int16 2631 _, l, err = bthrift.Binary.ReadStructBegin(buf) 2632 offset += l 2633 if err != nil { 2634 goto ReadStructBeginError 2635 } 2636 2637 for { 2638 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 2639 offset += l 2640 if err != nil { 2641 goto ReadFieldBeginError 2642 } 2643 if fieldTypeId == thrift.STOP { 2644 break 2645 } 2646 switch fieldId { 2647 case 1: 2648 if fieldTypeId == thrift.STRUCT { 2649 l, err = p.FastReadField1(buf[offset:]) 2650 offset += l 2651 if err != nil { 2652 goto ReadFieldError 2653 } 2654 } else { 2655 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2656 offset += l 2657 if err != nil { 2658 goto SkipFieldError 2659 } 2660 } 2661 default: 2662 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2663 offset += l 2664 if err != nil { 2665 goto SkipFieldError 2666 } 2667 } 2668 2669 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 2670 offset += l 2671 if err != nil { 2672 goto ReadFieldEndError 2673 } 2674 } 2675 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 2676 offset += l 2677 if err != nil { 2678 goto ReadStructEndError 2679 } 2680 2681 return offset, nil 2682 ReadStructBeginError: 2683 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 2684 ReadFieldBeginError: 2685 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 2686 ReadFieldError: 2687 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceSimpleMethodArgs[fieldId]), err) 2688 SkipFieldError: 2689 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 2690 ReadFieldEndError: 2691 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 2692 ReadStructEndError: 2693 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2694 } 2695 2696 func (p *BaselineServiceSimpleMethodArgs) FastReadField1(buf []byte) (int, error) { 2697 offset := 0 2698 p.Req = NewSimple() 2699 if l, err := p.Req.FastRead(buf[offset:]); err != nil { 2700 return offset, err 2701 } else { 2702 offset += l 2703 } 2704 return offset, nil 2705 } 2706 2707 // for compatibility 2708 func (p *BaselineServiceSimpleMethodArgs) FastWrite(buf []byte) int { 2709 return 0 2710 } 2711 2712 func (p *BaselineServiceSimpleMethodArgs) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2713 offset := 0 2714 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "SimpleMethod_args") 2715 if p != nil { 2716 offset += p.fastWriteField1(buf[offset:], binaryWriter) 2717 } 2718 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 2719 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 2720 return offset 2721 } 2722 2723 func (p *BaselineServiceSimpleMethodArgs) BLength() int { 2724 l := 0 2725 l += bthrift.Binary.StructBeginLength("SimpleMethod_args") 2726 if p != nil { 2727 l += p.field1Length() 2728 } 2729 l += bthrift.Binary.FieldStopLength() 2730 l += bthrift.Binary.StructEndLength() 2731 return l 2732 } 2733 2734 func (p *BaselineServiceSimpleMethodArgs) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2735 offset := 0 2736 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "req", thrift.STRUCT, 1) 2737 offset += p.Req.FastWriteNocopy(buf[offset:], binaryWriter) 2738 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2739 return offset 2740 } 2741 2742 func (p *BaselineServiceSimpleMethodArgs) field1Length() int { 2743 l := 0 2744 l += bthrift.Binary.FieldBeginLength("req", thrift.STRUCT, 1) 2745 l += p.Req.BLength() 2746 l += bthrift.Binary.FieldEndLength() 2747 return l 2748 } 2749 2750 func (p *BaselineServiceSimpleMethodResult) FastRead(buf []byte) (int, error) { 2751 var err error 2752 var offset int 2753 var l int 2754 var fieldTypeId thrift.TType 2755 var fieldId int16 2756 _, l, err = bthrift.Binary.ReadStructBegin(buf) 2757 offset += l 2758 if err != nil { 2759 goto ReadStructBeginError 2760 } 2761 2762 for { 2763 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 2764 offset += l 2765 if err != nil { 2766 goto ReadFieldBeginError 2767 } 2768 if fieldTypeId == thrift.STOP { 2769 break 2770 } 2771 switch fieldId { 2772 case 0: 2773 if fieldTypeId == thrift.STRUCT { 2774 l, err = p.FastReadField0(buf[offset:]) 2775 offset += l 2776 if err != nil { 2777 goto ReadFieldError 2778 } 2779 } else { 2780 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2781 offset += l 2782 if err != nil { 2783 goto SkipFieldError 2784 } 2785 } 2786 default: 2787 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2788 offset += l 2789 if err != nil { 2790 goto SkipFieldError 2791 } 2792 } 2793 2794 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 2795 offset += l 2796 if err != nil { 2797 goto ReadFieldEndError 2798 } 2799 } 2800 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 2801 offset += l 2802 if err != nil { 2803 goto ReadStructEndError 2804 } 2805 2806 return offset, nil 2807 ReadStructBeginError: 2808 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 2809 ReadFieldBeginError: 2810 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 2811 ReadFieldError: 2812 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceSimpleMethodResult[fieldId]), err) 2813 SkipFieldError: 2814 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 2815 ReadFieldEndError: 2816 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 2817 ReadStructEndError: 2818 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2819 } 2820 2821 func (p *BaselineServiceSimpleMethodResult) FastReadField0(buf []byte) (int, error) { 2822 offset := 0 2823 p.Success = NewSimple() 2824 if l, err := p.Success.FastRead(buf[offset:]); err != nil { 2825 return offset, err 2826 } else { 2827 offset += l 2828 } 2829 return offset, nil 2830 } 2831 2832 // for compatibility 2833 func (p *BaselineServiceSimpleMethodResult) FastWrite(buf []byte) int { 2834 return 0 2835 } 2836 2837 func (p *BaselineServiceSimpleMethodResult) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2838 offset := 0 2839 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "SimpleMethod_result") 2840 if p != nil { 2841 offset += p.fastWriteField0(buf[offset:], binaryWriter) 2842 } 2843 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 2844 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 2845 return offset 2846 } 2847 2848 func (p *BaselineServiceSimpleMethodResult) BLength() int { 2849 l := 0 2850 l += bthrift.Binary.StructBeginLength("SimpleMethod_result") 2851 if p != nil { 2852 l += p.field0Length() 2853 } 2854 l += bthrift.Binary.FieldStopLength() 2855 l += bthrift.Binary.StructEndLength() 2856 return l 2857 } 2858 2859 func (p *BaselineServiceSimpleMethodResult) fastWriteField0(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2860 offset := 0 2861 if p.IsSetSuccess() { 2862 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "success", thrift.STRUCT, 0) 2863 offset += p.Success.FastWriteNocopy(buf[offset:], binaryWriter) 2864 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2865 } 2866 return offset 2867 } 2868 2869 func (p *BaselineServiceSimpleMethodResult) field0Length() int { 2870 l := 0 2871 if p.IsSetSuccess() { 2872 l += bthrift.Binary.FieldBeginLength("success", thrift.STRUCT, 0) 2873 l += p.Success.BLength() 2874 l += bthrift.Binary.FieldEndLength() 2875 } 2876 return l 2877 } 2878 2879 func (p *BaselineServicePartialSimpleMethodArgs) FastRead(buf []byte) (int, error) { 2880 var err error 2881 var offset int 2882 var l int 2883 var fieldTypeId thrift.TType 2884 var fieldId int16 2885 _, l, err = bthrift.Binary.ReadStructBegin(buf) 2886 offset += l 2887 if err != nil { 2888 goto ReadStructBeginError 2889 } 2890 2891 for { 2892 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 2893 offset += l 2894 if err != nil { 2895 goto ReadFieldBeginError 2896 } 2897 if fieldTypeId == thrift.STOP { 2898 break 2899 } 2900 switch fieldId { 2901 case 1: 2902 if fieldTypeId == thrift.STRUCT { 2903 l, err = p.FastReadField1(buf[offset:]) 2904 offset += l 2905 if err != nil { 2906 goto ReadFieldError 2907 } 2908 } else { 2909 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2910 offset += l 2911 if err != nil { 2912 goto SkipFieldError 2913 } 2914 } 2915 default: 2916 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 2917 offset += l 2918 if err != nil { 2919 goto SkipFieldError 2920 } 2921 } 2922 2923 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 2924 offset += l 2925 if err != nil { 2926 goto ReadFieldEndError 2927 } 2928 } 2929 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 2930 offset += l 2931 if err != nil { 2932 goto ReadStructEndError 2933 } 2934 2935 return offset, nil 2936 ReadStructBeginError: 2937 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 2938 ReadFieldBeginError: 2939 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 2940 ReadFieldError: 2941 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServicePartialSimpleMethodArgs[fieldId]), err) 2942 SkipFieldError: 2943 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 2944 ReadFieldEndError: 2945 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 2946 ReadStructEndError: 2947 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2948 } 2949 2950 func (p *BaselineServicePartialSimpleMethodArgs) FastReadField1(buf []byte) (int, error) { 2951 offset := 0 2952 p.Req = NewPartialSimple() 2953 if l, err := p.Req.FastRead(buf[offset:]); err != nil { 2954 return offset, err 2955 } else { 2956 offset += l 2957 } 2958 return offset, nil 2959 } 2960 2961 // for compatibility 2962 func (p *BaselineServicePartialSimpleMethodArgs) FastWrite(buf []byte) int { 2963 return 0 2964 } 2965 2966 func (p *BaselineServicePartialSimpleMethodArgs) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2967 offset := 0 2968 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "PartialSimpleMethod_args") 2969 if p != nil { 2970 offset += p.fastWriteField1(buf[offset:], binaryWriter) 2971 } 2972 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 2973 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 2974 return offset 2975 } 2976 2977 func (p *BaselineServicePartialSimpleMethodArgs) BLength() int { 2978 l := 0 2979 l += bthrift.Binary.StructBeginLength("PartialSimpleMethod_args") 2980 if p != nil { 2981 l += p.field1Length() 2982 } 2983 l += bthrift.Binary.FieldStopLength() 2984 l += bthrift.Binary.StructEndLength() 2985 return l 2986 } 2987 2988 func (p *BaselineServicePartialSimpleMethodArgs) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { 2989 offset := 0 2990 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "req", thrift.STRUCT, 1) 2991 offset += p.Req.FastWriteNocopy(buf[offset:], binaryWriter) 2992 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 2993 return offset 2994 } 2995 2996 func (p *BaselineServicePartialSimpleMethodArgs) field1Length() int { 2997 l := 0 2998 l += bthrift.Binary.FieldBeginLength("req", thrift.STRUCT, 1) 2999 l += p.Req.BLength() 3000 l += bthrift.Binary.FieldEndLength() 3001 return l 3002 } 3003 3004 func (p *BaselineServicePartialSimpleMethodResult) FastRead(buf []byte) (int, error) { 3005 var err error 3006 var offset int 3007 var l int 3008 var fieldTypeId thrift.TType 3009 var fieldId int16 3010 _, l, err = bthrift.Binary.ReadStructBegin(buf) 3011 offset += l 3012 if err != nil { 3013 goto ReadStructBeginError 3014 } 3015 3016 for { 3017 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 3018 offset += l 3019 if err != nil { 3020 goto ReadFieldBeginError 3021 } 3022 if fieldTypeId == thrift.STOP { 3023 break 3024 } 3025 switch fieldId { 3026 case 0: 3027 if fieldTypeId == thrift.STRUCT { 3028 l, err = p.FastReadField0(buf[offset:]) 3029 offset += l 3030 if err != nil { 3031 goto ReadFieldError 3032 } 3033 } else { 3034 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3035 offset += l 3036 if err != nil { 3037 goto SkipFieldError 3038 } 3039 } 3040 default: 3041 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3042 offset += l 3043 if err != nil { 3044 goto SkipFieldError 3045 } 3046 } 3047 3048 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 3049 offset += l 3050 if err != nil { 3051 goto ReadFieldEndError 3052 } 3053 } 3054 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 3055 offset += l 3056 if err != nil { 3057 goto ReadStructEndError 3058 } 3059 3060 return offset, nil 3061 ReadStructBeginError: 3062 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3063 ReadFieldBeginError: 3064 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3065 ReadFieldError: 3066 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServicePartialSimpleMethodResult[fieldId]), err) 3067 SkipFieldError: 3068 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3069 ReadFieldEndError: 3070 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3071 ReadStructEndError: 3072 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3073 } 3074 3075 func (p *BaselineServicePartialSimpleMethodResult) FastReadField0(buf []byte) (int, error) { 3076 offset := 0 3077 p.Success = NewPartialSimple() 3078 if l, err := p.Success.FastRead(buf[offset:]); err != nil { 3079 return offset, err 3080 } else { 3081 offset += l 3082 } 3083 return offset, nil 3084 } 3085 3086 // for compatibility 3087 func (p *BaselineServicePartialSimpleMethodResult) FastWrite(buf []byte) int { 3088 return 0 3089 } 3090 3091 func (p *BaselineServicePartialSimpleMethodResult) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3092 offset := 0 3093 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "PartialSimpleMethod_result") 3094 if p != nil { 3095 offset += p.fastWriteField0(buf[offset:], binaryWriter) 3096 } 3097 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 3098 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 3099 return offset 3100 } 3101 3102 func (p *BaselineServicePartialSimpleMethodResult) BLength() int { 3103 l := 0 3104 l += bthrift.Binary.StructBeginLength("PartialSimpleMethod_result") 3105 if p != nil { 3106 l += p.field0Length() 3107 } 3108 l += bthrift.Binary.FieldStopLength() 3109 l += bthrift.Binary.StructEndLength() 3110 return l 3111 } 3112 3113 func (p *BaselineServicePartialSimpleMethodResult) fastWriteField0(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3114 offset := 0 3115 if p.IsSetSuccess() { 3116 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "success", thrift.STRUCT, 0) 3117 offset += p.Success.FastWriteNocopy(buf[offset:], binaryWriter) 3118 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 3119 } 3120 return offset 3121 } 3122 3123 func (p *BaselineServicePartialSimpleMethodResult) field0Length() int { 3124 l := 0 3125 if p.IsSetSuccess() { 3126 l += bthrift.Binary.FieldBeginLength("success", thrift.STRUCT, 0) 3127 l += p.Success.BLength() 3128 l += bthrift.Binary.FieldEndLength() 3129 } 3130 return l 3131 } 3132 3133 func (p *BaselineServiceNestingMethodArgs) FastRead(buf []byte) (int, error) { 3134 var err error 3135 var offset int 3136 var l int 3137 var fieldTypeId thrift.TType 3138 var fieldId int16 3139 _, l, err = bthrift.Binary.ReadStructBegin(buf) 3140 offset += l 3141 if err != nil { 3142 goto ReadStructBeginError 3143 } 3144 3145 for { 3146 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 3147 offset += l 3148 if err != nil { 3149 goto ReadFieldBeginError 3150 } 3151 if fieldTypeId == thrift.STOP { 3152 break 3153 } 3154 switch fieldId { 3155 case 1: 3156 if fieldTypeId == thrift.STRUCT { 3157 l, err = p.FastReadField1(buf[offset:]) 3158 offset += l 3159 if err != nil { 3160 goto ReadFieldError 3161 } 3162 } else { 3163 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3164 offset += l 3165 if err != nil { 3166 goto SkipFieldError 3167 } 3168 } 3169 default: 3170 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3171 offset += l 3172 if err != nil { 3173 goto SkipFieldError 3174 } 3175 } 3176 3177 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 3178 offset += l 3179 if err != nil { 3180 goto ReadFieldEndError 3181 } 3182 } 3183 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 3184 offset += l 3185 if err != nil { 3186 goto ReadStructEndError 3187 } 3188 3189 return offset, nil 3190 ReadStructBeginError: 3191 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3192 ReadFieldBeginError: 3193 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3194 ReadFieldError: 3195 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceNestingMethodArgs[fieldId]), err) 3196 SkipFieldError: 3197 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3198 ReadFieldEndError: 3199 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3200 ReadStructEndError: 3201 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3202 } 3203 3204 func (p *BaselineServiceNestingMethodArgs) FastReadField1(buf []byte) (int, error) { 3205 offset := 0 3206 p.Req = NewNesting() 3207 if l, err := p.Req.FastRead(buf[offset:]); err != nil { 3208 return offset, err 3209 } else { 3210 offset += l 3211 } 3212 return offset, nil 3213 } 3214 3215 // for compatibility 3216 func (p *BaselineServiceNestingMethodArgs) FastWrite(buf []byte) int { 3217 return 0 3218 } 3219 3220 func (p *BaselineServiceNestingMethodArgs) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3221 offset := 0 3222 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "NestingMethod_args") 3223 if p != nil { 3224 offset += p.fastWriteField1(buf[offset:], binaryWriter) 3225 } 3226 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 3227 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 3228 return offset 3229 } 3230 3231 func (p *BaselineServiceNestingMethodArgs) BLength() int { 3232 l := 0 3233 l += bthrift.Binary.StructBeginLength("NestingMethod_args") 3234 if p != nil { 3235 l += p.field1Length() 3236 } 3237 l += bthrift.Binary.FieldStopLength() 3238 l += bthrift.Binary.StructEndLength() 3239 return l 3240 } 3241 3242 func (p *BaselineServiceNestingMethodArgs) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3243 offset := 0 3244 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "req", thrift.STRUCT, 1) 3245 offset += p.Req.FastWriteNocopy(buf[offset:], binaryWriter) 3246 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 3247 return offset 3248 } 3249 3250 func (p *BaselineServiceNestingMethodArgs) field1Length() int { 3251 l := 0 3252 l += bthrift.Binary.FieldBeginLength("req", thrift.STRUCT, 1) 3253 l += p.Req.BLength() 3254 l += bthrift.Binary.FieldEndLength() 3255 return l 3256 } 3257 3258 func (p *BaselineServiceNestingMethodResult) FastRead(buf []byte) (int, error) { 3259 var err error 3260 var offset int 3261 var l int 3262 var fieldTypeId thrift.TType 3263 var fieldId int16 3264 _, l, err = bthrift.Binary.ReadStructBegin(buf) 3265 offset += l 3266 if err != nil { 3267 goto ReadStructBeginError 3268 } 3269 3270 for { 3271 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 3272 offset += l 3273 if err != nil { 3274 goto ReadFieldBeginError 3275 } 3276 if fieldTypeId == thrift.STOP { 3277 break 3278 } 3279 switch fieldId { 3280 case 0: 3281 if fieldTypeId == thrift.STRUCT { 3282 l, err = p.FastReadField0(buf[offset:]) 3283 offset += l 3284 if err != nil { 3285 goto ReadFieldError 3286 } 3287 } else { 3288 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3289 offset += l 3290 if err != nil { 3291 goto SkipFieldError 3292 } 3293 } 3294 default: 3295 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3296 offset += l 3297 if err != nil { 3298 goto SkipFieldError 3299 } 3300 } 3301 3302 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 3303 offset += l 3304 if err != nil { 3305 goto ReadFieldEndError 3306 } 3307 } 3308 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 3309 offset += l 3310 if err != nil { 3311 goto ReadStructEndError 3312 } 3313 3314 return offset, nil 3315 ReadStructBeginError: 3316 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3317 ReadFieldBeginError: 3318 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3319 ReadFieldError: 3320 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceNestingMethodResult[fieldId]), err) 3321 SkipFieldError: 3322 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3323 ReadFieldEndError: 3324 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3325 ReadStructEndError: 3326 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3327 } 3328 3329 func (p *BaselineServiceNestingMethodResult) FastReadField0(buf []byte) (int, error) { 3330 offset := 0 3331 p.Success = NewNesting() 3332 if l, err := p.Success.FastRead(buf[offset:]); err != nil { 3333 return offset, err 3334 } else { 3335 offset += l 3336 } 3337 return offset, nil 3338 } 3339 3340 // for compatibility 3341 func (p *BaselineServiceNestingMethodResult) FastWrite(buf []byte) int { 3342 return 0 3343 } 3344 3345 func (p *BaselineServiceNestingMethodResult) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3346 offset := 0 3347 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "NestingMethod_result") 3348 if p != nil { 3349 offset += p.fastWriteField0(buf[offset:], binaryWriter) 3350 } 3351 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 3352 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 3353 return offset 3354 } 3355 3356 func (p *BaselineServiceNestingMethodResult) BLength() int { 3357 l := 0 3358 l += bthrift.Binary.StructBeginLength("NestingMethod_result") 3359 if p != nil { 3360 l += p.field0Length() 3361 } 3362 l += bthrift.Binary.FieldStopLength() 3363 l += bthrift.Binary.StructEndLength() 3364 return l 3365 } 3366 3367 func (p *BaselineServiceNestingMethodResult) fastWriteField0(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3368 offset := 0 3369 if p.IsSetSuccess() { 3370 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "success", thrift.STRUCT, 0) 3371 offset += p.Success.FastWriteNocopy(buf[offset:], binaryWriter) 3372 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 3373 } 3374 return offset 3375 } 3376 3377 func (p *BaselineServiceNestingMethodResult) field0Length() int { 3378 l := 0 3379 if p.IsSetSuccess() { 3380 l += bthrift.Binary.FieldBeginLength("success", thrift.STRUCT, 0) 3381 l += p.Success.BLength() 3382 l += bthrift.Binary.FieldEndLength() 3383 } 3384 return l 3385 } 3386 3387 func (p *BaselineServicePartialNestingMethodArgs) FastRead(buf []byte) (int, error) { 3388 var err error 3389 var offset int 3390 var l int 3391 var fieldTypeId thrift.TType 3392 var fieldId int16 3393 _, l, err = bthrift.Binary.ReadStructBegin(buf) 3394 offset += l 3395 if err != nil { 3396 goto ReadStructBeginError 3397 } 3398 3399 for { 3400 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 3401 offset += l 3402 if err != nil { 3403 goto ReadFieldBeginError 3404 } 3405 if fieldTypeId == thrift.STOP { 3406 break 3407 } 3408 switch fieldId { 3409 case 1: 3410 if fieldTypeId == thrift.STRUCT { 3411 l, err = p.FastReadField1(buf[offset:]) 3412 offset += l 3413 if err != nil { 3414 goto ReadFieldError 3415 } 3416 } else { 3417 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3418 offset += l 3419 if err != nil { 3420 goto SkipFieldError 3421 } 3422 } 3423 default: 3424 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3425 offset += l 3426 if err != nil { 3427 goto SkipFieldError 3428 } 3429 } 3430 3431 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 3432 offset += l 3433 if err != nil { 3434 goto ReadFieldEndError 3435 } 3436 } 3437 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 3438 offset += l 3439 if err != nil { 3440 goto ReadStructEndError 3441 } 3442 3443 return offset, nil 3444 ReadStructBeginError: 3445 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3446 ReadFieldBeginError: 3447 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3448 ReadFieldError: 3449 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServicePartialNestingMethodArgs[fieldId]), err) 3450 SkipFieldError: 3451 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3452 ReadFieldEndError: 3453 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3454 ReadStructEndError: 3455 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3456 } 3457 3458 func (p *BaselineServicePartialNestingMethodArgs) FastReadField1(buf []byte) (int, error) { 3459 offset := 0 3460 p.Req = NewPartialNesting() 3461 if l, err := p.Req.FastRead(buf[offset:]); err != nil { 3462 return offset, err 3463 } else { 3464 offset += l 3465 } 3466 return offset, nil 3467 } 3468 3469 // for compatibility 3470 func (p *BaselineServicePartialNestingMethodArgs) FastWrite(buf []byte) int { 3471 return 0 3472 } 3473 3474 func (p *BaselineServicePartialNestingMethodArgs) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3475 offset := 0 3476 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "PartialNestingMethod_args") 3477 if p != nil { 3478 offset += p.fastWriteField1(buf[offset:], binaryWriter) 3479 } 3480 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 3481 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 3482 return offset 3483 } 3484 3485 func (p *BaselineServicePartialNestingMethodArgs) BLength() int { 3486 l := 0 3487 l += bthrift.Binary.StructBeginLength("PartialNestingMethod_args") 3488 if p != nil { 3489 l += p.field1Length() 3490 } 3491 l += bthrift.Binary.FieldStopLength() 3492 l += bthrift.Binary.StructEndLength() 3493 return l 3494 } 3495 3496 func (p *BaselineServicePartialNestingMethodArgs) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3497 offset := 0 3498 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "req", thrift.STRUCT, 1) 3499 offset += p.Req.FastWriteNocopy(buf[offset:], binaryWriter) 3500 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 3501 return offset 3502 } 3503 3504 func (p *BaselineServicePartialNestingMethodArgs) field1Length() int { 3505 l := 0 3506 l += bthrift.Binary.FieldBeginLength("req", thrift.STRUCT, 1) 3507 l += p.Req.BLength() 3508 l += bthrift.Binary.FieldEndLength() 3509 return l 3510 } 3511 3512 func (p *BaselineServicePartialNestingMethodResult) FastRead(buf []byte) (int, error) { 3513 var err error 3514 var offset int 3515 var l int 3516 var fieldTypeId thrift.TType 3517 var fieldId int16 3518 _, l, err = bthrift.Binary.ReadStructBegin(buf) 3519 offset += l 3520 if err != nil { 3521 goto ReadStructBeginError 3522 } 3523 3524 for { 3525 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 3526 offset += l 3527 if err != nil { 3528 goto ReadFieldBeginError 3529 } 3530 if fieldTypeId == thrift.STOP { 3531 break 3532 } 3533 switch fieldId { 3534 case 0: 3535 if fieldTypeId == thrift.STRUCT { 3536 l, err = p.FastReadField0(buf[offset:]) 3537 offset += l 3538 if err != nil { 3539 goto ReadFieldError 3540 } 3541 } else { 3542 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3543 offset += l 3544 if err != nil { 3545 goto SkipFieldError 3546 } 3547 } 3548 default: 3549 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3550 offset += l 3551 if err != nil { 3552 goto SkipFieldError 3553 } 3554 } 3555 3556 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 3557 offset += l 3558 if err != nil { 3559 goto ReadFieldEndError 3560 } 3561 } 3562 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 3563 offset += l 3564 if err != nil { 3565 goto ReadStructEndError 3566 } 3567 3568 return offset, nil 3569 ReadStructBeginError: 3570 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3571 ReadFieldBeginError: 3572 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3573 ReadFieldError: 3574 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServicePartialNestingMethodResult[fieldId]), err) 3575 SkipFieldError: 3576 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3577 ReadFieldEndError: 3578 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3579 ReadStructEndError: 3580 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3581 } 3582 3583 func (p *BaselineServicePartialNestingMethodResult) FastReadField0(buf []byte) (int, error) { 3584 offset := 0 3585 p.Success = NewPartialNesting() 3586 if l, err := p.Success.FastRead(buf[offset:]); err != nil { 3587 return offset, err 3588 } else { 3589 offset += l 3590 } 3591 return offset, nil 3592 } 3593 3594 // for compatibility 3595 func (p *BaselineServicePartialNestingMethodResult) FastWrite(buf []byte) int { 3596 return 0 3597 } 3598 3599 func (p *BaselineServicePartialNestingMethodResult) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3600 offset := 0 3601 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "PartialNestingMethod_result") 3602 if p != nil { 3603 offset += p.fastWriteField0(buf[offset:], binaryWriter) 3604 } 3605 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 3606 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 3607 return offset 3608 } 3609 3610 func (p *BaselineServicePartialNestingMethodResult) BLength() int { 3611 l := 0 3612 l += bthrift.Binary.StructBeginLength("PartialNestingMethod_result") 3613 if p != nil { 3614 l += p.field0Length() 3615 } 3616 l += bthrift.Binary.FieldStopLength() 3617 l += bthrift.Binary.StructEndLength() 3618 return l 3619 } 3620 3621 func (p *BaselineServicePartialNestingMethodResult) fastWriteField0(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3622 offset := 0 3623 if p.IsSetSuccess() { 3624 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "success", thrift.STRUCT, 0) 3625 offset += p.Success.FastWriteNocopy(buf[offset:], binaryWriter) 3626 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 3627 } 3628 return offset 3629 } 3630 3631 func (p *BaselineServicePartialNestingMethodResult) field0Length() int { 3632 l := 0 3633 if p.IsSetSuccess() { 3634 l += bthrift.Binary.FieldBeginLength("success", thrift.STRUCT, 0) 3635 l += p.Success.BLength() 3636 l += bthrift.Binary.FieldEndLength() 3637 } 3638 return l 3639 } 3640 3641 func (p *BaselineServiceNesting2MethodArgs) FastRead(buf []byte) (int, error) { 3642 var err error 3643 var offset int 3644 var l int 3645 var fieldTypeId thrift.TType 3646 var fieldId int16 3647 _, l, err = bthrift.Binary.ReadStructBegin(buf) 3648 offset += l 3649 if err != nil { 3650 goto ReadStructBeginError 3651 } 3652 3653 for { 3654 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 3655 offset += l 3656 if err != nil { 3657 goto ReadFieldBeginError 3658 } 3659 if fieldTypeId == thrift.STOP { 3660 break 3661 } 3662 switch fieldId { 3663 case 1: 3664 if fieldTypeId == thrift.STRUCT { 3665 l, err = p.FastReadField1(buf[offset:]) 3666 offset += l 3667 if err != nil { 3668 goto ReadFieldError 3669 } 3670 } else { 3671 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3672 offset += l 3673 if err != nil { 3674 goto SkipFieldError 3675 } 3676 } 3677 default: 3678 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3679 offset += l 3680 if err != nil { 3681 goto SkipFieldError 3682 } 3683 } 3684 3685 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 3686 offset += l 3687 if err != nil { 3688 goto ReadFieldEndError 3689 } 3690 } 3691 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 3692 offset += l 3693 if err != nil { 3694 goto ReadStructEndError 3695 } 3696 3697 return offset, nil 3698 ReadStructBeginError: 3699 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3700 ReadFieldBeginError: 3701 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3702 ReadFieldError: 3703 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceNesting2MethodArgs[fieldId]), err) 3704 SkipFieldError: 3705 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3706 ReadFieldEndError: 3707 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3708 ReadStructEndError: 3709 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3710 } 3711 3712 func (p *BaselineServiceNesting2MethodArgs) FastReadField1(buf []byte) (int, error) { 3713 offset := 0 3714 p.Req = NewNesting2() 3715 if l, err := p.Req.FastRead(buf[offset:]); err != nil { 3716 return offset, err 3717 } else { 3718 offset += l 3719 } 3720 return offset, nil 3721 } 3722 3723 // for compatibility 3724 func (p *BaselineServiceNesting2MethodArgs) FastWrite(buf []byte) int { 3725 return 0 3726 } 3727 3728 func (p *BaselineServiceNesting2MethodArgs) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3729 offset := 0 3730 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "Nesting2Method_args") 3731 if p != nil { 3732 offset += p.fastWriteField1(buf[offset:], binaryWriter) 3733 } 3734 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 3735 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 3736 return offset 3737 } 3738 3739 func (p *BaselineServiceNesting2MethodArgs) BLength() int { 3740 l := 0 3741 l += bthrift.Binary.StructBeginLength("Nesting2Method_args") 3742 if p != nil { 3743 l += p.field1Length() 3744 } 3745 l += bthrift.Binary.FieldStopLength() 3746 l += bthrift.Binary.StructEndLength() 3747 return l 3748 } 3749 3750 func (p *BaselineServiceNesting2MethodArgs) fastWriteField1(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3751 offset := 0 3752 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "req", thrift.STRUCT, 1) 3753 offset += p.Req.FastWriteNocopy(buf[offset:], binaryWriter) 3754 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 3755 return offset 3756 } 3757 3758 func (p *BaselineServiceNesting2MethodArgs) field1Length() int { 3759 l := 0 3760 l += bthrift.Binary.FieldBeginLength("req", thrift.STRUCT, 1) 3761 l += p.Req.BLength() 3762 l += bthrift.Binary.FieldEndLength() 3763 return l 3764 } 3765 3766 func (p *BaselineServiceNesting2MethodResult) FastRead(buf []byte) (int, error) { 3767 var err error 3768 var offset int 3769 var l int 3770 var fieldTypeId thrift.TType 3771 var fieldId int16 3772 _, l, err = bthrift.Binary.ReadStructBegin(buf) 3773 offset += l 3774 if err != nil { 3775 goto ReadStructBeginError 3776 } 3777 3778 for { 3779 _, fieldTypeId, fieldId, l, err = bthrift.Binary.ReadFieldBegin(buf[offset:]) 3780 offset += l 3781 if err != nil { 3782 goto ReadFieldBeginError 3783 } 3784 if fieldTypeId == thrift.STOP { 3785 break 3786 } 3787 switch fieldId { 3788 case 0: 3789 if fieldTypeId == thrift.STRUCT { 3790 l, err = p.FastReadField0(buf[offset:]) 3791 offset += l 3792 if err != nil { 3793 goto ReadFieldError 3794 } 3795 } else { 3796 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3797 offset += l 3798 if err != nil { 3799 goto SkipFieldError 3800 } 3801 } 3802 default: 3803 l, err = bthrift.Binary.Skip(buf[offset:], fieldTypeId) 3804 offset += l 3805 if err != nil { 3806 goto SkipFieldError 3807 } 3808 } 3809 3810 l, err = bthrift.Binary.ReadFieldEnd(buf[offset:]) 3811 offset += l 3812 if err != nil { 3813 goto ReadFieldEndError 3814 } 3815 } 3816 l, err = bthrift.Binary.ReadStructEnd(buf[offset:]) 3817 offset += l 3818 if err != nil { 3819 goto ReadStructEndError 3820 } 3821 3822 return offset, nil 3823 ReadStructBeginError: 3824 return offset, thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3825 ReadFieldBeginError: 3826 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3827 ReadFieldError: 3828 return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BaselineServiceNesting2MethodResult[fieldId]), err) 3829 SkipFieldError: 3830 return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3831 ReadFieldEndError: 3832 return offset, thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3833 ReadStructEndError: 3834 return offset, thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3835 } 3836 3837 func (p *BaselineServiceNesting2MethodResult) FastReadField0(buf []byte) (int, error) { 3838 offset := 0 3839 p.Success = NewNesting2() 3840 if l, err := p.Success.FastRead(buf[offset:]); err != nil { 3841 return offset, err 3842 } else { 3843 offset += l 3844 } 3845 return offset, nil 3846 } 3847 3848 // for compatibility 3849 func (p *BaselineServiceNesting2MethodResult) FastWrite(buf []byte) int { 3850 return 0 3851 } 3852 3853 func (p *BaselineServiceNesting2MethodResult) FastWriteNocopy(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3854 offset := 0 3855 offset += bthrift.Binary.WriteStructBegin(buf[offset:], "Nesting2Method_result") 3856 if p != nil { 3857 offset += p.fastWriteField0(buf[offset:], binaryWriter) 3858 } 3859 offset += bthrift.Binary.WriteFieldStop(buf[offset:]) 3860 offset += bthrift.Binary.WriteStructEnd(buf[offset:]) 3861 return offset 3862 } 3863 3864 func (p *BaselineServiceNesting2MethodResult) BLength() int { 3865 l := 0 3866 l += bthrift.Binary.StructBeginLength("Nesting2Method_result") 3867 if p != nil { 3868 l += p.field0Length() 3869 } 3870 l += bthrift.Binary.FieldStopLength() 3871 l += bthrift.Binary.StructEndLength() 3872 return l 3873 } 3874 3875 func (p *BaselineServiceNesting2MethodResult) fastWriteField0(buf []byte, binaryWriter bthrift.BinaryWriter) int { 3876 offset := 0 3877 if p.IsSetSuccess() { 3878 offset += bthrift.Binary.WriteFieldBegin(buf[offset:], "success", thrift.STRUCT, 0) 3879 offset += p.Success.FastWriteNocopy(buf[offset:], binaryWriter) 3880 offset += bthrift.Binary.WriteFieldEnd(buf[offset:]) 3881 } 3882 return offset 3883 } 3884 3885 func (p *BaselineServiceNesting2MethodResult) field0Length() int { 3886 l := 0 3887 if p.IsSetSuccess() { 3888 l += bthrift.Binary.FieldBeginLength("success", thrift.STRUCT, 0) 3889 l += p.Success.BLength() 3890 l += bthrift.Binary.FieldEndLength() 3891 } 3892 return l 3893 } 3894 3895 func (p *BaselineServiceSimpleMethodArgs) GetFirstArgument() interface{} { 3896 return p.Req 3897 } 3898 3899 func (p *BaselineServiceSimpleMethodResult) GetResult() interface{} { 3900 return p.Success 3901 } 3902 3903 func (p *BaselineServicePartialSimpleMethodArgs) GetFirstArgument() interface{} { 3904 return p.Req 3905 } 3906 3907 func (p *BaselineServicePartialSimpleMethodResult) GetResult() interface{} { 3908 return p.Success 3909 } 3910 3911 func (p *BaselineServiceNestingMethodArgs) GetFirstArgument() interface{} { 3912 return p.Req 3913 } 3914 3915 func (p *BaselineServiceNestingMethodResult) GetResult() interface{} { 3916 return p.Success 3917 } 3918 3919 func (p *BaselineServicePartialNestingMethodArgs) GetFirstArgument() interface{} { 3920 return p.Req 3921 } 3922 3923 func (p *BaselineServicePartialNestingMethodResult) GetResult() interface{} { 3924 return p.Success 3925 } 3926 3927 func (p *BaselineServiceNesting2MethodArgs) GetFirstArgument() interface{} { 3928 return p.Req 3929 } 3930 3931 func (p *BaselineServiceNesting2MethodResult) GetResult() interface{} { 3932 return p.Success 3933 }