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