github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/kitex_gen/example3/example3.go (about) 1 // Code generated by thriftgo (0.1.3). DO NOT EDIT. 2 3 package example3 4 5 import ( 6 "bytes" 7 "context" 8 "database/sql" 9 "database/sql/driver" 10 "fmt" 11 "github.com/apache/thrift/lib/go/thrift" 12 "github.com/cloudwego/dynamicgo/testdata/kitex_gen/base" 13 "github.com/cloudwego/dynamicgo/testdata/kitex_gen/ref" 14 "strings" 15 ) 16 17 type FOO int64 18 19 const ( 20 FOO_A FOO = 1 21 ) 22 23 func (p FOO) String() string { 24 switch p { 25 case FOO_A: 26 return "A" 27 } 28 return "<UNSET>" 29 } 30 31 func FOOFromString(s string) (FOO, error) { 32 switch s { 33 case "A": 34 return FOO_A, nil 35 } 36 return FOO(0), fmt.Errorf("not a valid FOO string") 37 } 38 39 func FOOPtr(v FOO) *FOO { return &v } 40 41 func (p *FOO) Scan(value interface{}) (err error) { 42 var result sql.NullInt64 43 err = result.Scan(value) 44 *p = FOO(result.Int64) 45 return 46 } 47 48 func (p *FOO) Value() (driver.Value, error) { 49 if p == nil { 50 return nil, nil 51 } 52 return int64(*p), nil 53 } 54 55 type InnerBase struct { 56 Bool bool `thrift:"Bool,1" json:"Bool"` 57 Byte int8 `thrift:"Byte,2" json:"Byte"` 58 Int16 int16 `thrift:"Int16,3" json:"Int16"` 59 Int32 int32 `thrift:"Int32,4" json:"Int32"` 60 Int64 int64 `thrift:"Int64,5" json:"Int64"` 61 Double float64 `thrift:"Double,6" json:"Double"` 62 String_ string `thrift:"String,7" json:"String"` 63 ListInt32 []int32 `thrift:"ListInt32,8" json:"ListInt32"` 64 MapStringString map[string]string `thrift:"MapStringString,9" json:"MapStringString"` 65 SetInt32_ []int32 `thrift:"SetInt32,10" json:"SetInt32"` 66 Foo FOO `thrift:"Foo,11" json:"Foo"` 67 MapInt32String map[int32]string `thrift:"MapInt32String,12" json:"MapInt32String"` 68 Binary []byte `thrift:"Binary,13" json:"Binary"` 69 MapInt8String map[int8]string `thrift:"MapInt8String,14" json:"MapInt8String"` 70 MapInt16String map[int16]string `thrift:"MapInt16String,15" json:"MapInt16String"` 71 MapInt64String map[int64]string `thrift:"MapInt64String,16" json:"MapInt64String"` 72 ListInnerBase []*InnerBase `thrift:"ListInnerBase,18" json:"ListInnerBase"` 73 MapStringInnerBase map[string]*InnerBase `thrift:"MapStringInnerBase,19" json:"MapStringInnerBase"` 74 InnerQuery string `thrift:"InnerQuery,20" json:"InnerQuery"` 75 Base *base.Base `thrift:"Base,255" json:"Base"` 76 } 77 78 func NewInnerBase() *InnerBase { 79 return &InnerBase{} 80 } 81 82 func (p *InnerBase) GetBool() (v bool) { 83 return p.Bool 84 } 85 86 func (p *InnerBase) GetByte() (v int8) { 87 return p.Byte 88 } 89 90 func (p *InnerBase) GetInt16() (v int16) { 91 return p.Int16 92 } 93 94 func (p *InnerBase) GetInt32() (v int32) { 95 return p.Int32 96 } 97 98 func (p *InnerBase) GetInt64() (v int64) { 99 return p.Int64 100 } 101 102 func (p *InnerBase) GetDouble() (v float64) { 103 return p.Double 104 } 105 106 func (p *InnerBase) GetString() (v string) { 107 return p.String_ 108 } 109 110 func (p *InnerBase) GetListInt32() (v []int32) { 111 return p.ListInt32 112 } 113 114 func (p *InnerBase) GetMapStringString() (v map[string]string) { 115 return p.MapStringString 116 } 117 118 func (p *InnerBase) GetSetInt32() (v []int32) { 119 return p.SetInt32_ 120 } 121 122 func (p *InnerBase) GetFoo() (v FOO) { 123 return p.Foo 124 } 125 126 func (p *InnerBase) GetMapInt32String() (v map[int32]string) { 127 return p.MapInt32String 128 } 129 130 func (p *InnerBase) GetBinary() (v []byte) { 131 return p.Binary 132 } 133 134 func (p *InnerBase) GetMapInt8String() (v map[int8]string) { 135 return p.MapInt8String 136 } 137 138 func (p *InnerBase) GetMapInt16String() (v map[int16]string) { 139 return p.MapInt16String 140 } 141 142 func (p *InnerBase) GetMapInt64String() (v map[int64]string) { 143 return p.MapInt64String 144 } 145 146 func (p *InnerBase) GetListInnerBase() (v []*InnerBase) { 147 return p.ListInnerBase 148 } 149 150 func (p *InnerBase) GetMapStringInnerBase() (v map[string]*InnerBase) { 151 return p.MapStringInnerBase 152 } 153 154 func (p *InnerBase) GetInnerQuery() (v string) { 155 return p.InnerQuery 156 } 157 158 var InnerBase_Base_DEFAULT *base.Base 159 160 func (p *InnerBase) GetBase() (v *base.Base) { 161 if !p.IsSetBase() { 162 return InnerBase_Base_DEFAULT 163 } 164 return p.Base 165 } 166 func (p *InnerBase) SetBool(val bool) { 167 p.Bool = val 168 } 169 func (p *InnerBase) SetByte(val int8) { 170 p.Byte = val 171 } 172 func (p *InnerBase) SetInt16(val int16) { 173 p.Int16 = val 174 } 175 func (p *InnerBase) SetInt32(val int32) { 176 p.Int32 = val 177 } 178 func (p *InnerBase) SetInt64(val int64) { 179 p.Int64 = val 180 } 181 func (p *InnerBase) SetDouble(val float64) { 182 p.Double = val 183 } 184 func (p *InnerBase) SetString(val string) { 185 p.String_ = val 186 } 187 func (p *InnerBase) SetListInt32(val []int32) { 188 p.ListInt32 = val 189 } 190 func (p *InnerBase) SetMapStringString(val map[string]string) { 191 p.MapStringString = val 192 } 193 func (p *InnerBase) SetSetInt32(val []int32) { 194 p.SetInt32_ = val 195 } 196 func (p *InnerBase) SetFoo(val FOO) { 197 p.Foo = val 198 } 199 func (p *InnerBase) SetMapInt32String(val map[int32]string) { 200 p.MapInt32String = val 201 } 202 func (p *InnerBase) SetBinary(val []byte) { 203 p.Binary = val 204 } 205 func (p *InnerBase) SetMapInt8String(val map[int8]string) { 206 p.MapInt8String = val 207 } 208 func (p *InnerBase) SetMapInt16String(val map[int16]string) { 209 p.MapInt16String = val 210 } 211 func (p *InnerBase) SetMapInt64String(val map[int64]string) { 212 p.MapInt64String = val 213 } 214 func (p *InnerBase) SetListInnerBase(val []*InnerBase) { 215 p.ListInnerBase = val 216 } 217 func (p *InnerBase) SetMapStringInnerBase(val map[string]*InnerBase) { 218 p.MapStringInnerBase = val 219 } 220 func (p *InnerBase) SetInnerQuery(val string) { 221 p.InnerQuery = val 222 } 223 func (p *InnerBase) SetBase(val *base.Base) { 224 p.Base = val 225 } 226 227 var fieldIDToName_InnerBase = map[int16]string{ 228 1: "Bool", 229 2: "Byte", 230 3: "Int16", 231 4: "Int32", 232 5: "Int64", 233 6: "Double", 234 7: "String", 235 8: "ListInt32", 236 9: "MapStringString", 237 10: "SetInt32", 238 11: "Foo", 239 12: "MapInt32String", 240 13: "Binary", 241 14: "MapInt8String", 242 15: "MapInt16String", 243 16: "MapInt64String", 244 18: "ListInnerBase", 245 19: "MapStringInnerBase", 246 20: "InnerQuery", 247 255: "Base", 248 } 249 250 func (p *InnerBase) IsSetBase() bool { 251 return p.Base != nil 252 } 253 254 func (p *InnerBase) Read(iprot thrift.TProtocol) (err error) { 255 256 var fieldTypeId thrift.TType 257 var fieldId int16 258 259 if _, err = iprot.ReadStructBegin(); err != nil { 260 goto ReadStructBeginError 261 } 262 263 for { 264 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 265 if err != nil { 266 goto ReadFieldBeginError 267 } 268 if fieldTypeId == thrift.STOP { 269 break 270 } 271 272 switch fieldId { 273 case 1: 274 if fieldTypeId == thrift.BOOL { 275 if err = p.ReadField1(iprot); err != nil { 276 goto ReadFieldError 277 } 278 } else { 279 if err = iprot.Skip(fieldTypeId); err != nil { 280 goto SkipFieldError 281 } 282 } 283 case 2: 284 if fieldTypeId == thrift.BYTE { 285 if err = p.ReadField2(iprot); err != nil { 286 goto ReadFieldError 287 } 288 } else { 289 if err = iprot.Skip(fieldTypeId); err != nil { 290 goto SkipFieldError 291 } 292 } 293 case 3: 294 if fieldTypeId == thrift.I16 { 295 if err = p.ReadField3(iprot); err != nil { 296 goto ReadFieldError 297 } 298 } else { 299 if err = iprot.Skip(fieldTypeId); err != nil { 300 goto SkipFieldError 301 } 302 } 303 case 4: 304 if fieldTypeId == thrift.I32 { 305 if err = p.ReadField4(iprot); err != nil { 306 goto ReadFieldError 307 } 308 } else { 309 if err = iprot.Skip(fieldTypeId); err != nil { 310 goto SkipFieldError 311 } 312 } 313 case 5: 314 if fieldTypeId == thrift.I64 { 315 if err = p.ReadField5(iprot); err != nil { 316 goto ReadFieldError 317 } 318 } else { 319 if err = iprot.Skip(fieldTypeId); err != nil { 320 goto SkipFieldError 321 } 322 } 323 case 6: 324 if fieldTypeId == thrift.DOUBLE { 325 if err = p.ReadField6(iprot); err != nil { 326 goto ReadFieldError 327 } 328 } else { 329 if err = iprot.Skip(fieldTypeId); err != nil { 330 goto SkipFieldError 331 } 332 } 333 case 7: 334 if fieldTypeId == thrift.STRING { 335 if err = p.ReadField7(iprot); err != nil { 336 goto ReadFieldError 337 } 338 } else { 339 if err = iprot.Skip(fieldTypeId); err != nil { 340 goto SkipFieldError 341 } 342 } 343 case 8: 344 if fieldTypeId == thrift.LIST { 345 if err = p.ReadField8(iprot); err != nil { 346 goto ReadFieldError 347 } 348 } else { 349 if err = iprot.Skip(fieldTypeId); err != nil { 350 goto SkipFieldError 351 } 352 } 353 case 9: 354 if fieldTypeId == thrift.MAP { 355 if err = p.ReadField9(iprot); err != nil { 356 goto ReadFieldError 357 } 358 } else { 359 if err = iprot.Skip(fieldTypeId); err != nil { 360 goto SkipFieldError 361 } 362 } 363 case 10: 364 if fieldTypeId == thrift.SET { 365 if err = p.ReadField10(iprot); err != nil { 366 goto ReadFieldError 367 } 368 } else { 369 if err = iprot.Skip(fieldTypeId); err != nil { 370 goto SkipFieldError 371 } 372 } 373 case 11: 374 if fieldTypeId == thrift.I32 { 375 if err = p.ReadField11(iprot); err != nil { 376 goto ReadFieldError 377 } 378 } else { 379 if err = iprot.Skip(fieldTypeId); err != nil { 380 goto SkipFieldError 381 } 382 } 383 case 12: 384 if fieldTypeId == thrift.MAP { 385 if err = p.ReadField12(iprot); err != nil { 386 goto ReadFieldError 387 } 388 } else { 389 if err = iprot.Skip(fieldTypeId); err != nil { 390 goto SkipFieldError 391 } 392 } 393 case 13: 394 if fieldTypeId == thrift.STRING { 395 if err = p.ReadField13(iprot); err != nil { 396 goto ReadFieldError 397 } 398 } else { 399 if err = iprot.Skip(fieldTypeId); err != nil { 400 goto SkipFieldError 401 } 402 } 403 case 14: 404 if fieldTypeId == thrift.MAP { 405 if err = p.ReadField14(iprot); err != nil { 406 goto ReadFieldError 407 } 408 } else { 409 if err = iprot.Skip(fieldTypeId); err != nil { 410 goto SkipFieldError 411 } 412 } 413 case 15: 414 if fieldTypeId == thrift.MAP { 415 if err = p.ReadField15(iprot); err != nil { 416 goto ReadFieldError 417 } 418 } else { 419 if err = iprot.Skip(fieldTypeId); err != nil { 420 goto SkipFieldError 421 } 422 } 423 case 16: 424 if fieldTypeId == thrift.MAP { 425 if err = p.ReadField16(iprot); err != nil { 426 goto ReadFieldError 427 } 428 } else { 429 if err = iprot.Skip(fieldTypeId); err != nil { 430 goto SkipFieldError 431 } 432 } 433 case 18: 434 if fieldTypeId == thrift.LIST { 435 if err = p.ReadField18(iprot); err != nil { 436 goto ReadFieldError 437 } 438 } else { 439 if err = iprot.Skip(fieldTypeId); err != nil { 440 goto SkipFieldError 441 } 442 } 443 case 19: 444 if fieldTypeId == thrift.MAP { 445 if err = p.ReadField19(iprot); err != nil { 446 goto ReadFieldError 447 } 448 } else { 449 if err = iprot.Skip(fieldTypeId); err != nil { 450 goto SkipFieldError 451 } 452 } 453 case 20: 454 if fieldTypeId == thrift.STRING { 455 if err = p.ReadField20(iprot); err != nil { 456 goto ReadFieldError 457 } 458 } else { 459 if err = iprot.Skip(fieldTypeId); err != nil { 460 goto SkipFieldError 461 } 462 } 463 case 255: 464 if fieldTypeId == thrift.STRUCT { 465 if err = p.ReadField255(iprot); err != nil { 466 goto ReadFieldError 467 } 468 } else { 469 if err = iprot.Skip(fieldTypeId); err != nil { 470 goto SkipFieldError 471 } 472 } 473 default: 474 if err = iprot.Skip(fieldTypeId); err != nil { 475 goto SkipFieldError 476 } 477 } 478 479 if err = iprot.ReadFieldEnd(); err != nil { 480 goto ReadFieldEndError 481 } 482 } 483 if err = iprot.ReadStructEnd(); err != nil { 484 goto ReadStructEndError 485 } 486 487 return nil 488 ReadStructBeginError: 489 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 490 ReadFieldBeginError: 491 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 492 ReadFieldError: 493 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_InnerBase[fieldId]), err) 494 SkipFieldError: 495 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 496 497 ReadFieldEndError: 498 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 499 ReadStructEndError: 500 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 501 } 502 503 func (p *InnerBase) ReadField1(iprot thrift.TProtocol) error { 504 if v, err := iprot.ReadBool(); err != nil { 505 return err 506 } else { 507 p.Bool = v 508 } 509 return nil 510 } 511 512 func (p *InnerBase) ReadField2(iprot thrift.TProtocol) error { 513 if v, err := iprot.ReadByte(); err != nil { 514 return err 515 } else { 516 p.Byte = v 517 } 518 return nil 519 } 520 521 func (p *InnerBase) ReadField3(iprot thrift.TProtocol) error { 522 if v, err := iprot.ReadI16(); err != nil { 523 return err 524 } else { 525 p.Int16 = v 526 } 527 return nil 528 } 529 530 func (p *InnerBase) ReadField4(iprot thrift.TProtocol) error { 531 if v, err := iprot.ReadI32(); err != nil { 532 return err 533 } else { 534 p.Int32 = v 535 } 536 return nil 537 } 538 539 func (p *InnerBase) ReadField5(iprot thrift.TProtocol) error { 540 if v, err := iprot.ReadI64(); err != nil { 541 return err 542 } else { 543 p.Int64 = v 544 } 545 return nil 546 } 547 548 func (p *InnerBase) ReadField6(iprot thrift.TProtocol) error { 549 if v, err := iprot.ReadDouble(); err != nil { 550 return err 551 } else { 552 p.Double = v 553 } 554 return nil 555 } 556 557 func (p *InnerBase) ReadField7(iprot thrift.TProtocol) error { 558 if v, err := iprot.ReadString(); err != nil { 559 return err 560 } else { 561 p.String_ = v 562 } 563 return nil 564 } 565 566 func (p *InnerBase) ReadField8(iprot thrift.TProtocol) error { 567 _, size, err := iprot.ReadListBegin() 568 if err != nil { 569 return err 570 } 571 p.ListInt32 = make([]int32, 0, size) 572 for i := 0; i < size; i++ { 573 var _elem int32 574 if v, err := iprot.ReadI32(); err != nil { 575 return err 576 } else { 577 _elem = v 578 } 579 580 p.ListInt32 = append(p.ListInt32, _elem) 581 } 582 if err := iprot.ReadListEnd(); err != nil { 583 return err 584 } 585 return nil 586 } 587 588 func (p *InnerBase) ReadField9(iprot thrift.TProtocol) error { 589 _, _, size, err := iprot.ReadMapBegin() 590 if err != nil { 591 return err 592 } 593 p.MapStringString = make(map[string]string, size) 594 for i := 0; i < size; i++ { 595 var _key string 596 if v, err := iprot.ReadString(); err != nil { 597 return err 598 } else { 599 _key = v 600 } 601 602 var _val string 603 if v, err := iprot.ReadString(); err != nil { 604 return err 605 } else { 606 _val = v 607 } 608 609 p.MapStringString[_key] = _val 610 } 611 if err := iprot.ReadMapEnd(); err != nil { 612 return err 613 } 614 return nil 615 } 616 617 func (p *InnerBase) ReadField10(iprot thrift.TProtocol) error { 618 _, size, err := iprot.ReadSetBegin() 619 if err != nil { 620 return err 621 } 622 p.SetInt32_ = make([]int32, 0, size) 623 for i := 0; i < size; i++ { 624 var _elem int32 625 if v, err := iprot.ReadI32(); err != nil { 626 return err 627 } else { 628 _elem = v 629 } 630 631 p.SetInt32_ = append(p.SetInt32_, _elem) 632 } 633 if err := iprot.ReadSetEnd(); err != nil { 634 return err 635 } 636 return nil 637 } 638 639 func (p *InnerBase) ReadField11(iprot thrift.TProtocol) error { 640 if v, err := iprot.ReadI32(); err != nil { 641 return err 642 } else { 643 p.Foo = FOO(v) 644 } 645 return nil 646 } 647 648 func (p *InnerBase) ReadField12(iprot thrift.TProtocol) error { 649 _, _, size, err := iprot.ReadMapBegin() 650 if err != nil { 651 return err 652 } 653 p.MapInt32String = make(map[int32]string, size) 654 for i := 0; i < size; i++ { 655 var _key int32 656 if v, err := iprot.ReadI32(); err != nil { 657 return err 658 } else { 659 _key = v 660 } 661 662 var _val string 663 if v, err := iprot.ReadString(); err != nil { 664 return err 665 } else { 666 _val = v 667 } 668 669 p.MapInt32String[_key] = _val 670 } 671 if err := iprot.ReadMapEnd(); err != nil { 672 return err 673 } 674 return nil 675 } 676 677 func (p *InnerBase) ReadField13(iprot thrift.TProtocol) error { 678 if v, err := iprot.ReadBinary(); err != nil { 679 return err 680 } else { 681 p.Binary = []byte(v) 682 } 683 return nil 684 } 685 686 func (p *InnerBase) ReadField14(iprot thrift.TProtocol) error { 687 _, _, size, err := iprot.ReadMapBegin() 688 if err != nil { 689 return err 690 } 691 p.MapInt8String = make(map[int8]string, size) 692 for i := 0; i < size; i++ { 693 var _key int8 694 if v, err := iprot.ReadByte(); err != nil { 695 return err 696 } else { 697 _key = v 698 } 699 700 var _val string 701 if v, err := iprot.ReadString(); err != nil { 702 return err 703 } else { 704 _val = v 705 } 706 707 p.MapInt8String[_key] = _val 708 } 709 if err := iprot.ReadMapEnd(); err != nil { 710 return err 711 } 712 return nil 713 } 714 715 func (p *InnerBase) ReadField15(iprot thrift.TProtocol) error { 716 _, _, size, err := iprot.ReadMapBegin() 717 if err != nil { 718 return err 719 } 720 p.MapInt16String = make(map[int16]string, size) 721 for i := 0; i < size; i++ { 722 var _key int16 723 if v, err := iprot.ReadI16(); err != nil { 724 return err 725 } else { 726 _key = v 727 } 728 729 var _val string 730 if v, err := iprot.ReadString(); err != nil { 731 return err 732 } else { 733 _val = v 734 } 735 736 p.MapInt16String[_key] = _val 737 } 738 if err := iprot.ReadMapEnd(); err != nil { 739 return err 740 } 741 return nil 742 } 743 744 func (p *InnerBase) ReadField16(iprot thrift.TProtocol) error { 745 _, _, size, err := iprot.ReadMapBegin() 746 if err != nil { 747 return err 748 } 749 p.MapInt64String = make(map[int64]string, size) 750 for i := 0; i < size; i++ { 751 var _key int64 752 if v, err := iprot.ReadI64(); err != nil { 753 return err 754 } else { 755 _key = v 756 } 757 758 var _val string 759 if v, err := iprot.ReadString(); err != nil { 760 return err 761 } else { 762 _val = v 763 } 764 765 p.MapInt64String[_key] = _val 766 } 767 if err := iprot.ReadMapEnd(); err != nil { 768 return err 769 } 770 return nil 771 } 772 773 func (p *InnerBase) ReadField18(iprot thrift.TProtocol) error { 774 _, size, err := iprot.ReadListBegin() 775 if err != nil { 776 return err 777 } 778 p.ListInnerBase = make([]*InnerBase, 0, size) 779 for i := 0; i < size; i++ { 780 _elem := NewInnerBase() 781 if err := _elem.Read(iprot); err != nil { 782 return err 783 } 784 785 p.ListInnerBase = append(p.ListInnerBase, _elem) 786 } 787 if err := iprot.ReadListEnd(); err != nil { 788 return err 789 } 790 return nil 791 } 792 793 func (p *InnerBase) ReadField19(iprot thrift.TProtocol) error { 794 _, _, size, err := iprot.ReadMapBegin() 795 if err != nil { 796 return err 797 } 798 p.MapStringInnerBase = make(map[string]*InnerBase, size) 799 for i := 0; i < size; i++ { 800 var _key string 801 if v, err := iprot.ReadString(); err != nil { 802 return err 803 } else { 804 _key = v 805 } 806 _val := NewInnerBase() 807 if err := _val.Read(iprot); err != nil { 808 return err 809 } 810 811 p.MapStringInnerBase[_key] = _val 812 } 813 if err := iprot.ReadMapEnd(); err != nil { 814 return err 815 } 816 return nil 817 } 818 819 func (p *InnerBase) ReadField20(iprot thrift.TProtocol) error { 820 if v, err := iprot.ReadString(); err != nil { 821 return err 822 } else { 823 p.InnerQuery = v 824 } 825 return nil 826 } 827 828 func (p *InnerBase) ReadField255(iprot thrift.TProtocol) error { 829 p.Base = base.NewBase() 830 if err := p.Base.Read(iprot); err != nil { 831 return err 832 } 833 return nil 834 } 835 836 func (p *InnerBase) Write(oprot thrift.TProtocol) (err error) { 837 var fieldId int16 838 if err = oprot.WriteStructBegin("InnerBase"); err != nil { 839 goto WriteStructBeginError 840 } 841 if p != nil { 842 if err = p.writeField1(oprot); err != nil { 843 fieldId = 1 844 goto WriteFieldError 845 } 846 if err = p.writeField2(oprot); err != nil { 847 fieldId = 2 848 goto WriteFieldError 849 } 850 if err = p.writeField3(oprot); err != nil { 851 fieldId = 3 852 goto WriteFieldError 853 } 854 if err = p.writeField4(oprot); err != nil { 855 fieldId = 4 856 goto WriteFieldError 857 } 858 if err = p.writeField5(oprot); err != nil { 859 fieldId = 5 860 goto WriteFieldError 861 } 862 if err = p.writeField6(oprot); err != nil { 863 fieldId = 6 864 goto WriteFieldError 865 } 866 if err = p.writeField7(oprot); err != nil { 867 fieldId = 7 868 goto WriteFieldError 869 } 870 if err = p.writeField8(oprot); err != nil { 871 fieldId = 8 872 goto WriteFieldError 873 } 874 if err = p.writeField9(oprot); err != nil { 875 fieldId = 9 876 goto WriteFieldError 877 } 878 if err = p.writeField10(oprot); err != nil { 879 fieldId = 10 880 goto WriteFieldError 881 } 882 if err = p.writeField11(oprot); err != nil { 883 fieldId = 11 884 goto WriteFieldError 885 } 886 if err = p.writeField12(oprot); err != nil { 887 fieldId = 12 888 goto WriteFieldError 889 } 890 if err = p.writeField13(oprot); err != nil { 891 fieldId = 13 892 goto WriteFieldError 893 } 894 if err = p.writeField14(oprot); err != nil { 895 fieldId = 14 896 goto WriteFieldError 897 } 898 if err = p.writeField15(oprot); err != nil { 899 fieldId = 15 900 goto WriteFieldError 901 } 902 if err = p.writeField16(oprot); err != nil { 903 fieldId = 16 904 goto WriteFieldError 905 } 906 if err = p.writeField18(oprot); err != nil { 907 fieldId = 18 908 goto WriteFieldError 909 } 910 if err = p.writeField19(oprot); err != nil { 911 fieldId = 19 912 goto WriteFieldError 913 } 914 if err = p.writeField20(oprot); err != nil { 915 fieldId = 20 916 goto WriteFieldError 917 } 918 if err = p.writeField255(oprot); err != nil { 919 fieldId = 255 920 goto WriteFieldError 921 } 922 923 } 924 if err = oprot.WriteFieldStop(); err != nil { 925 goto WriteFieldStopError 926 } 927 if err = oprot.WriteStructEnd(); err != nil { 928 goto WriteStructEndError 929 } 930 return nil 931 WriteStructBeginError: 932 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 933 WriteFieldError: 934 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 935 WriteFieldStopError: 936 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 937 WriteStructEndError: 938 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 939 } 940 941 func (p *InnerBase) writeField1(oprot thrift.TProtocol) (err error) { 942 if err = oprot.WriteFieldBegin("Bool", thrift.BOOL, 1); err != nil { 943 goto WriteFieldBeginError 944 } 945 if err := oprot.WriteBool(p.Bool); err != nil { 946 return err 947 } 948 if err = oprot.WriteFieldEnd(); err != nil { 949 goto WriteFieldEndError 950 } 951 return nil 952 WriteFieldBeginError: 953 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 954 WriteFieldEndError: 955 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 956 } 957 958 func (p *InnerBase) writeField2(oprot thrift.TProtocol) (err error) { 959 if err = oprot.WriteFieldBegin("Byte", thrift.BYTE, 2); err != nil { 960 goto WriteFieldBeginError 961 } 962 if err := oprot.WriteByte(p.Byte); err != nil { 963 return err 964 } 965 if err = oprot.WriteFieldEnd(); err != nil { 966 goto WriteFieldEndError 967 } 968 return nil 969 WriteFieldBeginError: 970 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 971 WriteFieldEndError: 972 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 973 } 974 975 func (p *InnerBase) writeField3(oprot thrift.TProtocol) (err error) { 976 if err = oprot.WriteFieldBegin("Int16", thrift.I16, 3); err != nil { 977 goto WriteFieldBeginError 978 } 979 if err := oprot.WriteI16(p.Int16); err != nil { 980 return err 981 } 982 if err = oprot.WriteFieldEnd(); err != nil { 983 goto WriteFieldEndError 984 } 985 return nil 986 WriteFieldBeginError: 987 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 988 WriteFieldEndError: 989 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 990 } 991 992 func (p *InnerBase) writeField4(oprot thrift.TProtocol) (err error) { 993 if err = oprot.WriteFieldBegin("Int32", thrift.I32, 4); err != nil { 994 goto WriteFieldBeginError 995 } 996 if err := oprot.WriteI32(p.Int32); err != nil { 997 return err 998 } 999 if err = oprot.WriteFieldEnd(); err != nil { 1000 goto WriteFieldEndError 1001 } 1002 return nil 1003 WriteFieldBeginError: 1004 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 1005 WriteFieldEndError: 1006 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 1007 } 1008 1009 func (p *InnerBase) writeField5(oprot thrift.TProtocol) (err error) { 1010 if err = oprot.WriteFieldBegin("Int64", thrift.I64, 5); err != nil { 1011 goto WriteFieldBeginError 1012 } 1013 if err := oprot.WriteI64(p.Int64); err != nil { 1014 return err 1015 } 1016 if err = oprot.WriteFieldEnd(); err != nil { 1017 goto WriteFieldEndError 1018 } 1019 return nil 1020 WriteFieldBeginError: 1021 return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) 1022 WriteFieldEndError: 1023 return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) 1024 } 1025 1026 func (p *InnerBase) writeField6(oprot thrift.TProtocol) (err error) { 1027 if err = oprot.WriteFieldBegin("Double", thrift.DOUBLE, 6); err != nil { 1028 goto WriteFieldBeginError 1029 } 1030 if err := oprot.WriteDouble(p.Double); err != nil { 1031 return err 1032 } 1033 if err = oprot.WriteFieldEnd(); err != nil { 1034 goto WriteFieldEndError 1035 } 1036 return nil 1037 WriteFieldBeginError: 1038 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 1039 WriteFieldEndError: 1040 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 1041 } 1042 1043 func (p *InnerBase) writeField7(oprot thrift.TProtocol) (err error) { 1044 if err = oprot.WriteFieldBegin("String", thrift.STRING, 7); err != nil { 1045 goto WriteFieldBeginError 1046 } 1047 if err := oprot.WriteString(p.String_); err != nil { 1048 return err 1049 } 1050 if err = oprot.WriteFieldEnd(); err != nil { 1051 goto WriteFieldEndError 1052 } 1053 return nil 1054 WriteFieldBeginError: 1055 return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) 1056 WriteFieldEndError: 1057 return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) 1058 } 1059 1060 func (p *InnerBase) writeField8(oprot thrift.TProtocol) (err error) { 1061 if err = oprot.WriteFieldBegin("ListInt32", thrift.LIST, 8); err != nil { 1062 goto WriteFieldBeginError 1063 } 1064 if err := oprot.WriteListBegin(thrift.I32, len(p.ListInt32)); err != nil { 1065 return err 1066 } 1067 for _, v := range p.ListInt32 { 1068 if err := oprot.WriteI32(v); err != nil { 1069 return err 1070 } 1071 } 1072 if err := oprot.WriteListEnd(); err != nil { 1073 return err 1074 } 1075 if err = oprot.WriteFieldEnd(); err != nil { 1076 goto WriteFieldEndError 1077 } 1078 return nil 1079 WriteFieldBeginError: 1080 return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err) 1081 WriteFieldEndError: 1082 return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err) 1083 } 1084 1085 func (p *InnerBase) writeField9(oprot thrift.TProtocol) (err error) { 1086 if err = oprot.WriteFieldBegin("MapStringString", thrift.MAP, 9); err != nil { 1087 goto WriteFieldBeginError 1088 } 1089 if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRING, len(p.MapStringString)); err != nil { 1090 return err 1091 } 1092 for k, v := range p.MapStringString { 1093 1094 if err := oprot.WriteString(k); err != nil { 1095 return err 1096 } 1097 1098 if err := oprot.WriteString(v); err != nil { 1099 return err 1100 } 1101 } 1102 if err := oprot.WriteMapEnd(); err != nil { 1103 return err 1104 } 1105 if err = oprot.WriteFieldEnd(); err != nil { 1106 goto WriteFieldEndError 1107 } 1108 return nil 1109 WriteFieldBeginError: 1110 return thrift.PrependError(fmt.Sprintf("%T write field 9 begin error: ", p), err) 1111 WriteFieldEndError: 1112 return thrift.PrependError(fmt.Sprintf("%T write field 9 end error: ", p), err) 1113 } 1114 1115 func (p *InnerBase) writeField10(oprot thrift.TProtocol) (err error) { 1116 if err = oprot.WriteFieldBegin("SetInt32", thrift.SET, 10); err != nil { 1117 goto WriteFieldBeginError 1118 } 1119 if err := oprot.WriteSetBegin(thrift.I32, len(p.SetInt32_)); err != nil { 1120 return err 1121 } 1122 for i := 0; i < len(p.SetInt32_); i++ { 1123 for j := i + 1; j < len(p.SetInt32_); j++ { 1124 if func(tgt, src int32) bool { 1125 if tgt != src { 1126 return false 1127 } 1128 return true 1129 }(p.SetInt32_[i], p.SetInt32_[j]) { 1130 return thrift.PrependError("", fmt.Errorf("%T error writing set field: slice is not unique", p.SetInt32_[i])) 1131 } 1132 } 1133 } 1134 for _, v := range p.SetInt32_ { 1135 if err := oprot.WriteI32(v); err != nil { 1136 return err 1137 } 1138 } 1139 if err := oprot.WriteSetEnd(); err != nil { 1140 return err 1141 } 1142 if err = oprot.WriteFieldEnd(); err != nil { 1143 goto WriteFieldEndError 1144 } 1145 return nil 1146 WriteFieldBeginError: 1147 return thrift.PrependError(fmt.Sprintf("%T write field 10 begin error: ", p), err) 1148 WriteFieldEndError: 1149 return thrift.PrependError(fmt.Sprintf("%T write field 10 end error: ", p), err) 1150 } 1151 1152 func (p *InnerBase) writeField11(oprot thrift.TProtocol) (err error) { 1153 if err = oprot.WriteFieldBegin("Foo", thrift.I32, 11); err != nil { 1154 goto WriteFieldBeginError 1155 } 1156 if err := oprot.WriteI32(int32(p.Foo)); err != nil { 1157 return err 1158 } 1159 if err = oprot.WriteFieldEnd(); err != nil { 1160 goto WriteFieldEndError 1161 } 1162 return nil 1163 WriteFieldBeginError: 1164 return thrift.PrependError(fmt.Sprintf("%T write field 11 begin error: ", p), err) 1165 WriteFieldEndError: 1166 return thrift.PrependError(fmt.Sprintf("%T write field 11 end error: ", p), err) 1167 } 1168 1169 func (p *InnerBase) writeField12(oprot thrift.TProtocol) (err error) { 1170 if err = oprot.WriteFieldBegin("MapInt32String", thrift.MAP, 12); err != nil { 1171 goto WriteFieldBeginError 1172 } 1173 if err := oprot.WriteMapBegin(thrift.I32, thrift.STRING, len(p.MapInt32String)); err != nil { 1174 return err 1175 } 1176 for k, v := range p.MapInt32String { 1177 1178 if err := oprot.WriteI32(k); err != nil { 1179 return err 1180 } 1181 1182 if err := oprot.WriteString(v); err != nil { 1183 return err 1184 } 1185 } 1186 if err := oprot.WriteMapEnd(); err != nil { 1187 return err 1188 } 1189 if err = oprot.WriteFieldEnd(); err != nil { 1190 goto WriteFieldEndError 1191 } 1192 return nil 1193 WriteFieldBeginError: 1194 return thrift.PrependError(fmt.Sprintf("%T write field 12 begin error: ", p), err) 1195 WriteFieldEndError: 1196 return thrift.PrependError(fmt.Sprintf("%T write field 12 end error: ", p), err) 1197 } 1198 1199 func (p *InnerBase) writeField13(oprot thrift.TProtocol) (err error) { 1200 if err = oprot.WriteFieldBegin("Binary", thrift.STRING, 13); err != nil { 1201 goto WriteFieldBeginError 1202 } 1203 if err := oprot.WriteBinary([]byte(p.Binary)); err != nil { 1204 return err 1205 } 1206 if err = oprot.WriteFieldEnd(); err != nil { 1207 goto WriteFieldEndError 1208 } 1209 return nil 1210 WriteFieldBeginError: 1211 return thrift.PrependError(fmt.Sprintf("%T write field 13 begin error: ", p), err) 1212 WriteFieldEndError: 1213 return thrift.PrependError(fmt.Sprintf("%T write field 13 end error: ", p), err) 1214 } 1215 1216 func (p *InnerBase) writeField14(oprot thrift.TProtocol) (err error) { 1217 if err = oprot.WriteFieldBegin("MapInt8String", thrift.MAP, 14); err != nil { 1218 goto WriteFieldBeginError 1219 } 1220 if err := oprot.WriteMapBegin(thrift.BYTE, thrift.STRING, len(p.MapInt8String)); err != nil { 1221 return err 1222 } 1223 for k, v := range p.MapInt8String { 1224 1225 if err := oprot.WriteByte(k); err != nil { 1226 return err 1227 } 1228 1229 if err := oprot.WriteString(v); err != nil { 1230 return err 1231 } 1232 } 1233 if err := oprot.WriteMapEnd(); err != nil { 1234 return err 1235 } 1236 if err = oprot.WriteFieldEnd(); err != nil { 1237 goto WriteFieldEndError 1238 } 1239 return nil 1240 WriteFieldBeginError: 1241 return thrift.PrependError(fmt.Sprintf("%T write field 14 begin error: ", p), err) 1242 WriteFieldEndError: 1243 return thrift.PrependError(fmt.Sprintf("%T write field 14 end error: ", p), err) 1244 } 1245 1246 func (p *InnerBase) writeField15(oprot thrift.TProtocol) (err error) { 1247 if err = oprot.WriteFieldBegin("MapInt16String", thrift.MAP, 15); err != nil { 1248 goto WriteFieldBeginError 1249 } 1250 if err := oprot.WriteMapBegin(thrift.I16, thrift.STRING, len(p.MapInt16String)); err != nil { 1251 return err 1252 } 1253 for k, v := range p.MapInt16String { 1254 1255 if err := oprot.WriteI16(k); err != nil { 1256 return err 1257 } 1258 1259 if err := oprot.WriteString(v); err != nil { 1260 return err 1261 } 1262 } 1263 if err := oprot.WriteMapEnd(); err != nil { 1264 return err 1265 } 1266 if err = oprot.WriteFieldEnd(); err != nil { 1267 goto WriteFieldEndError 1268 } 1269 return nil 1270 WriteFieldBeginError: 1271 return thrift.PrependError(fmt.Sprintf("%T write field 15 begin error: ", p), err) 1272 WriteFieldEndError: 1273 return thrift.PrependError(fmt.Sprintf("%T write field 15 end error: ", p), err) 1274 } 1275 1276 func (p *InnerBase) writeField16(oprot thrift.TProtocol) (err error) { 1277 if err = oprot.WriteFieldBegin("MapInt64String", thrift.MAP, 16); err != nil { 1278 goto WriteFieldBeginError 1279 } 1280 if err := oprot.WriteMapBegin(thrift.I64, thrift.STRING, len(p.MapInt64String)); err != nil { 1281 return err 1282 } 1283 for k, v := range p.MapInt64String { 1284 1285 if err := oprot.WriteI64(k); err != nil { 1286 return err 1287 } 1288 1289 if err := oprot.WriteString(v); err != nil { 1290 return err 1291 } 1292 } 1293 if err := oprot.WriteMapEnd(); err != nil { 1294 return err 1295 } 1296 if err = oprot.WriteFieldEnd(); err != nil { 1297 goto WriteFieldEndError 1298 } 1299 return nil 1300 WriteFieldBeginError: 1301 return thrift.PrependError(fmt.Sprintf("%T write field 16 begin error: ", p), err) 1302 WriteFieldEndError: 1303 return thrift.PrependError(fmt.Sprintf("%T write field 16 end error: ", p), err) 1304 } 1305 1306 func (p *InnerBase) writeField18(oprot thrift.TProtocol) (err error) { 1307 if err = oprot.WriteFieldBegin("ListInnerBase", thrift.LIST, 18); err != nil { 1308 goto WriteFieldBeginError 1309 } 1310 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.ListInnerBase)); err != nil { 1311 return err 1312 } 1313 for _, v := range p.ListInnerBase { 1314 if err := v.Write(oprot); err != nil { 1315 return err 1316 } 1317 } 1318 if err := oprot.WriteListEnd(); err != nil { 1319 return err 1320 } 1321 if err = oprot.WriteFieldEnd(); err != nil { 1322 goto WriteFieldEndError 1323 } 1324 return nil 1325 WriteFieldBeginError: 1326 return thrift.PrependError(fmt.Sprintf("%T write field 18 begin error: ", p), err) 1327 WriteFieldEndError: 1328 return thrift.PrependError(fmt.Sprintf("%T write field 18 end error: ", p), err) 1329 } 1330 1331 func (p *InnerBase) writeField19(oprot thrift.TProtocol) (err error) { 1332 if err = oprot.WriteFieldBegin("MapStringInnerBase", thrift.MAP, 19); err != nil { 1333 goto WriteFieldBeginError 1334 } 1335 if err := oprot.WriteMapBegin(thrift.STRING, thrift.STRUCT, len(p.MapStringInnerBase)); err != nil { 1336 return err 1337 } 1338 for k, v := range p.MapStringInnerBase { 1339 1340 if err := oprot.WriteString(k); err != nil { 1341 return err 1342 } 1343 1344 if err := v.Write(oprot); err != nil { 1345 return err 1346 } 1347 } 1348 if err := oprot.WriteMapEnd(); err != nil { 1349 return err 1350 } 1351 if err = oprot.WriteFieldEnd(); err != nil { 1352 goto WriteFieldEndError 1353 } 1354 return nil 1355 WriteFieldBeginError: 1356 return thrift.PrependError(fmt.Sprintf("%T write field 19 begin error: ", p), err) 1357 WriteFieldEndError: 1358 return thrift.PrependError(fmt.Sprintf("%T write field 19 end error: ", p), err) 1359 } 1360 1361 func (p *InnerBase) writeField20(oprot thrift.TProtocol) (err error) { 1362 if err = oprot.WriteFieldBegin("InnerQuery", thrift.STRING, 20); err != nil { 1363 goto WriteFieldBeginError 1364 } 1365 if err := oprot.WriteString(p.InnerQuery); err != nil { 1366 return err 1367 } 1368 if err = oprot.WriteFieldEnd(); err != nil { 1369 goto WriteFieldEndError 1370 } 1371 return nil 1372 WriteFieldBeginError: 1373 return thrift.PrependError(fmt.Sprintf("%T write field 20 begin error: ", p), err) 1374 WriteFieldEndError: 1375 return thrift.PrependError(fmt.Sprintf("%T write field 20 end error: ", p), err) 1376 } 1377 1378 func (p *InnerBase) writeField255(oprot thrift.TProtocol) (err error) { 1379 if err = oprot.WriteFieldBegin("Base", thrift.STRUCT, 255); err != nil { 1380 goto WriteFieldBeginError 1381 } 1382 if err := p.Base.Write(oprot); err != nil { 1383 return err 1384 } 1385 if err = oprot.WriteFieldEnd(); err != nil { 1386 goto WriteFieldEndError 1387 } 1388 return nil 1389 WriteFieldBeginError: 1390 return thrift.PrependError(fmt.Sprintf("%T write field 255 begin error: ", p), err) 1391 WriteFieldEndError: 1392 return thrift.PrependError(fmt.Sprintf("%T write field 255 end error: ", p), err) 1393 } 1394 1395 func (p *InnerBase) String() string { 1396 if p == nil { 1397 return "<nil>" 1398 } 1399 return fmt.Sprintf("InnerBase(%+v)", *p) 1400 } 1401 1402 func (p *InnerBase) DeepEqual(ano *InnerBase) bool { 1403 if p == ano { 1404 return true 1405 } else if p == nil || ano == nil { 1406 return false 1407 } 1408 if !p.Field1DeepEqual(ano.Bool) { 1409 return false 1410 } 1411 if !p.Field2DeepEqual(ano.Byte) { 1412 return false 1413 } 1414 if !p.Field3DeepEqual(ano.Int16) { 1415 return false 1416 } 1417 if !p.Field4DeepEqual(ano.Int32) { 1418 return false 1419 } 1420 if !p.Field5DeepEqual(ano.Int64) { 1421 return false 1422 } 1423 if !p.Field6DeepEqual(ano.Double) { 1424 return false 1425 } 1426 if !p.Field7DeepEqual(ano.String_) { 1427 return false 1428 } 1429 if !p.Field8DeepEqual(ano.ListInt32) { 1430 return false 1431 } 1432 if !p.Field9DeepEqual(ano.MapStringString) { 1433 return false 1434 } 1435 if !p.Field10DeepEqual(ano.SetInt32_) { 1436 return false 1437 } 1438 if !p.Field11DeepEqual(ano.Foo) { 1439 return false 1440 } 1441 if !p.Field12DeepEqual(ano.MapInt32String) { 1442 return false 1443 } 1444 if !p.Field13DeepEqual(ano.Binary) { 1445 return false 1446 } 1447 if !p.Field14DeepEqual(ano.MapInt8String) { 1448 return false 1449 } 1450 if !p.Field15DeepEqual(ano.MapInt16String) { 1451 return false 1452 } 1453 if !p.Field16DeepEqual(ano.MapInt64String) { 1454 return false 1455 } 1456 if !p.Field18DeepEqual(ano.ListInnerBase) { 1457 return false 1458 } 1459 if !p.Field19DeepEqual(ano.MapStringInnerBase) { 1460 return false 1461 } 1462 if !p.Field20DeepEqual(ano.InnerQuery) { 1463 return false 1464 } 1465 if !p.Field255DeepEqual(ano.Base) { 1466 return false 1467 } 1468 return true 1469 } 1470 1471 func (p *InnerBase) Field1DeepEqual(src bool) bool { 1472 1473 if p.Bool != src { 1474 return false 1475 } 1476 return true 1477 } 1478 func (p *InnerBase) Field2DeepEqual(src int8) bool { 1479 1480 if p.Byte != src { 1481 return false 1482 } 1483 return true 1484 } 1485 func (p *InnerBase) Field3DeepEqual(src int16) bool { 1486 1487 if p.Int16 != src { 1488 return false 1489 } 1490 return true 1491 } 1492 func (p *InnerBase) Field4DeepEqual(src int32) bool { 1493 1494 if p.Int32 != src { 1495 return false 1496 } 1497 return true 1498 } 1499 func (p *InnerBase) Field5DeepEqual(src int64) bool { 1500 1501 if p.Int64 != src { 1502 return false 1503 } 1504 return true 1505 } 1506 func (p *InnerBase) Field6DeepEqual(src float64) bool { 1507 1508 if p.Double != src { 1509 return false 1510 } 1511 return true 1512 } 1513 func (p *InnerBase) Field7DeepEqual(src string) bool { 1514 1515 if strings.Compare(p.String_, src) != 0 { 1516 return false 1517 } 1518 return true 1519 } 1520 func (p *InnerBase) Field8DeepEqual(src []int32) bool { 1521 1522 if len(p.ListInt32) != len(src) { 1523 return false 1524 } 1525 for i, v := range p.ListInt32 { 1526 _src := src[i] 1527 if v != _src { 1528 return false 1529 } 1530 } 1531 return true 1532 } 1533 func (p *InnerBase) Field9DeepEqual(src map[string]string) bool { 1534 1535 if len(p.MapStringString) != len(src) { 1536 return false 1537 } 1538 for k, v := range p.MapStringString { 1539 _src := src[k] 1540 if strings.Compare(v, _src) != 0 { 1541 return false 1542 } 1543 } 1544 return true 1545 } 1546 func (p *InnerBase) Field10DeepEqual(src []int32) bool { 1547 1548 if len(p.SetInt32_) != len(src) { 1549 return false 1550 } 1551 for i, v := range p.SetInt32_ { 1552 _src := src[i] 1553 if v != _src { 1554 return false 1555 } 1556 } 1557 return true 1558 } 1559 func (p *InnerBase) Field11DeepEqual(src FOO) bool { 1560 1561 if p.Foo != src { 1562 return false 1563 } 1564 return true 1565 } 1566 func (p *InnerBase) Field12DeepEqual(src map[int32]string) bool { 1567 1568 if len(p.MapInt32String) != len(src) { 1569 return false 1570 } 1571 for k, v := range p.MapInt32String { 1572 _src := src[k] 1573 if strings.Compare(v, _src) != 0 { 1574 return false 1575 } 1576 } 1577 return true 1578 } 1579 func (p *InnerBase) Field13DeepEqual(src []byte) bool { 1580 1581 if bytes.Compare(p.Binary, src) != 0 { 1582 return false 1583 } 1584 return true 1585 } 1586 func (p *InnerBase) Field14DeepEqual(src map[int8]string) bool { 1587 1588 if len(p.MapInt8String) != len(src) { 1589 return false 1590 } 1591 for k, v := range p.MapInt8String { 1592 _src := src[k] 1593 if strings.Compare(v, _src) != 0 { 1594 return false 1595 } 1596 } 1597 return true 1598 } 1599 func (p *InnerBase) Field15DeepEqual(src map[int16]string) bool { 1600 1601 if len(p.MapInt16String) != len(src) { 1602 return false 1603 } 1604 for k, v := range p.MapInt16String { 1605 _src := src[k] 1606 if strings.Compare(v, _src) != 0 { 1607 return false 1608 } 1609 } 1610 return true 1611 } 1612 func (p *InnerBase) Field16DeepEqual(src map[int64]string) bool { 1613 1614 if len(p.MapInt64String) != len(src) { 1615 return false 1616 } 1617 for k, v := range p.MapInt64String { 1618 _src := src[k] 1619 if strings.Compare(v, _src) != 0 { 1620 return false 1621 } 1622 } 1623 return true 1624 } 1625 func (p *InnerBase) Field18DeepEqual(src []*InnerBase) bool { 1626 1627 if len(p.ListInnerBase) != len(src) { 1628 return false 1629 } 1630 for i, v := range p.ListInnerBase { 1631 _src := src[i] 1632 if !v.DeepEqual(_src) { 1633 return false 1634 } 1635 } 1636 return true 1637 } 1638 func (p *InnerBase) Field19DeepEqual(src map[string]*InnerBase) bool { 1639 1640 if len(p.MapStringInnerBase) != len(src) { 1641 return false 1642 } 1643 for k, v := range p.MapStringInnerBase { 1644 _src := src[k] 1645 if !v.DeepEqual(_src) { 1646 return false 1647 } 1648 } 1649 return true 1650 } 1651 func (p *InnerBase) Field20DeepEqual(src string) bool { 1652 1653 if strings.Compare(p.InnerQuery, src) != 0 { 1654 return false 1655 } 1656 return true 1657 } 1658 func (p *InnerBase) Field255DeepEqual(src *base.Base) bool { 1659 1660 if !p.Base.DeepEqual(src) { 1661 return false 1662 } 1663 return true 1664 } 1665 1666 type ExampleReq struct { 1667 Msg *string `thrift:"Msg,1" json:"msg"` 1668 Cookie *float64 `thrift:"Cookie,2" json:"Cookie,omitempty"` 1669 Path string `thrift:"Path,3,required" json:"Path"` 1670 Query []string `thrift:"Query,4" json:"Query,omitempty"` 1671 Header *bool `thrift:"Header,5" json:"Header,omitempty"` 1672 Code int64 `thrift:"Code,6" json:"code_code"` 1673 InnerBase *InnerBase `thrift:"InnerBase,7" json:"InnerBase"` 1674 RawUri string `thrift:"RawUri,8" json:"RawUri"` 1675 Subfix float64 `thrift:"Subfix,32767" json:"Subfix"` 1676 Base *base.Base `thrift:"Base,255" json:"Base"` 1677 } 1678 1679 func NewExampleReq() *ExampleReq { 1680 return &ExampleReq{} 1681 } 1682 1683 var ExampleReq_Msg_DEFAULT string 1684 1685 func (p *ExampleReq) GetMsg() (v string) { 1686 if !p.IsSetMsg() { 1687 return ExampleReq_Msg_DEFAULT 1688 } 1689 return *p.Msg 1690 } 1691 1692 var ExampleReq_Cookie_DEFAULT float64 1693 1694 func (p *ExampleReq) GetCookie() (v float64) { 1695 if !p.IsSetCookie() { 1696 return ExampleReq_Cookie_DEFAULT 1697 } 1698 return *p.Cookie 1699 } 1700 1701 func (p *ExampleReq) GetPath() (v string) { 1702 return p.Path 1703 } 1704 1705 var ExampleReq_Query_DEFAULT []string 1706 1707 func (p *ExampleReq) GetQuery() (v []string) { 1708 if !p.IsSetQuery() { 1709 return ExampleReq_Query_DEFAULT 1710 } 1711 return p.Query 1712 } 1713 1714 var ExampleReq_Header_DEFAULT bool 1715 1716 func (p *ExampleReq) GetHeader() (v bool) { 1717 if !p.IsSetHeader() { 1718 return ExampleReq_Header_DEFAULT 1719 } 1720 return *p.Header 1721 } 1722 1723 func (p *ExampleReq) GetCode() (v int64) { 1724 return p.Code 1725 } 1726 1727 var ExampleReq_InnerBase_DEFAULT *InnerBase 1728 1729 func (p *ExampleReq) GetInnerBase() (v *InnerBase) { 1730 if !p.IsSetInnerBase() { 1731 return ExampleReq_InnerBase_DEFAULT 1732 } 1733 return p.InnerBase 1734 } 1735 1736 func (p *ExampleReq) GetRawUri() (v string) { 1737 return p.RawUri 1738 } 1739 1740 func (p *ExampleReq) GetSubfix() (v float64) { 1741 return p.Subfix 1742 } 1743 1744 var ExampleReq_Base_DEFAULT *base.Base 1745 1746 func (p *ExampleReq) GetBase() (v *base.Base) { 1747 if !p.IsSetBase() { 1748 return ExampleReq_Base_DEFAULT 1749 } 1750 return p.Base 1751 } 1752 func (p *ExampleReq) SetMsg(val *string) { 1753 p.Msg = val 1754 } 1755 func (p *ExampleReq) SetCookie(val *float64) { 1756 p.Cookie = val 1757 } 1758 func (p *ExampleReq) SetPath(val string) { 1759 p.Path = val 1760 } 1761 func (p *ExampleReq) SetQuery(val []string) { 1762 p.Query = val 1763 } 1764 func (p *ExampleReq) SetHeader(val *bool) { 1765 p.Header = val 1766 } 1767 func (p *ExampleReq) SetCode(val int64) { 1768 p.Code = val 1769 } 1770 func (p *ExampleReq) SetInnerBase(val *InnerBase) { 1771 p.InnerBase = val 1772 } 1773 func (p *ExampleReq) SetRawUri(val string) { 1774 p.RawUri = val 1775 } 1776 func (p *ExampleReq) SetSubfix(val float64) { 1777 p.Subfix = val 1778 } 1779 func (p *ExampleReq) SetBase(val *base.Base) { 1780 p.Base = val 1781 } 1782 1783 var fieldIDToName_ExampleReq = map[int16]string{ 1784 1: "Msg", 1785 2: "Cookie", 1786 3: "Path", 1787 4: "Query", 1788 5: "Header", 1789 6: "Code", 1790 7: "InnerBase", 1791 8: "RawUri", 1792 32767: "Subfix", 1793 255: "Base", 1794 } 1795 1796 func (p *ExampleReq) IsSetMsg() bool { 1797 return p.Msg != nil 1798 } 1799 1800 func (p *ExampleReq) IsSetCookie() bool { 1801 return p.Cookie != nil 1802 } 1803 1804 func (p *ExampleReq) IsSetQuery() bool { 1805 return p.Query != nil 1806 } 1807 1808 func (p *ExampleReq) IsSetHeader() bool { 1809 return p.Header != nil 1810 } 1811 1812 func (p *ExampleReq) IsSetInnerBase() bool { 1813 return p.InnerBase != nil 1814 } 1815 1816 func (p *ExampleReq) IsSetBase() bool { 1817 return p.Base != nil 1818 } 1819 1820 func (p *ExampleReq) Read(iprot thrift.TProtocol) (err error) { 1821 1822 var fieldTypeId thrift.TType 1823 var fieldId int16 1824 var issetPath bool = false 1825 1826 if _, err = iprot.ReadStructBegin(); err != nil { 1827 goto ReadStructBeginError 1828 } 1829 1830 for { 1831 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 1832 if err != nil { 1833 goto ReadFieldBeginError 1834 } 1835 if fieldTypeId == thrift.STOP { 1836 break 1837 } 1838 1839 switch fieldId { 1840 case 1: 1841 if fieldTypeId == thrift.STRING { 1842 if err = p.ReadField1(iprot); err != nil { 1843 goto ReadFieldError 1844 } 1845 } else { 1846 if err = iprot.Skip(fieldTypeId); err != nil { 1847 goto SkipFieldError 1848 } 1849 } 1850 case 2: 1851 if fieldTypeId == thrift.DOUBLE { 1852 if err = p.ReadField2(iprot); err != nil { 1853 goto ReadFieldError 1854 } 1855 } else { 1856 if err = iprot.Skip(fieldTypeId); err != nil { 1857 goto SkipFieldError 1858 } 1859 } 1860 case 3: 1861 if fieldTypeId == thrift.STRING { 1862 if err = p.ReadField3(iprot); err != nil { 1863 goto ReadFieldError 1864 } 1865 issetPath = true 1866 } else { 1867 if err = iprot.Skip(fieldTypeId); err != nil { 1868 goto SkipFieldError 1869 } 1870 } 1871 case 4: 1872 if fieldTypeId == thrift.LIST { 1873 if err = p.ReadField4(iprot); err != nil { 1874 goto ReadFieldError 1875 } 1876 } else { 1877 if err = iprot.Skip(fieldTypeId); err != nil { 1878 goto SkipFieldError 1879 } 1880 } 1881 case 5: 1882 if fieldTypeId == thrift.BOOL { 1883 if err = p.ReadField5(iprot); err != nil { 1884 goto ReadFieldError 1885 } 1886 } else { 1887 if err = iprot.Skip(fieldTypeId); err != nil { 1888 goto SkipFieldError 1889 } 1890 } 1891 case 6: 1892 if fieldTypeId == thrift.I64 { 1893 if err = p.ReadField6(iprot); err != nil { 1894 goto ReadFieldError 1895 } 1896 } else { 1897 if err = iprot.Skip(fieldTypeId); err != nil { 1898 goto SkipFieldError 1899 } 1900 } 1901 case 7: 1902 if fieldTypeId == thrift.STRUCT { 1903 if err = p.ReadField7(iprot); err != nil { 1904 goto ReadFieldError 1905 } 1906 } else { 1907 if err = iprot.Skip(fieldTypeId); err != nil { 1908 goto SkipFieldError 1909 } 1910 } 1911 case 8: 1912 if fieldTypeId == thrift.STRING { 1913 if err = p.ReadField8(iprot); err != nil { 1914 goto ReadFieldError 1915 } 1916 } else { 1917 if err = iprot.Skip(fieldTypeId); err != nil { 1918 goto SkipFieldError 1919 } 1920 } 1921 case 32767: 1922 if fieldTypeId == thrift.DOUBLE { 1923 if err = p.ReadField32767(iprot); err != nil { 1924 goto ReadFieldError 1925 } 1926 } else { 1927 if err = iprot.Skip(fieldTypeId); err != nil { 1928 goto SkipFieldError 1929 } 1930 } 1931 case 255: 1932 if fieldTypeId == thrift.STRUCT { 1933 if err = p.ReadField255(iprot); err != nil { 1934 goto ReadFieldError 1935 } 1936 } else { 1937 if err = iprot.Skip(fieldTypeId); err != nil { 1938 goto SkipFieldError 1939 } 1940 } 1941 default: 1942 if err = iprot.Skip(fieldTypeId); err != nil { 1943 goto SkipFieldError 1944 } 1945 } 1946 1947 if err = iprot.ReadFieldEnd(); err != nil { 1948 goto ReadFieldEndError 1949 } 1950 } 1951 if err = iprot.ReadStructEnd(); err != nil { 1952 goto ReadStructEndError 1953 } 1954 1955 if !issetPath { 1956 fieldId = 3 1957 goto RequiredFieldNotSetError 1958 } 1959 return nil 1960 ReadStructBeginError: 1961 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 1962 ReadFieldBeginError: 1963 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 1964 ReadFieldError: 1965 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleReq[fieldId]), err) 1966 SkipFieldError: 1967 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 1968 1969 ReadFieldEndError: 1970 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 1971 ReadStructEndError: 1972 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 1973 RequiredFieldNotSetError: 1974 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field %s is not set", fieldIDToName_ExampleReq[fieldId])) 1975 } 1976 1977 func (p *ExampleReq) ReadField1(iprot thrift.TProtocol) error { 1978 if v, err := iprot.ReadString(); err != nil { 1979 return err 1980 } else { 1981 p.Msg = &v 1982 } 1983 return nil 1984 } 1985 1986 func (p *ExampleReq) ReadField2(iprot thrift.TProtocol) error { 1987 if v, err := iprot.ReadDouble(); err != nil { 1988 return err 1989 } else { 1990 p.Cookie = &v 1991 } 1992 return nil 1993 } 1994 1995 func (p *ExampleReq) ReadField3(iprot thrift.TProtocol) error { 1996 if v, err := iprot.ReadString(); err != nil { 1997 return err 1998 } else { 1999 p.Path = v 2000 } 2001 return nil 2002 } 2003 2004 func (p *ExampleReq) ReadField4(iprot thrift.TProtocol) error { 2005 _, size, err := iprot.ReadListBegin() 2006 if err != nil { 2007 return err 2008 } 2009 p.Query = make([]string, 0, size) 2010 for i := 0; i < size; i++ { 2011 var _elem string 2012 if v, err := iprot.ReadString(); err != nil { 2013 return err 2014 } else { 2015 _elem = v 2016 } 2017 2018 p.Query = append(p.Query, _elem) 2019 } 2020 if err := iprot.ReadListEnd(); err != nil { 2021 return err 2022 } 2023 return nil 2024 } 2025 2026 func (p *ExampleReq) ReadField5(iprot thrift.TProtocol) error { 2027 if v, err := iprot.ReadBool(); err != nil { 2028 return err 2029 } else { 2030 p.Header = &v 2031 } 2032 return nil 2033 } 2034 2035 func (p *ExampleReq) ReadField6(iprot thrift.TProtocol) error { 2036 if v, err := iprot.ReadI64(); err != nil { 2037 return err 2038 } else { 2039 p.Code = v 2040 } 2041 return nil 2042 } 2043 2044 func (p *ExampleReq) ReadField7(iprot thrift.TProtocol) error { 2045 p.InnerBase = NewInnerBase() 2046 if err := p.InnerBase.Read(iprot); err != nil { 2047 return err 2048 } 2049 return nil 2050 } 2051 2052 func (p *ExampleReq) ReadField8(iprot thrift.TProtocol) error { 2053 if v, err := iprot.ReadString(); err != nil { 2054 return err 2055 } else { 2056 p.RawUri = v 2057 } 2058 return nil 2059 } 2060 2061 func (p *ExampleReq) ReadField32767(iprot thrift.TProtocol) error { 2062 if v, err := iprot.ReadDouble(); err != nil { 2063 return err 2064 } else { 2065 p.Subfix = v 2066 } 2067 return nil 2068 } 2069 2070 func (p *ExampleReq) ReadField255(iprot thrift.TProtocol) error { 2071 p.Base = base.NewBase() 2072 if err := p.Base.Read(iprot); err != nil { 2073 return err 2074 } 2075 return nil 2076 } 2077 2078 func (p *ExampleReq) Write(oprot thrift.TProtocol) (err error) { 2079 var fieldId int16 2080 if err = oprot.WriteStructBegin("ExampleReq"); err != nil { 2081 goto WriteStructBeginError 2082 } 2083 if p != nil { 2084 if err = p.writeField1(oprot); err != nil { 2085 fieldId = 1 2086 goto WriteFieldError 2087 } 2088 if err = p.writeField2(oprot); err != nil { 2089 fieldId = 2 2090 goto WriteFieldError 2091 } 2092 if err = p.writeField3(oprot); err != nil { 2093 fieldId = 3 2094 goto WriteFieldError 2095 } 2096 if err = p.writeField4(oprot); err != nil { 2097 fieldId = 4 2098 goto WriteFieldError 2099 } 2100 if err = p.writeField5(oprot); err != nil { 2101 fieldId = 5 2102 goto WriteFieldError 2103 } 2104 if err = p.writeField6(oprot); err != nil { 2105 fieldId = 6 2106 goto WriteFieldError 2107 } 2108 if err = p.writeField7(oprot); err != nil { 2109 fieldId = 7 2110 goto WriteFieldError 2111 } 2112 if err = p.writeField8(oprot); err != nil { 2113 fieldId = 8 2114 goto WriteFieldError 2115 } 2116 if err = p.writeField32767(oprot); err != nil { 2117 fieldId = 32767 2118 goto WriteFieldError 2119 } 2120 if err = p.writeField255(oprot); err != nil { 2121 fieldId = 255 2122 goto WriteFieldError 2123 } 2124 2125 } 2126 if err = oprot.WriteFieldStop(); err != nil { 2127 goto WriteFieldStopError 2128 } 2129 if err = oprot.WriteStructEnd(); err != nil { 2130 goto WriteStructEndError 2131 } 2132 return nil 2133 WriteStructBeginError: 2134 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2135 WriteFieldError: 2136 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 2137 WriteFieldStopError: 2138 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 2139 WriteStructEndError: 2140 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 2141 } 2142 2143 func (p *ExampleReq) writeField1(oprot thrift.TProtocol) (err error) { 2144 if p.IsSetMsg() { 2145 if err = oprot.WriteFieldBegin("Msg", thrift.STRING, 1); err != nil { 2146 goto WriteFieldBeginError 2147 } 2148 if err := oprot.WriteString(*p.Msg); err != nil { 2149 return err 2150 } 2151 if err = oprot.WriteFieldEnd(); err != nil { 2152 goto WriteFieldEndError 2153 } 2154 } 2155 return nil 2156 WriteFieldBeginError: 2157 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 2158 WriteFieldEndError: 2159 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 2160 } 2161 2162 func (p *ExampleReq) writeField2(oprot thrift.TProtocol) (err error) { 2163 if p.IsSetCookie() { 2164 if err = oprot.WriteFieldBegin("Cookie", thrift.DOUBLE, 2); err != nil { 2165 goto WriteFieldBeginError 2166 } 2167 if err := oprot.WriteDouble(*p.Cookie); err != nil { 2168 return err 2169 } 2170 if err = oprot.WriteFieldEnd(); err != nil { 2171 goto WriteFieldEndError 2172 } 2173 } 2174 return nil 2175 WriteFieldBeginError: 2176 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 2177 WriteFieldEndError: 2178 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 2179 } 2180 2181 func (p *ExampleReq) writeField3(oprot thrift.TProtocol) (err error) { 2182 if err = oprot.WriteFieldBegin("Path", thrift.STRING, 3); err != nil { 2183 goto WriteFieldBeginError 2184 } 2185 if err := oprot.WriteString(p.Path); err != nil { 2186 return err 2187 } 2188 if err = oprot.WriteFieldEnd(); err != nil { 2189 goto WriteFieldEndError 2190 } 2191 return nil 2192 WriteFieldBeginError: 2193 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 2194 WriteFieldEndError: 2195 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 2196 } 2197 2198 func (p *ExampleReq) writeField4(oprot thrift.TProtocol) (err error) { 2199 if p.IsSetQuery() { 2200 if err = oprot.WriteFieldBegin("Query", thrift.LIST, 4); err != nil { 2201 goto WriteFieldBeginError 2202 } 2203 if err := oprot.WriteListBegin(thrift.STRING, len(p.Query)); err != nil { 2204 return err 2205 } 2206 for _, v := range p.Query { 2207 if err := oprot.WriteString(v); err != nil { 2208 return err 2209 } 2210 } 2211 if err := oprot.WriteListEnd(); err != nil { 2212 return err 2213 } 2214 if err = oprot.WriteFieldEnd(); err != nil { 2215 goto WriteFieldEndError 2216 } 2217 } 2218 return nil 2219 WriteFieldBeginError: 2220 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 2221 WriteFieldEndError: 2222 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 2223 } 2224 2225 func (p *ExampleReq) writeField5(oprot thrift.TProtocol) (err error) { 2226 if p.IsSetHeader() { 2227 if err = oprot.WriteFieldBegin("Header", thrift.BOOL, 5); err != nil { 2228 goto WriteFieldBeginError 2229 } 2230 if err := oprot.WriteBool(*p.Header); err != nil { 2231 return err 2232 } 2233 if err = oprot.WriteFieldEnd(); err != nil { 2234 goto WriteFieldEndError 2235 } 2236 } 2237 return nil 2238 WriteFieldBeginError: 2239 return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) 2240 WriteFieldEndError: 2241 return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) 2242 } 2243 2244 func (p *ExampleReq) writeField6(oprot thrift.TProtocol) (err error) { 2245 if err = oprot.WriteFieldBegin("Code", thrift.I64, 6); err != nil { 2246 goto WriteFieldBeginError 2247 } 2248 if err := oprot.WriteI64(p.Code); err != nil { 2249 return err 2250 } 2251 if err = oprot.WriteFieldEnd(); err != nil { 2252 goto WriteFieldEndError 2253 } 2254 return nil 2255 WriteFieldBeginError: 2256 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 2257 WriteFieldEndError: 2258 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 2259 } 2260 2261 func (p *ExampleReq) writeField7(oprot thrift.TProtocol) (err error) { 2262 if err = oprot.WriteFieldBegin("InnerBase", thrift.STRUCT, 7); err != nil { 2263 goto WriteFieldBeginError 2264 } 2265 if err := p.InnerBase.Write(oprot); err != nil { 2266 return err 2267 } 2268 if err = oprot.WriteFieldEnd(); err != nil { 2269 goto WriteFieldEndError 2270 } 2271 return nil 2272 WriteFieldBeginError: 2273 return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) 2274 WriteFieldEndError: 2275 return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) 2276 } 2277 2278 func (p *ExampleReq) writeField8(oprot thrift.TProtocol) (err error) { 2279 if err = oprot.WriteFieldBegin("RawUri", thrift.STRING, 8); err != nil { 2280 goto WriteFieldBeginError 2281 } 2282 if err := oprot.WriteString(p.RawUri); err != nil { 2283 return err 2284 } 2285 if err = oprot.WriteFieldEnd(); err != nil { 2286 goto WriteFieldEndError 2287 } 2288 return nil 2289 WriteFieldBeginError: 2290 return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err) 2291 WriteFieldEndError: 2292 return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err) 2293 } 2294 2295 func (p *ExampleReq) writeField32767(oprot thrift.TProtocol) (err error) { 2296 if err = oprot.WriteFieldBegin("Subfix", thrift.DOUBLE, 32767); err != nil { 2297 goto WriteFieldBeginError 2298 } 2299 if err := oprot.WriteDouble(p.Subfix); err != nil { 2300 return err 2301 } 2302 if err = oprot.WriteFieldEnd(); err != nil { 2303 goto WriteFieldEndError 2304 } 2305 return nil 2306 WriteFieldBeginError: 2307 return thrift.PrependError(fmt.Sprintf("%T write field 32767 begin error: ", p), err) 2308 WriteFieldEndError: 2309 return thrift.PrependError(fmt.Sprintf("%T write field 32767 end error: ", p), err) 2310 } 2311 2312 func (p *ExampleReq) writeField255(oprot thrift.TProtocol) (err error) { 2313 if err = oprot.WriteFieldBegin("Base", thrift.STRUCT, 255); err != nil { 2314 goto WriteFieldBeginError 2315 } 2316 if err := p.Base.Write(oprot); err != nil { 2317 return err 2318 } 2319 if err = oprot.WriteFieldEnd(); err != nil { 2320 goto WriteFieldEndError 2321 } 2322 return nil 2323 WriteFieldBeginError: 2324 return thrift.PrependError(fmt.Sprintf("%T write field 255 begin error: ", p), err) 2325 WriteFieldEndError: 2326 return thrift.PrependError(fmt.Sprintf("%T write field 255 end error: ", p), err) 2327 } 2328 2329 func (p *ExampleReq) String() string { 2330 if p == nil { 2331 return "<nil>" 2332 } 2333 return fmt.Sprintf("ExampleReq(%+v)", *p) 2334 } 2335 2336 func (p *ExampleReq) DeepEqual(ano *ExampleReq) bool { 2337 if p == ano { 2338 return true 2339 } else if p == nil || ano == nil { 2340 return false 2341 } 2342 if !p.Field1DeepEqual(ano.Msg) { 2343 return false 2344 } 2345 if !p.Field2DeepEqual(ano.Cookie) { 2346 return false 2347 } 2348 if !p.Field3DeepEqual(ano.Path) { 2349 return false 2350 } 2351 if !p.Field4DeepEqual(ano.Query) { 2352 return false 2353 } 2354 if !p.Field5DeepEqual(ano.Header) { 2355 return false 2356 } 2357 if !p.Field6DeepEqual(ano.Code) { 2358 return false 2359 } 2360 if !p.Field7DeepEqual(ano.InnerBase) { 2361 return false 2362 } 2363 if !p.Field8DeepEqual(ano.RawUri) { 2364 return false 2365 } 2366 if !p.Field32767DeepEqual(ano.Subfix) { 2367 return false 2368 } 2369 if !p.Field255DeepEqual(ano.Base) { 2370 return false 2371 } 2372 return true 2373 } 2374 2375 func (p *ExampleReq) Field1DeepEqual(src *string) bool { 2376 2377 if p.Msg == src { 2378 return true 2379 } else if p.Msg == nil || src == nil { 2380 return false 2381 } 2382 if strings.Compare(*p.Msg, *src) != 0 { 2383 return false 2384 } 2385 return true 2386 } 2387 func (p *ExampleReq) Field2DeepEqual(src *float64) bool { 2388 2389 if p.Cookie == src { 2390 return true 2391 } else if p.Cookie == nil || src == nil { 2392 return false 2393 } 2394 if *p.Cookie != *src { 2395 return false 2396 } 2397 return true 2398 } 2399 func (p *ExampleReq) Field3DeepEqual(src string) bool { 2400 2401 if strings.Compare(p.Path, src) != 0 { 2402 return false 2403 } 2404 return true 2405 } 2406 func (p *ExampleReq) Field4DeepEqual(src []string) bool { 2407 2408 if len(p.Query) != len(src) { 2409 return false 2410 } 2411 for i, v := range p.Query { 2412 _src := src[i] 2413 if strings.Compare(v, _src) != 0 { 2414 return false 2415 } 2416 } 2417 return true 2418 } 2419 func (p *ExampleReq) Field5DeepEqual(src *bool) bool { 2420 2421 if p.Header == src { 2422 return true 2423 } else if p.Header == nil || src == nil { 2424 return false 2425 } 2426 if *p.Header != *src { 2427 return false 2428 } 2429 return true 2430 } 2431 func (p *ExampleReq) Field6DeepEqual(src int64) bool { 2432 2433 if p.Code != src { 2434 return false 2435 } 2436 return true 2437 } 2438 func (p *ExampleReq) Field7DeepEqual(src *InnerBase) bool { 2439 2440 if !p.InnerBase.DeepEqual(src) { 2441 return false 2442 } 2443 return true 2444 } 2445 func (p *ExampleReq) Field8DeepEqual(src string) bool { 2446 2447 if strings.Compare(p.RawUri, src) != 0 { 2448 return false 2449 } 2450 return true 2451 } 2452 func (p *ExampleReq) Field32767DeepEqual(src float64) bool { 2453 2454 if p.Subfix != src { 2455 return false 2456 } 2457 return true 2458 } 2459 func (p *ExampleReq) Field255DeepEqual(src *base.Base) bool { 2460 2461 if !p.Base.DeepEqual(src) { 2462 return false 2463 } 2464 return true 2465 } 2466 2467 type ExampleResp struct { 2468 Msg string `thrift:"Msg,1" json:"Msg"` 2469 Cookie *float64 `thrift:"Cookie,2" json:"Cookie,omitempty"` 2470 Status int32 `thrift:"Status,3,required" json:"Status"` 2471 Header *bool `thrift:"Header,4" json:"Header,omitempty"` 2472 Code int64 `thrift:"Code,6" json:"code_code"` 2473 Subfix float64 `thrift:"Subfix,32767" json:"Subfix"` 2474 InnerBase *InnerBase `thrift:"InnerBase,7" json:"InnerBase"` 2475 BaseResp *base.BaseResp `thrift:"BaseResp,255" json:"BaseResp"` 2476 } 2477 2478 func NewExampleResp() *ExampleResp { 2479 return &ExampleResp{} 2480 } 2481 2482 func (p *ExampleResp) GetMsg() (v string) { 2483 return p.Msg 2484 } 2485 2486 var ExampleResp_Cookie_DEFAULT float64 2487 2488 func (p *ExampleResp) GetCookie() (v float64) { 2489 if !p.IsSetCookie() { 2490 return ExampleResp_Cookie_DEFAULT 2491 } 2492 return *p.Cookie 2493 } 2494 2495 func (p *ExampleResp) GetStatus() (v int32) { 2496 return p.Status 2497 } 2498 2499 var ExampleResp_Header_DEFAULT bool 2500 2501 func (p *ExampleResp) GetHeader() (v bool) { 2502 if !p.IsSetHeader() { 2503 return ExampleResp_Header_DEFAULT 2504 } 2505 return *p.Header 2506 } 2507 2508 func (p *ExampleResp) GetCode() (v int64) { 2509 return p.Code 2510 } 2511 2512 func (p *ExampleResp) GetSubfix() (v float64) { 2513 return p.Subfix 2514 } 2515 2516 var ExampleResp_InnerBase_DEFAULT *InnerBase 2517 2518 func (p *ExampleResp) GetInnerBase() (v *InnerBase) { 2519 if !p.IsSetInnerBase() { 2520 return ExampleResp_InnerBase_DEFAULT 2521 } 2522 return p.InnerBase 2523 } 2524 2525 var ExampleResp_BaseResp_DEFAULT *base.BaseResp 2526 2527 func (p *ExampleResp) GetBaseResp() (v *base.BaseResp) { 2528 if !p.IsSetBaseResp() { 2529 return ExampleResp_BaseResp_DEFAULT 2530 } 2531 return p.BaseResp 2532 } 2533 func (p *ExampleResp) SetMsg(val string) { 2534 p.Msg = val 2535 } 2536 func (p *ExampleResp) SetCookie(val *float64) { 2537 p.Cookie = val 2538 } 2539 func (p *ExampleResp) SetStatus(val int32) { 2540 p.Status = val 2541 } 2542 func (p *ExampleResp) SetHeader(val *bool) { 2543 p.Header = val 2544 } 2545 func (p *ExampleResp) SetCode(val int64) { 2546 p.Code = val 2547 } 2548 func (p *ExampleResp) SetSubfix(val float64) { 2549 p.Subfix = val 2550 } 2551 func (p *ExampleResp) SetInnerBase(val *InnerBase) { 2552 p.InnerBase = val 2553 } 2554 func (p *ExampleResp) SetBaseResp(val *base.BaseResp) { 2555 p.BaseResp = val 2556 } 2557 2558 var fieldIDToName_ExampleResp = map[int16]string{ 2559 1: "Msg", 2560 2: "Cookie", 2561 3: "Status", 2562 4: "Header", 2563 6: "Code", 2564 32767: "Subfix", 2565 7: "InnerBase", 2566 255: "BaseResp", 2567 } 2568 2569 func (p *ExampleResp) IsSetCookie() bool { 2570 return p.Cookie != nil 2571 } 2572 2573 func (p *ExampleResp) IsSetHeader() bool { 2574 return p.Header != nil 2575 } 2576 2577 func (p *ExampleResp) IsSetInnerBase() bool { 2578 return p.InnerBase != nil 2579 } 2580 2581 func (p *ExampleResp) IsSetBaseResp() bool { 2582 return p.BaseResp != nil 2583 } 2584 2585 func (p *ExampleResp) Read(iprot thrift.TProtocol) (err error) { 2586 2587 var fieldTypeId thrift.TType 2588 var fieldId int16 2589 var issetStatus bool = false 2590 2591 if _, err = iprot.ReadStructBegin(); err != nil { 2592 goto ReadStructBeginError 2593 } 2594 2595 for { 2596 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 2597 if err != nil { 2598 goto ReadFieldBeginError 2599 } 2600 if fieldTypeId == thrift.STOP { 2601 break 2602 } 2603 2604 switch fieldId { 2605 case 1: 2606 if fieldTypeId == thrift.STRING { 2607 if err = p.ReadField1(iprot); err != nil { 2608 goto ReadFieldError 2609 } 2610 } else { 2611 if err = iprot.Skip(fieldTypeId); err != nil { 2612 goto SkipFieldError 2613 } 2614 } 2615 case 2: 2616 if fieldTypeId == thrift.DOUBLE { 2617 if err = p.ReadField2(iprot); err != nil { 2618 goto ReadFieldError 2619 } 2620 } else { 2621 if err = iprot.Skip(fieldTypeId); err != nil { 2622 goto SkipFieldError 2623 } 2624 } 2625 case 3: 2626 if fieldTypeId == thrift.I32 { 2627 if err = p.ReadField3(iprot); err != nil { 2628 goto ReadFieldError 2629 } 2630 issetStatus = true 2631 } else { 2632 if err = iprot.Skip(fieldTypeId); err != nil { 2633 goto SkipFieldError 2634 } 2635 } 2636 case 4: 2637 if fieldTypeId == thrift.BOOL { 2638 if err = p.ReadField4(iprot); err != nil { 2639 goto ReadFieldError 2640 } 2641 } else { 2642 if err = iprot.Skip(fieldTypeId); err != nil { 2643 goto SkipFieldError 2644 } 2645 } 2646 case 6: 2647 if fieldTypeId == thrift.I64 { 2648 if err = p.ReadField6(iprot); err != nil { 2649 goto ReadFieldError 2650 } 2651 } else { 2652 if err = iprot.Skip(fieldTypeId); err != nil { 2653 goto SkipFieldError 2654 } 2655 } 2656 case 32767: 2657 if fieldTypeId == thrift.DOUBLE { 2658 if err = p.ReadField32767(iprot); err != nil { 2659 goto ReadFieldError 2660 } 2661 } else { 2662 if err = iprot.Skip(fieldTypeId); err != nil { 2663 goto SkipFieldError 2664 } 2665 } 2666 case 7: 2667 if fieldTypeId == thrift.STRUCT { 2668 if err = p.ReadField7(iprot); err != nil { 2669 goto ReadFieldError 2670 } 2671 } else { 2672 if err = iprot.Skip(fieldTypeId); err != nil { 2673 goto SkipFieldError 2674 } 2675 } 2676 case 255: 2677 if fieldTypeId == thrift.STRUCT { 2678 if err = p.ReadField255(iprot); err != nil { 2679 goto ReadFieldError 2680 } 2681 } else { 2682 if err = iprot.Skip(fieldTypeId); err != nil { 2683 goto SkipFieldError 2684 } 2685 } 2686 default: 2687 if err = iprot.Skip(fieldTypeId); err != nil { 2688 goto SkipFieldError 2689 } 2690 } 2691 2692 if err = iprot.ReadFieldEnd(); err != nil { 2693 goto ReadFieldEndError 2694 } 2695 } 2696 if err = iprot.ReadStructEnd(); err != nil { 2697 goto ReadStructEndError 2698 } 2699 2700 if !issetStatus { 2701 fieldId = 3 2702 goto RequiredFieldNotSetError 2703 } 2704 return nil 2705 ReadStructBeginError: 2706 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 2707 ReadFieldBeginError: 2708 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 2709 ReadFieldError: 2710 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleResp[fieldId]), err) 2711 SkipFieldError: 2712 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 2713 2714 ReadFieldEndError: 2715 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 2716 ReadStructEndError: 2717 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 2718 RequiredFieldNotSetError: 2719 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field %s is not set", fieldIDToName_ExampleResp[fieldId])) 2720 } 2721 2722 func (p *ExampleResp) ReadField1(iprot thrift.TProtocol) error { 2723 if v, err := iprot.ReadString(); err != nil { 2724 return err 2725 } else { 2726 p.Msg = v 2727 } 2728 return nil 2729 } 2730 2731 func (p *ExampleResp) ReadField2(iprot thrift.TProtocol) error { 2732 if v, err := iprot.ReadDouble(); err != nil { 2733 return err 2734 } else { 2735 p.Cookie = &v 2736 } 2737 return nil 2738 } 2739 2740 func (p *ExampleResp) ReadField3(iprot thrift.TProtocol) error { 2741 if v, err := iprot.ReadI32(); err != nil { 2742 return err 2743 } else { 2744 p.Status = v 2745 } 2746 return nil 2747 } 2748 2749 func (p *ExampleResp) ReadField4(iprot thrift.TProtocol) error { 2750 if v, err := iprot.ReadBool(); err != nil { 2751 return err 2752 } else { 2753 p.Header = &v 2754 } 2755 return nil 2756 } 2757 2758 func (p *ExampleResp) ReadField6(iprot thrift.TProtocol) error { 2759 if v, err := iprot.ReadI64(); err != nil { 2760 return err 2761 } else { 2762 p.Code = v 2763 } 2764 return nil 2765 } 2766 2767 func (p *ExampleResp) ReadField32767(iprot thrift.TProtocol) error { 2768 if v, err := iprot.ReadDouble(); err != nil { 2769 return err 2770 } else { 2771 p.Subfix = v 2772 } 2773 return nil 2774 } 2775 2776 func (p *ExampleResp) ReadField7(iprot thrift.TProtocol) error { 2777 p.InnerBase = NewInnerBase() 2778 if err := p.InnerBase.Read(iprot); err != nil { 2779 return err 2780 } 2781 return nil 2782 } 2783 2784 func (p *ExampleResp) ReadField255(iprot thrift.TProtocol) error { 2785 p.BaseResp = base.NewBaseResp() 2786 if err := p.BaseResp.Read(iprot); err != nil { 2787 return err 2788 } 2789 return nil 2790 } 2791 2792 func (p *ExampleResp) Write(oprot thrift.TProtocol) (err error) { 2793 var fieldId int16 2794 if err = oprot.WriteStructBegin("ExampleResp"); err != nil { 2795 goto WriteStructBeginError 2796 } 2797 if p != nil { 2798 if err = p.writeField1(oprot); err != nil { 2799 fieldId = 1 2800 goto WriteFieldError 2801 } 2802 if err = p.writeField2(oprot); err != nil { 2803 fieldId = 2 2804 goto WriteFieldError 2805 } 2806 if err = p.writeField3(oprot); err != nil { 2807 fieldId = 3 2808 goto WriteFieldError 2809 } 2810 if err = p.writeField4(oprot); err != nil { 2811 fieldId = 4 2812 goto WriteFieldError 2813 } 2814 if err = p.writeField6(oprot); err != nil { 2815 fieldId = 6 2816 goto WriteFieldError 2817 } 2818 if err = p.writeField32767(oprot); err != nil { 2819 fieldId = 32767 2820 goto WriteFieldError 2821 } 2822 if err = p.writeField7(oprot); err != nil { 2823 fieldId = 7 2824 goto WriteFieldError 2825 } 2826 if err = p.writeField255(oprot); err != nil { 2827 fieldId = 255 2828 goto WriteFieldError 2829 } 2830 2831 } 2832 if err = oprot.WriteFieldStop(); err != nil { 2833 goto WriteFieldStopError 2834 } 2835 if err = oprot.WriteStructEnd(); err != nil { 2836 goto WriteStructEndError 2837 } 2838 return nil 2839 WriteStructBeginError: 2840 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 2841 WriteFieldError: 2842 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 2843 WriteFieldStopError: 2844 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 2845 WriteStructEndError: 2846 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 2847 } 2848 2849 func (p *ExampleResp) writeField1(oprot thrift.TProtocol) (err error) { 2850 if err = oprot.WriteFieldBegin("Msg", thrift.STRING, 1); err != nil { 2851 goto WriteFieldBeginError 2852 } 2853 if err := oprot.WriteString(p.Msg); err != nil { 2854 return err 2855 } 2856 if err = oprot.WriteFieldEnd(); err != nil { 2857 goto WriteFieldEndError 2858 } 2859 return nil 2860 WriteFieldBeginError: 2861 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 2862 WriteFieldEndError: 2863 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 2864 } 2865 2866 func (p *ExampleResp) writeField2(oprot thrift.TProtocol) (err error) { 2867 if p.IsSetCookie() { 2868 if err = oprot.WriteFieldBegin("Cookie", thrift.DOUBLE, 2); err != nil { 2869 goto WriteFieldBeginError 2870 } 2871 if err := oprot.WriteDouble(*p.Cookie); err != nil { 2872 return err 2873 } 2874 if err = oprot.WriteFieldEnd(); err != nil { 2875 goto WriteFieldEndError 2876 } 2877 } 2878 return nil 2879 WriteFieldBeginError: 2880 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 2881 WriteFieldEndError: 2882 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 2883 } 2884 2885 func (p *ExampleResp) writeField3(oprot thrift.TProtocol) (err error) { 2886 if err = oprot.WriteFieldBegin("Status", thrift.I32, 3); err != nil { 2887 goto WriteFieldBeginError 2888 } 2889 if err := oprot.WriteI32(p.Status); err != nil { 2890 return err 2891 } 2892 if err = oprot.WriteFieldEnd(); err != nil { 2893 goto WriteFieldEndError 2894 } 2895 return nil 2896 WriteFieldBeginError: 2897 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 2898 WriteFieldEndError: 2899 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 2900 } 2901 2902 func (p *ExampleResp) writeField4(oprot thrift.TProtocol) (err error) { 2903 if p.IsSetHeader() { 2904 if err = oprot.WriteFieldBegin("Header", thrift.BOOL, 4); err != nil { 2905 goto WriteFieldBeginError 2906 } 2907 if err := oprot.WriteBool(*p.Header); err != nil { 2908 return err 2909 } 2910 if err = oprot.WriteFieldEnd(); err != nil { 2911 goto WriteFieldEndError 2912 } 2913 } 2914 return nil 2915 WriteFieldBeginError: 2916 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 2917 WriteFieldEndError: 2918 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 2919 } 2920 2921 func (p *ExampleResp) writeField6(oprot thrift.TProtocol) (err error) { 2922 if err = oprot.WriteFieldBegin("Code", thrift.I64, 6); err != nil { 2923 goto WriteFieldBeginError 2924 } 2925 if err := oprot.WriteI64(p.Code); err != nil { 2926 return err 2927 } 2928 if err = oprot.WriteFieldEnd(); err != nil { 2929 goto WriteFieldEndError 2930 } 2931 return nil 2932 WriteFieldBeginError: 2933 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 2934 WriteFieldEndError: 2935 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 2936 } 2937 2938 func (p *ExampleResp) writeField32767(oprot thrift.TProtocol) (err error) { 2939 if err = oprot.WriteFieldBegin("Subfix", thrift.DOUBLE, 32767); err != nil { 2940 goto WriteFieldBeginError 2941 } 2942 if err := oprot.WriteDouble(p.Subfix); err != nil { 2943 return err 2944 } 2945 if err = oprot.WriteFieldEnd(); err != nil { 2946 goto WriteFieldEndError 2947 } 2948 return nil 2949 WriteFieldBeginError: 2950 return thrift.PrependError(fmt.Sprintf("%T write field 32767 begin error: ", p), err) 2951 WriteFieldEndError: 2952 return thrift.PrependError(fmt.Sprintf("%T write field 32767 end error: ", p), err) 2953 } 2954 2955 func (p *ExampleResp) writeField7(oprot thrift.TProtocol) (err error) { 2956 if err = oprot.WriteFieldBegin("InnerBase", thrift.STRUCT, 7); err != nil { 2957 goto WriteFieldBeginError 2958 } 2959 if err := p.InnerBase.Write(oprot); err != nil { 2960 return err 2961 } 2962 if err = oprot.WriteFieldEnd(); err != nil { 2963 goto WriteFieldEndError 2964 } 2965 return nil 2966 WriteFieldBeginError: 2967 return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) 2968 WriteFieldEndError: 2969 return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) 2970 } 2971 2972 func (p *ExampleResp) writeField255(oprot thrift.TProtocol) (err error) { 2973 if err = oprot.WriteFieldBegin("BaseResp", thrift.STRUCT, 255); err != nil { 2974 goto WriteFieldBeginError 2975 } 2976 if err := p.BaseResp.Write(oprot); err != nil { 2977 return err 2978 } 2979 if err = oprot.WriteFieldEnd(); err != nil { 2980 goto WriteFieldEndError 2981 } 2982 return nil 2983 WriteFieldBeginError: 2984 return thrift.PrependError(fmt.Sprintf("%T write field 255 begin error: ", p), err) 2985 WriteFieldEndError: 2986 return thrift.PrependError(fmt.Sprintf("%T write field 255 end error: ", p), err) 2987 } 2988 2989 func (p *ExampleResp) String() string { 2990 if p == nil { 2991 return "<nil>" 2992 } 2993 return fmt.Sprintf("ExampleResp(%+v)", *p) 2994 } 2995 2996 func (p *ExampleResp) DeepEqual(ano *ExampleResp) bool { 2997 if p == ano { 2998 return true 2999 } else if p == nil || ano == nil { 3000 return false 3001 } 3002 if !p.Field1DeepEqual(ano.Msg) { 3003 return false 3004 } 3005 if !p.Field2DeepEqual(ano.Cookie) { 3006 return false 3007 } 3008 if !p.Field3DeepEqual(ano.Status) { 3009 return false 3010 } 3011 if !p.Field4DeepEqual(ano.Header) { 3012 return false 3013 } 3014 if !p.Field6DeepEqual(ano.Code) { 3015 return false 3016 } 3017 if !p.Field32767DeepEqual(ano.Subfix) { 3018 return false 3019 } 3020 if !p.Field7DeepEqual(ano.InnerBase) { 3021 return false 3022 } 3023 if !p.Field255DeepEqual(ano.BaseResp) { 3024 return false 3025 } 3026 return true 3027 } 3028 3029 func (p *ExampleResp) Field1DeepEqual(src string) bool { 3030 3031 if strings.Compare(p.Msg, src) != 0 { 3032 return false 3033 } 3034 return true 3035 } 3036 func (p *ExampleResp) Field2DeepEqual(src *float64) bool { 3037 3038 if p.Cookie == src { 3039 return true 3040 } else if p.Cookie == nil || src == nil { 3041 return false 3042 } 3043 if *p.Cookie != *src { 3044 return false 3045 } 3046 return true 3047 } 3048 func (p *ExampleResp) Field3DeepEqual(src int32) bool { 3049 3050 if p.Status != src { 3051 return false 3052 } 3053 return true 3054 } 3055 func (p *ExampleResp) Field4DeepEqual(src *bool) bool { 3056 3057 if p.Header == src { 3058 return true 3059 } else if p.Header == nil || src == nil { 3060 return false 3061 } 3062 if *p.Header != *src { 3063 return false 3064 } 3065 return true 3066 } 3067 func (p *ExampleResp) Field6DeepEqual(src int64) bool { 3068 3069 if p.Code != src { 3070 return false 3071 } 3072 return true 3073 } 3074 func (p *ExampleResp) Field32767DeepEqual(src float64) bool { 3075 3076 if p.Subfix != src { 3077 return false 3078 } 3079 return true 3080 } 3081 func (p *ExampleResp) Field7DeepEqual(src *InnerBase) bool { 3082 3083 if !p.InnerBase.DeepEqual(src) { 3084 return false 3085 } 3086 return true 3087 } 3088 func (p *ExampleResp) Field255DeepEqual(src *base.BaseResp) bool { 3089 3090 if !p.BaseResp.DeepEqual(src) { 3091 return false 3092 } 3093 return true 3094 } 3095 3096 type ExampleError struct { 3097 MapInnerBaseInnerBase map[*InnerBase]*InnerBase `thrift:"MapInnerBaseInnerBase,1" json:"MapInnerBaseInnerBase"` 3098 Base64 []byte `thrift:"Base64,2" json:"Base64"` 3099 Query string `thrift:"Query,3,required" json:"Query"` 3100 Header string `thrift:"Header,4" json:"Header"` 3101 Q2 int32 `thrift:"Q2,5" json:"Q2"` 3102 } 3103 3104 func NewExampleError() *ExampleError { 3105 return &ExampleError{} 3106 } 3107 3108 func (p *ExampleError) GetMapInnerBaseInnerBase() (v map[*InnerBase]*InnerBase) { 3109 return p.MapInnerBaseInnerBase 3110 } 3111 3112 func (p *ExampleError) GetBase64() (v []byte) { 3113 return p.Base64 3114 } 3115 3116 func (p *ExampleError) GetQuery() (v string) { 3117 return p.Query 3118 } 3119 3120 func (p *ExampleError) GetHeader() (v string) { 3121 return p.Header 3122 } 3123 3124 func (p *ExampleError) GetQ2() (v int32) { 3125 return p.Q2 3126 } 3127 func (p *ExampleError) SetMapInnerBaseInnerBase(val map[*InnerBase]*InnerBase) { 3128 p.MapInnerBaseInnerBase = val 3129 } 3130 func (p *ExampleError) SetBase64(val []byte) { 3131 p.Base64 = val 3132 } 3133 func (p *ExampleError) SetQuery(val string) { 3134 p.Query = val 3135 } 3136 func (p *ExampleError) SetHeader(val string) { 3137 p.Header = val 3138 } 3139 func (p *ExampleError) SetQ2(val int32) { 3140 p.Q2 = val 3141 } 3142 3143 var fieldIDToName_ExampleError = map[int16]string{ 3144 1: "MapInnerBaseInnerBase", 3145 2: "Base64", 3146 3: "Query", 3147 4: "Header", 3148 5: "Q2", 3149 } 3150 3151 func (p *ExampleError) Read(iprot thrift.TProtocol) (err error) { 3152 3153 var fieldTypeId thrift.TType 3154 var fieldId int16 3155 var issetQuery bool = false 3156 3157 if _, err = iprot.ReadStructBegin(); err != nil { 3158 goto ReadStructBeginError 3159 } 3160 3161 for { 3162 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 3163 if err != nil { 3164 goto ReadFieldBeginError 3165 } 3166 if fieldTypeId == thrift.STOP { 3167 break 3168 } 3169 3170 switch fieldId { 3171 case 1: 3172 if fieldTypeId == thrift.MAP { 3173 if err = p.ReadField1(iprot); err != nil { 3174 goto ReadFieldError 3175 } 3176 } else { 3177 if err = iprot.Skip(fieldTypeId); err != nil { 3178 goto SkipFieldError 3179 } 3180 } 3181 case 2: 3182 if fieldTypeId == thrift.STRING { 3183 if err = p.ReadField2(iprot); err != nil { 3184 goto ReadFieldError 3185 } 3186 } else { 3187 if err = iprot.Skip(fieldTypeId); err != nil { 3188 goto SkipFieldError 3189 } 3190 } 3191 case 3: 3192 if fieldTypeId == thrift.STRING { 3193 if err = p.ReadField3(iprot); err != nil { 3194 goto ReadFieldError 3195 } 3196 issetQuery = true 3197 } else { 3198 if err = iprot.Skip(fieldTypeId); err != nil { 3199 goto SkipFieldError 3200 } 3201 } 3202 case 4: 3203 if fieldTypeId == thrift.STRING { 3204 if err = p.ReadField4(iprot); err != nil { 3205 goto ReadFieldError 3206 } 3207 } else { 3208 if err = iprot.Skip(fieldTypeId); err != nil { 3209 goto SkipFieldError 3210 } 3211 } 3212 case 5: 3213 if fieldTypeId == thrift.I32 { 3214 if err = p.ReadField5(iprot); err != nil { 3215 goto ReadFieldError 3216 } 3217 } else { 3218 if err = iprot.Skip(fieldTypeId); err != nil { 3219 goto SkipFieldError 3220 } 3221 } 3222 default: 3223 if err = iprot.Skip(fieldTypeId); err != nil { 3224 goto SkipFieldError 3225 } 3226 } 3227 3228 if err = iprot.ReadFieldEnd(); err != nil { 3229 goto ReadFieldEndError 3230 } 3231 } 3232 if err = iprot.ReadStructEnd(); err != nil { 3233 goto ReadStructEndError 3234 } 3235 3236 if !issetQuery { 3237 fieldId = 3 3238 goto RequiredFieldNotSetError 3239 } 3240 return nil 3241 ReadStructBeginError: 3242 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3243 ReadFieldBeginError: 3244 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3245 ReadFieldError: 3246 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleError[fieldId]), err) 3247 SkipFieldError: 3248 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3249 3250 ReadFieldEndError: 3251 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3252 ReadStructEndError: 3253 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3254 RequiredFieldNotSetError: 3255 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field %s is not set", fieldIDToName_ExampleError[fieldId])) 3256 } 3257 3258 func (p *ExampleError) ReadField1(iprot thrift.TProtocol) error { 3259 _, _, size, err := iprot.ReadMapBegin() 3260 if err != nil { 3261 return err 3262 } 3263 p.MapInnerBaseInnerBase = make(map[*InnerBase]*InnerBase, size) 3264 for i := 0; i < size; i++ { 3265 _key := NewInnerBase() 3266 if err := _key.Read(iprot); err != nil { 3267 return err 3268 } 3269 _val := NewInnerBase() 3270 if err := _val.Read(iprot); err != nil { 3271 return err 3272 } 3273 3274 p.MapInnerBaseInnerBase[_key] = _val 3275 } 3276 if err := iprot.ReadMapEnd(); err != nil { 3277 return err 3278 } 3279 return nil 3280 } 3281 3282 func (p *ExampleError) ReadField2(iprot thrift.TProtocol) error { 3283 if v, err := iprot.ReadBinary(); err != nil { 3284 return err 3285 } else { 3286 p.Base64 = []byte(v) 3287 } 3288 return nil 3289 } 3290 3291 func (p *ExampleError) ReadField3(iprot thrift.TProtocol) error { 3292 if v, err := iprot.ReadString(); err != nil { 3293 return err 3294 } else { 3295 p.Query = v 3296 } 3297 return nil 3298 } 3299 3300 func (p *ExampleError) ReadField4(iprot thrift.TProtocol) error { 3301 if v, err := iprot.ReadString(); err != nil { 3302 return err 3303 } else { 3304 p.Header = v 3305 } 3306 return nil 3307 } 3308 3309 func (p *ExampleError) ReadField5(iprot thrift.TProtocol) error { 3310 if v, err := iprot.ReadI32(); err != nil { 3311 return err 3312 } else { 3313 p.Q2 = v 3314 } 3315 return nil 3316 } 3317 3318 func (p *ExampleError) Write(oprot thrift.TProtocol) (err error) { 3319 var fieldId int16 3320 if err = oprot.WriteStructBegin("ExampleError"); err != nil { 3321 goto WriteStructBeginError 3322 } 3323 if p != nil { 3324 if err = p.writeField1(oprot); err != nil { 3325 fieldId = 1 3326 goto WriteFieldError 3327 } 3328 if err = p.writeField2(oprot); err != nil { 3329 fieldId = 2 3330 goto WriteFieldError 3331 } 3332 if err = p.writeField3(oprot); err != nil { 3333 fieldId = 3 3334 goto WriteFieldError 3335 } 3336 if err = p.writeField4(oprot); err != nil { 3337 fieldId = 4 3338 goto WriteFieldError 3339 } 3340 if err = p.writeField5(oprot); err != nil { 3341 fieldId = 5 3342 goto WriteFieldError 3343 } 3344 3345 } 3346 if err = oprot.WriteFieldStop(); err != nil { 3347 goto WriteFieldStopError 3348 } 3349 if err = oprot.WriteStructEnd(); err != nil { 3350 goto WriteStructEndError 3351 } 3352 return nil 3353 WriteStructBeginError: 3354 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 3355 WriteFieldError: 3356 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 3357 WriteFieldStopError: 3358 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 3359 WriteStructEndError: 3360 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 3361 } 3362 3363 func (p *ExampleError) writeField1(oprot thrift.TProtocol) (err error) { 3364 if err = oprot.WriteFieldBegin("MapInnerBaseInnerBase", thrift.MAP, 1); err != nil { 3365 goto WriteFieldBeginError 3366 } 3367 if err := oprot.WriteMapBegin(thrift.STRUCT, thrift.STRUCT, len(p.MapInnerBaseInnerBase)); err != nil { 3368 return err 3369 } 3370 for k, v := range p.MapInnerBaseInnerBase { 3371 3372 if err := k.Write(oprot); err != nil { 3373 return err 3374 } 3375 3376 if err := v.Write(oprot); err != nil { 3377 return err 3378 } 3379 } 3380 if err := oprot.WriteMapEnd(); err != nil { 3381 return err 3382 } 3383 if err = oprot.WriteFieldEnd(); err != nil { 3384 goto WriteFieldEndError 3385 } 3386 return nil 3387 WriteFieldBeginError: 3388 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 3389 WriteFieldEndError: 3390 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 3391 } 3392 3393 func (p *ExampleError) writeField2(oprot thrift.TProtocol) (err error) { 3394 if err = oprot.WriteFieldBegin("Base64", thrift.STRING, 2); err != nil { 3395 goto WriteFieldBeginError 3396 } 3397 if err := oprot.WriteBinary([]byte(p.Base64)); err != nil { 3398 return err 3399 } 3400 if err = oprot.WriteFieldEnd(); err != nil { 3401 goto WriteFieldEndError 3402 } 3403 return nil 3404 WriteFieldBeginError: 3405 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 3406 WriteFieldEndError: 3407 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 3408 } 3409 3410 func (p *ExampleError) writeField3(oprot thrift.TProtocol) (err error) { 3411 if err = oprot.WriteFieldBegin("Query", thrift.STRING, 3); err != nil { 3412 goto WriteFieldBeginError 3413 } 3414 if err := oprot.WriteString(p.Query); err != nil { 3415 return err 3416 } 3417 if err = oprot.WriteFieldEnd(); err != nil { 3418 goto WriteFieldEndError 3419 } 3420 return nil 3421 WriteFieldBeginError: 3422 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 3423 WriteFieldEndError: 3424 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 3425 } 3426 3427 func (p *ExampleError) writeField4(oprot thrift.TProtocol) (err error) { 3428 if err = oprot.WriteFieldBegin("Header", thrift.STRING, 4); err != nil { 3429 goto WriteFieldBeginError 3430 } 3431 if err := oprot.WriteString(p.Header); err != nil { 3432 return err 3433 } 3434 if err = oprot.WriteFieldEnd(); err != nil { 3435 goto WriteFieldEndError 3436 } 3437 return nil 3438 WriteFieldBeginError: 3439 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 3440 WriteFieldEndError: 3441 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 3442 } 3443 3444 func (p *ExampleError) writeField5(oprot thrift.TProtocol) (err error) { 3445 if err = oprot.WriteFieldBegin("Q2", thrift.I32, 5); err != nil { 3446 goto WriteFieldBeginError 3447 } 3448 if err := oprot.WriteI32(p.Q2); err != nil { 3449 return err 3450 } 3451 if err = oprot.WriteFieldEnd(); err != nil { 3452 goto WriteFieldEndError 3453 } 3454 return nil 3455 WriteFieldBeginError: 3456 return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) 3457 WriteFieldEndError: 3458 return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) 3459 } 3460 3461 func (p *ExampleError) String() string { 3462 if p == nil { 3463 return "<nil>" 3464 } 3465 return fmt.Sprintf("ExampleError(%+v)", *p) 3466 } 3467 3468 func (p *ExampleError) DeepEqual(ano *ExampleError) bool { 3469 if p == ano { 3470 return true 3471 } else if p == nil || ano == nil { 3472 return false 3473 } 3474 if !p.Field1DeepEqual(ano.MapInnerBaseInnerBase) { 3475 return false 3476 } 3477 if !p.Field2DeepEqual(ano.Base64) { 3478 return false 3479 } 3480 if !p.Field3DeepEqual(ano.Query) { 3481 return false 3482 } 3483 if !p.Field4DeepEqual(ano.Header) { 3484 return false 3485 } 3486 if !p.Field5DeepEqual(ano.Q2) { 3487 return false 3488 } 3489 return true 3490 } 3491 3492 func (p *ExampleError) Field1DeepEqual(src map[*InnerBase]*InnerBase) bool { 3493 3494 if len(p.MapInnerBaseInnerBase) != len(src) { 3495 return false 3496 } 3497 for k, v := range p.MapInnerBaseInnerBase { 3498 _src := src[k] 3499 if !v.DeepEqual(_src) { 3500 return false 3501 } 3502 } 3503 return true 3504 } 3505 func (p *ExampleError) Field2DeepEqual(src []byte) bool { 3506 3507 if bytes.Compare(p.Base64, src) != 0 { 3508 return false 3509 } 3510 return true 3511 } 3512 func (p *ExampleError) Field3DeepEqual(src string) bool { 3513 3514 if strings.Compare(p.Query, src) != 0 { 3515 return false 3516 } 3517 return true 3518 } 3519 func (p *ExampleError) Field4DeepEqual(src string) bool { 3520 3521 if strings.Compare(p.Header, src) != 0 { 3522 return false 3523 } 3524 return true 3525 } 3526 func (p *ExampleError) Field5DeepEqual(src int32) bool { 3527 3528 if p.Q2 != src { 3529 return false 3530 } 3531 return true 3532 } 3533 3534 type ExampleErrorResp struct { 3535 Int64 int64 `thrift:"Int64,2" json:"Int64"` 3536 Xjson string `thrift:"Xjson,4" json:"Xjson"` 3537 } 3538 3539 func NewExampleErrorResp() *ExampleErrorResp { 3540 return &ExampleErrorResp{} 3541 } 3542 3543 func (p *ExampleErrorResp) GetInt64() (v int64) { 3544 return p.Int64 3545 } 3546 3547 func (p *ExampleErrorResp) GetXjson() (v string) { 3548 return p.Xjson 3549 } 3550 func (p *ExampleErrorResp) SetInt64(val int64) { 3551 p.Int64 = val 3552 } 3553 func (p *ExampleErrorResp) SetXjson(val string) { 3554 p.Xjson = val 3555 } 3556 3557 var fieldIDToName_ExampleErrorResp = map[int16]string{ 3558 2: "Int64", 3559 4: "Xjson", 3560 } 3561 3562 func (p *ExampleErrorResp) Read(iprot thrift.TProtocol) (err error) { 3563 3564 var fieldTypeId thrift.TType 3565 var fieldId int16 3566 3567 if _, err = iprot.ReadStructBegin(); err != nil { 3568 goto ReadStructBeginError 3569 } 3570 3571 for { 3572 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 3573 if err != nil { 3574 goto ReadFieldBeginError 3575 } 3576 if fieldTypeId == thrift.STOP { 3577 break 3578 } 3579 3580 switch fieldId { 3581 case 2: 3582 if fieldTypeId == thrift.I64 { 3583 if err = p.ReadField2(iprot); err != nil { 3584 goto ReadFieldError 3585 } 3586 } else { 3587 if err = iprot.Skip(fieldTypeId); err != nil { 3588 goto SkipFieldError 3589 } 3590 } 3591 case 4: 3592 if fieldTypeId == thrift.STRING { 3593 if err = p.ReadField4(iprot); err != nil { 3594 goto ReadFieldError 3595 } 3596 } else { 3597 if err = iprot.Skip(fieldTypeId); err != nil { 3598 goto SkipFieldError 3599 } 3600 } 3601 default: 3602 if err = iprot.Skip(fieldTypeId); err != nil { 3603 goto SkipFieldError 3604 } 3605 } 3606 3607 if err = iprot.ReadFieldEnd(); err != nil { 3608 goto ReadFieldEndError 3609 } 3610 } 3611 if err = iprot.ReadStructEnd(); err != nil { 3612 goto ReadStructEndError 3613 } 3614 3615 return nil 3616 ReadStructBeginError: 3617 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3618 ReadFieldBeginError: 3619 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3620 ReadFieldError: 3621 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleErrorResp[fieldId]), err) 3622 SkipFieldError: 3623 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3624 3625 ReadFieldEndError: 3626 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3627 ReadStructEndError: 3628 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3629 } 3630 3631 func (p *ExampleErrorResp) ReadField2(iprot thrift.TProtocol) error { 3632 if v, err := iprot.ReadI64(); err != nil { 3633 return err 3634 } else { 3635 p.Int64 = v 3636 } 3637 return nil 3638 } 3639 3640 func (p *ExampleErrorResp) ReadField4(iprot thrift.TProtocol) error { 3641 if v, err := iprot.ReadString(); err != nil { 3642 return err 3643 } else { 3644 p.Xjson = v 3645 } 3646 return nil 3647 } 3648 3649 func (p *ExampleErrorResp) Write(oprot thrift.TProtocol) (err error) { 3650 var fieldId int16 3651 if err = oprot.WriteStructBegin("ExampleErrorResp"); err != nil { 3652 goto WriteStructBeginError 3653 } 3654 if p != nil { 3655 if err = p.writeField2(oprot); err != nil { 3656 fieldId = 2 3657 goto WriteFieldError 3658 } 3659 if err = p.writeField4(oprot); err != nil { 3660 fieldId = 4 3661 goto WriteFieldError 3662 } 3663 3664 } 3665 if err = oprot.WriteFieldStop(); err != nil { 3666 goto WriteFieldStopError 3667 } 3668 if err = oprot.WriteStructEnd(); err != nil { 3669 goto WriteStructEndError 3670 } 3671 return nil 3672 WriteStructBeginError: 3673 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 3674 WriteFieldError: 3675 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 3676 WriteFieldStopError: 3677 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 3678 WriteStructEndError: 3679 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 3680 } 3681 3682 func (p *ExampleErrorResp) writeField2(oprot thrift.TProtocol) (err error) { 3683 if err = oprot.WriteFieldBegin("Int64", thrift.I64, 2); err != nil { 3684 goto WriteFieldBeginError 3685 } 3686 if err := oprot.WriteI64(p.Int64); err != nil { 3687 return err 3688 } 3689 if err = oprot.WriteFieldEnd(); err != nil { 3690 goto WriteFieldEndError 3691 } 3692 return nil 3693 WriteFieldBeginError: 3694 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 3695 WriteFieldEndError: 3696 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 3697 } 3698 3699 func (p *ExampleErrorResp) writeField4(oprot thrift.TProtocol) (err error) { 3700 if err = oprot.WriteFieldBegin("Xjson", thrift.STRING, 4); err != nil { 3701 goto WriteFieldBeginError 3702 } 3703 if err := oprot.WriteString(p.Xjson); err != nil { 3704 return err 3705 } 3706 if err = oprot.WriteFieldEnd(); err != nil { 3707 goto WriteFieldEndError 3708 } 3709 return nil 3710 WriteFieldBeginError: 3711 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 3712 WriteFieldEndError: 3713 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 3714 } 3715 3716 func (p *ExampleErrorResp) String() string { 3717 if p == nil { 3718 return "<nil>" 3719 } 3720 return fmt.Sprintf("ExampleErrorResp(%+v)", *p) 3721 } 3722 3723 func (p *ExampleErrorResp) DeepEqual(ano *ExampleErrorResp) bool { 3724 if p == ano { 3725 return true 3726 } else if p == nil || ano == nil { 3727 return false 3728 } 3729 if !p.Field2DeepEqual(ano.Int64) { 3730 return false 3731 } 3732 if !p.Field4DeepEqual(ano.Xjson) { 3733 return false 3734 } 3735 return true 3736 } 3737 3738 func (p *ExampleErrorResp) Field2DeepEqual(src int64) bool { 3739 3740 if p.Int64 != src { 3741 return false 3742 } 3743 return true 3744 } 3745 func (p *ExampleErrorResp) Field4DeepEqual(src string) bool { 3746 3747 if strings.Compare(p.Xjson, src) != 0 { 3748 return false 3749 } 3750 return true 3751 } 3752 3753 type ExampleInt2Float struct { 3754 Int32 int32 `thrift:"Int32,1" json:"Int32"` 3755 Float64 float64 `thrift:"Float64,2" json:"Float64"` 3756 String_ string `thrift:"String,3" json:"䏿–‡"` 3757 Int64 int64 `thrift:"Int64,4" json:"Int64"` 3758 Subfix float64 `thrift:"Subfix,32767" json:"Subfix"` 3759 } 3760 3761 func NewExampleInt2Float() *ExampleInt2Float { 3762 return &ExampleInt2Float{} 3763 } 3764 3765 func (p *ExampleInt2Float) GetInt32() (v int32) { 3766 return p.Int32 3767 } 3768 3769 func (p *ExampleInt2Float) GetFloat64() (v float64) { 3770 return p.Float64 3771 } 3772 3773 func (p *ExampleInt2Float) GetString() (v string) { 3774 return p.String_ 3775 } 3776 3777 func (p *ExampleInt2Float) GetInt64() (v int64) { 3778 return p.Int64 3779 } 3780 3781 func (p *ExampleInt2Float) GetSubfix() (v float64) { 3782 return p.Subfix 3783 } 3784 func (p *ExampleInt2Float) SetInt32(val int32) { 3785 p.Int32 = val 3786 } 3787 func (p *ExampleInt2Float) SetFloat64(val float64) { 3788 p.Float64 = val 3789 } 3790 func (p *ExampleInt2Float) SetString(val string) { 3791 p.String_ = val 3792 } 3793 func (p *ExampleInt2Float) SetInt64(val int64) { 3794 p.Int64 = val 3795 } 3796 func (p *ExampleInt2Float) SetSubfix(val float64) { 3797 p.Subfix = val 3798 } 3799 3800 var fieldIDToName_ExampleInt2Float = map[int16]string{ 3801 1: "Int32", 3802 2: "Float64", 3803 3: "String", 3804 4: "Int64", 3805 32767: "Subfix", 3806 } 3807 3808 func (p *ExampleInt2Float) Read(iprot thrift.TProtocol) (err error) { 3809 3810 var fieldTypeId thrift.TType 3811 var fieldId int16 3812 3813 if _, err = iprot.ReadStructBegin(); err != nil { 3814 goto ReadStructBeginError 3815 } 3816 3817 for { 3818 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 3819 if err != nil { 3820 goto ReadFieldBeginError 3821 } 3822 if fieldTypeId == thrift.STOP { 3823 break 3824 } 3825 3826 switch fieldId { 3827 case 1: 3828 if fieldTypeId == thrift.I32 { 3829 if err = p.ReadField1(iprot); err != nil { 3830 goto ReadFieldError 3831 } 3832 } else { 3833 if err = iprot.Skip(fieldTypeId); err != nil { 3834 goto SkipFieldError 3835 } 3836 } 3837 case 2: 3838 if fieldTypeId == thrift.DOUBLE { 3839 if err = p.ReadField2(iprot); err != nil { 3840 goto ReadFieldError 3841 } 3842 } else { 3843 if err = iprot.Skip(fieldTypeId); err != nil { 3844 goto SkipFieldError 3845 } 3846 } 3847 case 3: 3848 if fieldTypeId == thrift.STRING { 3849 if err = p.ReadField3(iprot); err != nil { 3850 goto ReadFieldError 3851 } 3852 } else { 3853 if err = iprot.Skip(fieldTypeId); err != nil { 3854 goto SkipFieldError 3855 } 3856 } 3857 case 4: 3858 if fieldTypeId == thrift.I64 { 3859 if err = p.ReadField4(iprot); err != nil { 3860 goto ReadFieldError 3861 } 3862 } else { 3863 if err = iprot.Skip(fieldTypeId); err != nil { 3864 goto SkipFieldError 3865 } 3866 } 3867 case 32767: 3868 if fieldTypeId == thrift.DOUBLE { 3869 if err = p.ReadField32767(iprot); err != nil { 3870 goto ReadFieldError 3871 } 3872 } else { 3873 if err = iprot.Skip(fieldTypeId); err != nil { 3874 goto SkipFieldError 3875 } 3876 } 3877 default: 3878 if err = iprot.Skip(fieldTypeId); err != nil { 3879 goto SkipFieldError 3880 } 3881 } 3882 3883 if err = iprot.ReadFieldEnd(); err != nil { 3884 goto ReadFieldEndError 3885 } 3886 } 3887 if err = iprot.ReadStructEnd(); err != nil { 3888 goto ReadStructEndError 3889 } 3890 3891 return nil 3892 ReadStructBeginError: 3893 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 3894 ReadFieldBeginError: 3895 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 3896 ReadFieldError: 3897 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleInt2Float[fieldId]), err) 3898 SkipFieldError: 3899 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 3900 3901 ReadFieldEndError: 3902 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 3903 ReadStructEndError: 3904 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 3905 } 3906 3907 func (p *ExampleInt2Float) ReadField1(iprot thrift.TProtocol) error { 3908 if v, err := iprot.ReadI32(); err != nil { 3909 return err 3910 } else { 3911 p.Int32 = v 3912 } 3913 return nil 3914 } 3915 3916 func (p *ExampleInt2Float) ReadField2(iprot thrift.TProtocol) error { 3917 if v, err := iprot.ReadDouble(); err != nil { 3918 return err 3919 } else { 3920 p.Float64 = v 3921 } 3922 return nil 3923 } 3924 3925 func (p *ExampleInt2Float) ReadField3(iprot thrift.TProtocol) error { 3926 if v, err := iprot.ReadString(); err != nil { 3927 return err 3928 } else { 3929 p.String_ = v 3930 } 3931 return nil 3932 } 3933 3934 func (p *ExampleInt2Float) ReadField4(iprot thrift.TProtocol) error { 3935 if v, err := iprot.ReadI64(); err != nil { 3936 return err 3937 } else { 3938 p.Int64 = v 3939 } 3940 return nil 3941 } 3942 3943 func (p *ExampleInt2Float) ReadField32767(iprot thrift.TProtocol) error { 3944 if v, err := iprot.ReadDouble(); err != nil { 3945 return err 3946 } else { 3947 p.Subfix = v 3948 } 3949 return nil 3950 } 3951 3952 func (p *ExampleInt2Float) Write(oprot thrift.TProtocol) (err error) { 3953 var fieldId int16 3954 if err = oprot.WriteStructBegin("ExampleInt2Float"); err != nil { 3955 goto WriteStructBeginError 3956 } 3957 if p != nil { 3958 if err = p.writeField1(oprot); err != nil { 3959 fieldId = 1 3960 goto WriteFieldError 3961 } 3962 if err = p.writeField2(oprot); err != nil { 3963 fieldId = 2 3964 goto WriteFieldError 3965 } 3966 if err = p.writeField3(oprot); err != nil { 3967 fieldId = 3 3968 goto WriteFieldError 3969 } 3970 if err = p.writeField4(oprot); err != nil { 3971 fieldId = 4 3972 goto WriteFieldError 3973 } 3974 if err = p.writeField32767(oprot); err != nil { 3975 fieldId = 32767 3976 goto WriteFieldError 3977 } 3978 3979 } 3980 if err = oprot.WriteFieldStop(); err != nil { 3981 goto WriteFieldStopError 3982 } 3983 if err = oprot.WriteStructEnd(); err != nil { 3984 goto WriteStructEndError 3985 } 3986 return nil 3987 WriteStructBeginError: 3988 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 3989 WriteFieldError: 3990 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 3991 WriteFieldStopError: 3992 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 3993 WriteStructEndError: 3994 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 3995 } 3996 3997 func (p *ExampleInt2Float) writeField1(oprot thrift.TProtocol) (err error) { 3998 if err = oprot.WriteFieldBegin("Int32", thrift.I32, 1); err != nil { 3999 goto WriteFieldBeginError 4000 } 4001 if err := oprot.WriteI32(p.Int32); err != nil { 4002 return err 4003 } 4004 if err = oprot.WriteFieldEnd(); err != nil { 4005 goto WriteFieldEndError 4006 } 4007 return nil 4008 WriteFieldBeginError: 4009 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 4010 WriteFieldEndError: 4011 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 4012 } 4013 4014 func (p *ExampleInt2Float) writeField2(oprot thrift.TProtocol) (err error) { 4015 if err = oprot.WriteFieldBegin("Float64", thrift.DOUBLE, 2); err != nil { 4016 goto WriteFieldBeginError 4017 } 4018 if err := oprot.WriteDouble(p.Float64); err != nil { 4019 return err 4020 } 4021 if err = oprot.WriteFieldEnd(); err != nil { 4022 goto WriteFieldEndError 4023 } 4024 return nil 4025 WriteFieldBeginError: 4026 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 4027 WriteFieldEndError: 4028 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 4029 } 4030 4031 func (p *ExampleInt2Float) writeField3(oprot thrift.TProtocol) (err error) { 4032 if err = oprot.WriteFieldBegin("String", thrift.STRING, 3); err != nil { 4033 goto WriteFieldBeginError 4034 } 4035 if err := oprot.WriteString(p.String_); err != nil { 4036 return err 4037 } 4038 if err = oprot.WriteFieldEnd(); err != nil { 4039 goto WriteFieldEndError 4040 } 4041 return nil 4042 WriteFieldBeginError: 4043 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 4044 WriteFieldEndError: 4045 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 4046 } 4047 4048 func (p *ExampleInt2Float) writeField4(oprot thrift.TProtocol) (err error) { 4049 if err = oprot.WriteFieldBegin("Int64", thrift.I64, 4); err != nil { 4050 goto WriteFieldBeginError 4051 } 4052 if err := oprot.WriteI64(p.Int64); err != nil { 4053 return err 4054 } 4055 if err = oprot.WriteFieldEnd(); err != nil { 4056 goto WriteFieldEndError 4057 } 4058 return nil 4059 WriteFieldBeginError: 4060 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 4061 WriteFieldEndError: 4062 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 4063 } 4064 4065 func (p *ExampleInt2Float) writeField32767(oprot thrift.TProtocol) (err error) { 4066 if err = oprot.WriteFieldBegin("Subfix", thrift.DOUBLE, 32767); err != nil { 4067 goto WriteFieldBeginError 4068 } 4069 if err := oprot.WriteDouble(p.Subfix); err != nil { 4070 return err 4071 } 4072 if err = oprot.WriteFieldEnd(); err != nil { 4073 goto WriteFieldEndError 4074 } 4075 return nil 4076 WriteFieldBeginError: 4077 return thrift.PrependError(fmt.Sprintf("%T write field 32767 begin error: ", p), err) 4078 WriteFieldEndError: 4079 return thrift.PrependError(fmt.Sprintf("%T write field 32767 end error: ", p), err) 4080 } 4081 4082 func (p *ExampleInt2Float) String() string { 4083 if p == nil { 4084 return "<nil>" 4085 } 4086 return fmt.Sprintf("ExampleInt2Float(%+v)", *p) 4087 } 4088 4089 func (p *ExampleInt2Float) DeepEqual(ano *ExampleInt2Float) bool { 4090 if p == ano { 4091 return true 4092 } else if p == nil || ano == nil { 4093 return false 4094 } 4095 if !p.Field1DeepEqual(ano.Int32) { 4096 return false 4097 } 4098 if !p.Field2DeepEqual(ano.Float64) { 4099 return false 4100 } 4101 if !p.Field3DeepEqual(ano.String_) { 4102 return false 4103 } 4104 if !p.Field4DeepEqual(ano.Int64) { 4105 return false 4106 } 4107 if !p.Field32767DeepEqual(ano.Subfix) { 4108 return false 4109 } 4110 return true 4111 } 4112 4113 func (p *ExampleInt2Float) Field1DeepEqual(src int32) bool { 4114 4115 if p.Int32 != src { 4116 return false 4117 } 4118 return true 4119 } 4120 func (p *ExampleInt2Float) Field2DeepEqual(src float64) bool { 4121 4122 if p.Float64 != src { 4123 return false 4124 } 4125 return true 4126 } 4127 func (p *ExampleInt2Float) Field3DeepEqual(src string) bool { 4128 4129 if strings.Compare(p.String_, src) != 0 { 4130 return false 4131 } 4132 return true 4133 } 4134 func (p *ExampleInt2Float) Field4DeepEqual(src int64) bool { 4135 4136 if p.Int64 != src { 4137 return false 4138 } 4139 return true 4140 } 4141 func (p *ExampleInt2Float) Field32767DeepEqual(src float64) bool { 4142 4143 if p.Subfix != src { 4144 return false 4145 } 4146 return true 4147 } 4148 4149 type JSONObject struct { 4150 A string `thrift:"A,1" json:"a"` 4151 B int8 `thrift:"B,2" json:"b"` 4152 } 4153 4154 func NewJSONObject() *JSONObject { 4155 return &JSONObject{} 4156 } 4157 4158 func (p *JSONObject) GetA() (v string) { 4159 return p.A 4160 } 4161 4162 func (p *JSONObject) GetB() (v int8) { 4163 return p.B 4164 } 4165 func (p *JSONObject) SetA(val string) { 4166 p.A = val 4167 } 4168 func (p *JSONObject) SetB(val int8) { 4169 p.B = val 4170 } 4171 4172 var fieldIDToName_JSONObject = map[int16]string{ 4173 1: "A", 4174 2: "B", 4175 } 4176 4177 func (p *JSONObject) Read(iprot thrift.TProtocol) (err error) { 4178 4179 var fieldTypeId thrift.TType 4180 var fieldId int16 4181 4182 if _, err = iprot.ReadStructBegin(); err != nil { 4183 goto ReadStructBeginError 4184 } 4185 4186 for { 4187 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 4188 if err != nil { 4189 goto ReadFieldBeginError 4190 } 4191 if fieldTypeId == thrift.STOP { 4192 break 4193 } 4194 4195 switch fieldId { 4196 case 1: 4197 if fieldTypeId == thrift.STRING { 4198 if err = p.ReadField1(iprot); err != nil { 4199 goto ReadFieldError 4200 } 4201 } else { 4202 if err = iprot.Skip(fieldTypeId); err != nil { 4203 goto SkipFieldError 4204 } 4205 } 4206 case 2: 4207 if fieldTypeId == thrift.BYTE { 4208 if err = p.ReadField2(iprot); err != nil { 4209 goto ReadFieldError 4210 } 4211 } else { 4212 if err = iprot.Skip(fieldTypeId); err != nil { 4213 goto SkipFieldError 4214 } 4215 } 4216 default: 4217 if err = iprot.Skip(fieldTypeId); err != nil { 4218 goto SkipFieldError 4219 } 4220 } 4221 4222 if err = iprot.ReadFieldEnd(); err != nil { 4223 goto ReadFieldEndError 4224 } 4225 } 4226 if err = iprot.ReadStructEnd(); err != nil { 4227 goto ReadStructEndError 4228 } 4229 4230 return nil 4231 ReadStructBeginError: 4232 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 4233 ReadFieldBeginError: 4234 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 4235 ReadFieldError: 4236 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_JSONObject[fieldId]), err) 4237 SkipFieldError: 4238 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 4239 4240 ReadFieldEndError: 4241 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 4242 ReadStructEndError: 4243 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4244 } 4245 4246 func (p *JSONObject) ReadField1(iprot thrift.TProtocol) error { 4247 if v, err := iprot.ReadString(); err != nil { 4248 return err 4249 } else { 4250 p.A = v 4251 } 4252 return nil 4253 } 4254 4255 func (p *JSONObject) ReadField2(iprot thrift.TProtocol) error { 4256 if v, err := iprot.ReadByte(); err != nil { 4257 return err 4258 } else { 4259 p.B = v 4260 } 4261 return nil 4262 } 4263 4264 func (p *JSONObject) Write(oprot thrift.TProtocol) (err error) { 4265 var fieldId int16 4266 if err = oprot.WriteStructBegin("JSONObject"); err != nil { 4267 goto WriteStructBeginError 4268 } 4269 if p != nil { 4270 if err = p.writeField1(oprot); err != nil { 4271 fieldId = 1 4272 goto WriteFieldError 4273 } 4274 if err = p.writeField2(oprot); err != nil { 4275 fieldId = 2 4276 goto WriteFieldError 4277 } 4278 4279 } 4280 if err = oprot.WriteFieldStop(); err != nil { 4281 goto WriteFieldStopError 4282 } 4283 if err = oprot.WriteStructEnd(); err != nil { 4284 goto WriteStructEndError 4285 } 4286 return nil 4287 WriteStructBeginError: 4288 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4289 WriteFieldError: 4290 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 4291 WriteFieldStopError: 4292 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 4293 WriteStructEndError: 4294 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 4295 } 4296 4297 func (p *JSONObject) writeField1(oprot thrift.TProtocol) (err error) { 4298 if err = oprot.WriteFieldBegin("A", thrift.STRING, 1); err != nil { 4299 goto WriteFieldBeginError 4300 } 4301 if err := oprot.WriteString(p.A); err != nil { 4302 return err 4303 } 4304 if err = oprot.WriteFieldEnd(); err != nil { 4305 goto WriteFieldEndError 4306 } 4307 return nil 4308 WriteFieldBeginError: 4309 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 4310 WriteFieldEndError: 4311 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 4312 } 4313 4314 func (p *JSONObject) writeField2(oprot thrift.TProtocol) (err error) { 4315 if err = oprot.WriteFieldBegin("B", thrift.BYTE, 2); err != nil { 4316 goto WriteFieldBeginError 4317 } 4318 if err := oprot.WriteByte(p.B); err != nil { 4319 return err 4320 } 4321 if err = oprot.WriteFieldEnd(); err != nil { 4322 goto WriteFieldEndError 4323 } 4324 return nil 4325 WriteFieldBeginError: 4326 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 4327 WriteFieldEndError: 4328 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 4329 } 4330 4331 func (p *JSONObject) String() string { 4332 if p == nil { 4333 return "<nil>" 4334 } 4335 return fmt.Sprintf("JSONObject(%+v)", *p) 4336 } 4337 4338 func (p *JSONObject) DeepEqual(ano *JSONObject) bool { 4339 if p == ano { 4340 return true 4341 } else if p == nil || ano == nil { 4342 return false 4343 } 4344 if !p.Field1DeepEqual(ano.A) { 4345 return false 4346 } 4347 if !p.Field2DeepEqual(ano.B) { 4348 return false 4349 } 4350 return true 4351 } 4352 4353 func (p *JSONObject) Field1DeepEqual(src string) bool { 4354 4355 if strings.Compare(p.A, src) != 0 { 4356 return false 4357 } 4358 return true 4359 } 4360 func (p *JSONObject) Field2DeepEqual(src int8) bool { 4361 4362 if p.B != src { 4363 return false 4364 } 4365 return true 4366 } 4367 4368 type ExampleJSONString struct { 4369 Query *JSONObject `thrift:"Query,1" json:"Query"` 4370 Query2 []string `thrift:"Query2,2,required" json:"Query2"` 4371 Header *JSONObject `thrift:"Header,3,required" json:"Header"` 4372 Header2 map[int32]string `thrift:"Header2,4,required" json:"Header2"` 4373 Cookie *JSONObject `thrift:"Cookie,5" json:"Cookie"` 4374 Cookie2 []int32 `thrift:"Cookie2,6,required" json:"Cookie2"` 4375 } 4376 4377 func NewExampleJSONString() *ExampleJSONString { 4378 return &ExampleJSONString{} 4379 } 4380 4381 var ExampleJSONString_Query_DEFAULT *JSONObject 4382 4383 func (p *ExampleJSONString) GetQuery() (v *JSONObject) { 4384 if !p.IsSetQuery() { 4385 return ExampleJSONString_Query_DEFAULT 4386 } 4387 return p.Query 4388 } 4389 4390 func (p *ExampleJSONString) GetQuery2() (v []string) { 4391 return p.Query2 4392 } 4393 4394 var ExampleJSONString_Header_DEFAULT *JSONObject 4395 4396 func (p *ExampleJSONString) GetHeader() (v *JSONObject) { 4397 if !p.IsSetHeader() { 4398 return ExampleJSONString_Header_DEFAULT 4399 } 4400 return p.Header 4401 } 4402 4403 func (p *ExampleJSONString) GetHeader2() (v map[int32]string) { 4404 return p.Header2 4405 } 4406 4407 var ExampleJSONString_Cookie_DEFAULT *JSONObject 4408 4409 func (p *ExampleJSONString) GetCookie() (v *JSONObject) { 4410 if !p.IsSetCookie() { 4411 return ExampleJSONString_Cookie_DEFAULT 4412 } 4413 return p.Cookie 4414 } 4415 4416 func (p *ExampleJSONString) GetCookie2() (v []int32) { 4417 return p.Cookie2 4418 } 4419 func (p *ExampleJSONString) SetQuery(val *JSONObject) { 4420 p.Query = val 4421 } 4422 func (p *ExampleJSONString) SetQuery2(val []string) { 4423 p.Query2 = val 4424 } 4425 func (p *ExampleJSONString) SetHeader(val *JSONObject) { 4426 p.Header = val 4427 } 4428 func (p *ExampleJSONString) SetHeader2(val map[int32]string) { 4429 p.Header2 = val 4430 } 4431 func (p *ExampleJSONString) SetCookie(val *JSONObject) { 4432 p.Cookie = val 4433 } 4434 func (p *ExampleJSONString) SetCookie2(val []int32) { 4435 p.Cookie2 = val 4436 } 4437 4438 var fieldIDToName_ExampleJSONString = map[int16]string{ 4439 1: "Query", 4440 2: "Query2", 4441 3: "Header", 4442 4: "Header2", 4443 5: "Cookie", 4444 6: "Cookie2", 4445 } 4446 4447 func (p *ExampleJSONString) IsSetQuery() bool { 4448 return p.Query != nil 4449 } 4450 4451 func (p *ExampleJSONString) IsSetHeader() bool { 4452 return p.Header != nil 4453 } 4454 4455 func (p *ExampleJSONString) IsSetCookie() bool { 4456 return p.Cookie != nil 4457 } 4458 4459 func (p *ExampleJSONString) Read(iprot thrift.TProtocol) (err error) { 4460 4461 var fieldTypeId thrift.TType 4462 var fieldId int16 4463 var issetQuery2 bool = false 4464 var issetHeader bool = false 4465 var issetHeader2 bool = false 4466 var issetCookie2 bool = false 4467 4468 if _, err = iprot.ReadStructBegin(); err != nil { 4469 goto ReadStructBeginError 4470 } 4471 4472 for { 4473 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 4474 if err != nil { 4475 goto ReadFieldBeginError 4476 } 4477 if fieldTypeId == thrift.STOP { 4478 break 4479 } 4480 4481 switch fieldId { 4482 case 1: 4483 if fieldTypeId == thrift.STRUCT { 4484 if err = p.ReadField1(iprot); err != nil { 4485 goto ReadFieldError 4486 } 4487 } else { 4488 if err = iprot.Skip(fieldTypeId); err != nil { 4489 goto SkipFieldError 4490 } 4491 } 4492 case 2: 4493 if fieldTypeId == thrift.LIST { 4494 if err = p.ReadField2(iprot); err != nil { 4495 goto ReadFieldError 4496 } 4497 issetQuery2 = true 4498 } else { 4499 if err = iprot.Skip(fieldTypeId); err != nil { 4500 goto SkipFieldError 4501 } 4502 } 4503 case 3: 4504 if fieldTypeId == thrift.STRUCT { 4505 if err = p.ReadField3(iprot); err != nil { 4506 goto ReadFieldError 4507 } 4508 issetHeader = true 4509 } else { 4510 if err = iprot.Skip(fieldTypeId); err != nil { 4511 goto SkipFieldError 4512 } 4513 } 4514 case 4: 4515 if fieldTypeId == thrift.MAP { 4516 if err = p.ReadField4(iprot); err != nil { 4517 goto ReadFieldError 4518 } 4519 issetHeader2 = true 4520 } else { 4521 if err = iprot.Skip(fieldTypeId); err != nil { 4522 goto SkipFieldError 4523 } 4524 } 4525 case 5: 4526 if fieldTypeId == thrift.STRUCT { 4527 if err = p.ReadField5(iprot); err != nil { 4528 goto ReadFieldError 4529 } 4530 } else { 4531 if err = iprot.Skip(fieldTypeId); err != nil { 4532 goto SkipFieldError 4533 } 4534 } 4535 case 6: 4536 if fieldTypeId == thrift.SET { 4537 if err = p.ReadField6(iprot); err != nil { 4538 goto ReadFieldError 4539 } 4540 issetCookie2 = true 4541 } else { 4542 if err = iprot.Skip(fieldTypeId); err != nil { 4543 goto SkipFieldError 4544 } 4545 } 4546 default: 4547 if err = iprot.Skip(fieldTypeId); err != nil { 4548 goto SkipFieldError 4549 } 4550 } 4551 4552 if err = iprot.ReadFieldEnd(); err != nil { 4553 goto ReadFieldEndError 4554 } 4555 } 4556 if err = iprot.ReadStructEnd(); err != nil { 4557 goto ReadStructEndError 4558 } 4559 4560 if !issetQuery2 { 4561 fieldId = 2 4562 goto RequiredFieldNotSetError 4563 } 4564 4565 if !issetHeader { 4566 fieldId = 3 4567 goto RequiredFieldNotSetError 4568 } 4569 4570 if !issetHeader2 { 4571 fieldId = 4 4572 goto RequiredFieldNotSetError 4573 } 4574 4575 if !issetCookie2 { 4576 fieldId = 6 4577 goto RequiredFieldNotSetError 4578 } 4579 return nil 4580 ReadStructBeginError: 4581 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 4582 ReadFieldBeginError: 4583 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 4584 ReadFieldError: 4585 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleJSONString[fieldId]), err) 4586 SkipFieldError: 4587 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 4588 4589 ReadFieldEndError: 4590 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 4591 ReadStructEndError: 4592 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 4593 RequiredFieldNotSetError: 4594 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field %s is not set", fieldIDToName_ExampleJSONString[fieldId])) 4595 } 4596 4597 func (p *ExampleJSONString) ReadField1(iprot thrift.TProtocol) error { 4598 p.Query = NewJSONObject() 4599 if err := p.Query.Read(iprot); err != nil { 4600 return err 4601 } 4602 return nil 4603 } 4604 4605 func (p *ExampleJSONString) ReadField2(iprot thrift.TProtocol) error { 4606 _, size, err := iprot.ReadListBegin() 4607 if err != nil { 4608 return err 4609 } 4610 p.Query2 = make([]string, 0, size) 4611 for i := 0; i < size; i++ { 4612 var _elem string 4613 if v, err := iprot.ReadString(); err != nil { 4614 return err 4615 } else { 4616 _elem = v 4617 } 4618 4619 p.Query2 = append(p.Query2, _elem) 4620 } 4621 if err := iprot.ReadListEnd(); err != nil { 4622 return err 4623 } 4624 return nil 4625 } 4626 4627 func (p *ExampleJSONString) ReadField3(iprot thrift.TProtocol) error { 4628 p.Header = NewJSONObject() 4629 if err := p.Header.Read(iprot); err != nil { 4630 return err 4631 } 4632 return nil 4633 } 4634 4635 func (p *ExampleJSONString) ReadField4(iprot thrift.TProtocol) error { 4636 _, _, size, err := iprot.ReadMapBegin() 4637 if err != nil { 4638 return err 4639 } 4640 p.Header2 = make(map[int32]string, size) 4641 for i := 0; i < size; i++ { 4642 var _key int32 4643 if v, err := iprot.ReadI32(); err != nil { 4644 return err 4645 } else { 4646 _key = v 4647 } 4648 4649 var _val string 4650 if v, err := iprot.ReadString(); err != nil { 4651 return err 4652 } else { 4653 _val = v 4654 } 4655 4656 p.Header2[_key] = _val 4657 } 4658 if err := iprot.ReadMapEnd(); err != nil { 4659 return err 4660 } 4661 return nil 4662 } 4663 4664 func (p *ExampleJSONString) ReadField5(iprot thrift.TProtocol) error { 4665 p.Cookie = NewJSONObject() 4666 if err := p.Cookie.Read(iprot); err != nil { 4667 return err 4668 } 4669 return nil 4670 } 4671 4672 func (p *ExampleJSONString) ReadField6(iprot thrift.TProtocol) error { 4673 _, size, err := iprot.ReadSetBegin() 4674 if err != nil { 4675 return err 4676 } 4677 p.Cookie2 = make([]int32, 0, size) 4678 for i := 0; i < size; i++ { 4679 var _elem int32 4680 if v, err := iprot.ReadI32(); err != nil { 4681 return err 4682 } else { 4683 _elem = v 4684 } 4685 4686 p.Cookie2 = append(p.Cookie2, _elem) 4687 } 4688 if err := iprot.ReadSetEnd(); err != nil { 4689 return err 4690 } 4691 return nil 4692 } 4693 4694 func (p *ExampleJSONString) Write(oprot thrift.TProtocol) (err error) { 4695 var fieldId int16 4696 if err = oprot.WriteStructBegin("ExampleJSONString"); err != nil { 4697 goto WriteStructBeginError 4698 } 4699 if p != nil { 4700 if err = p.writeField1(oprot); err != nil { 4701 fieldId = 1 4702 goto WriteFieldError 4703 } 4704 if err = p.writeField2(oprot); err != nil { 4705 fieldId = 2 4706 goto WriteFieldError 4707 } 4708 if err = p.writeField3(oprot); err != nil { 4709 fieldId = 3 4710 goto WriteFieldError 4711 } 4712 if err = p.writeField4(oprot); err != nil { 4713 fieldId = 4 4714 goto WriteFieldError 4715 } 4716 if err = p.writeField5(oprot); err != nil { 4717 fieldId = 5 4718 goto WriteFieldError 4719 } 4720 if err = p.writeField6(oprot); err != nil { 4721 fieldId = 6 4722 goto WriteFieldError 4723 } 4724 4725 } 4726 if err = oprot.WriteFieldStop(); err != nil { 4727 goto WriteFieldStopError 4728 } 4729 if err = oprot.WriteStructEnd(); err != nil { 4730 goto WriteStructEndError 4731 } 4732 return nil 4733 WriteStructBeginError: 4734 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 4735 WriteFieldError: 4736 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 4737 WriteFieldStopError: 4738 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 4739 WriteStructEndError: 4740 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 4741 } 4742 4743 func (p *ExampleJSONString) writeField1(oprot thrift.TProtocol) (err error) { 4744 if err = oprot.WriteFieldBegin("Query", thrift.STRUCT, 1); err != nil { 4745 goto WriteFieldBeginError 4746 } 4747 if err := p.Query.Write(oprot); err != nil { 4748 return err 4749 } 4750 if err = oprot.WriteFieldEnd(); err != nil { 4751 goto WriteFieldEndError 4752 } 4753 return nil 4754 WriteFieldBeginError: 4755 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 4756 WriteFieldEndError: 4757 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 4758 } 4759 4760 func (p *ExampleJSONString) writeField2(oprot thrift.TProtocol) (err error) { 4761 if err = oprot.WriteFieldBegin("Query2", thrift.LIST, 2); err != nil { 4762 goto WriteFieldBeginError 4763 } 4764 if err := oprot.WriteListBegin(thrift.STRING, len(p.Query2)); err != nil { 4765 return err 4766 } 4767 for _, v := range p.Query2 { 4768 if err := oprot.WriteString(v); err != nil { 4769 return err 4770 } 4771 } 4772 if err := oprot.WriteListEnd(); err != nil { 4773 return err 4774 } 4775 if err = oprot.WriteFieldEnd(); err != nil { 4776 goto WriteFieldEndError 4777 } 4778 return nil 4779 WriteFieldBeginError: 4780 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 4781 WriteFieldEndError: 4782 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 4783 } 4784 4785 func (p *ExampleJSONString) writeField3(oprot thrift.TProtocol) (err error) { 4786 if err = oprot.WriteFieldBegin("Header", thrift.STRUCT, 3); err != nil { 4787 goto WriteFieldBeginError 4788 } 4789 if err := p.Header.Write(oprot); err != nil { 4790 return err 4791 } 4792 if err = oprot.WriteFieldEnd(); err != nil { 4793 goto WriteFieldEndError 4794 } 4795 return nil 4796 WriteFieldBeginError: 4797 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 4798 WriteFieldEndError: 4799 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 4800 } 4801 4802 func (p *ExampleJSONString) writeField4(oprot thrift.TProtocol) (err error) { 4803 if err = oprot.WriteFieldBegin("Header2", thrift.MAP, 4); err != nil { 4804 goto WriteFieldBeginError 4805 } 4806 if err := oprot.WriteMapBegin(thrift.I32, thrift.STRING, len(p.Header2)); err != nil { 4807 return err 4808 } 4809 for k, v := range p.Header2 { 4810 4811 if err := oprot.WriteI32(k); err != nil { 4812 return err 4813 } 4814 4815 if err := oprot.WriteString(v); err != nil { 4816 return err 4817 } 4818 } 4819 if err := oprot.WriteMapEnd(); err != nil { 4820 return err 4821 } 4822 if err = oprot.WriteFieldEnd(); err != nil { 4823 goto WriteFieldEndError 4824 } 4825 return nil 4826 WriteFieldBeginError: 4827 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 4828 WriteFieldEndError: 4829 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 4830 } 4831 4832 func (p *ExampleJSONString) writeField5(oprot thrift.TProtocol) (err error) { 4833 if err = oprot.WriteFieldBegin("Cookie", thrift.STRUCT, 5); err != nil { 4834 goto WriteFieldBeginError 4835 } 4836 if err := p.Cookie.Write(oprot); err != nil { 4837 return err 4838 } 4839 if err = oprot.WriteFieldEnd(); err != nil { 4840 goto WriteFieldEndError 4841 } 4842 return nil 4843 WriteFieldBeginError: 4844 return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) 4845 WriteFieldEndError: 4846 return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) 4847 } 4848 4849 func (p *ExampleJSONString) writeField6(oprot thrift.TProtocol) (err error) { 4850 if err = oprot.WriteFieldBegin("Cookie2", thrift.SET, 6); err != nil { 4851 goto WriteFieldBeginError 4852 } 4853 if err := oprot.WriteSetBegin(thrift.I32, len(p.Cookie2)); err != nil { 4854 return err 4855 } 4856 for i := 0; i < len(p.Cookie2); i++ { 4857 for j := i + 1; j < len(p.Cookie2); j++ { 4858 if func(tgt, src int32) bool { 4859 if tgt != src { 4860 return false 4861 } 4862 return true 4863 }(p.Cookie2[i], p.Cookie2[j]) { 4864 return thrift.PrependError("", fmt.Errorf("%T error writing set field: slice is not unique", p.Cookie2[i])) 4865 } 4866 } 4867 } 4868 for _, v := range p.Cookie2 { 4869 if err := oprot.WriteI32(v); err != nil { 4870 return err 4871 } 4872 } 4873 if err := oprot.WriteSetEnd(); err != nil { 4874 return err 4875 } 4876 if err = oprot.WriteFieldEnd(); err != nil { 4877 goto WriteFieldEndError 4878 } 4879 return nil 4880 WriteFieldBeginError: 4881 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 4882 WriteFieldEndError: 4883 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 4884 } 4885 4886 func (p *ExampleJSONString) String() string { 4887 if p == nil { 4888 return "<nil>" 4889 } 4890 return fmt.Sprintf("ExampleJSONString(%+v)", *p) 4891 } 4892 4893 func (p *ExampleJSONString) DeepEqual(ano *ExampleJSONString) bool { 4894 if p == ano { 4895 return true 4896 } else if p == nil || ano == nil { 4897 return false 4898 } 4899 if !p.Field1DeepEqual(ano.Query) { 4900 return false 4901 } 4902 if !p.Field2DeepEqual(ano.Query2) { 4903 return false 4904 } 4905 if !p.Field3DeepEqual(ano.Header) { 4906 return false 4907 } 4908 if !p.Field4DeepEqual(ano.Header2) { 4909 return false 4910 } 4911 if !p.Field5DeepEqual(ano.Cookie) { 4912 return false 4913 } 4914 if !p.Field6DeepEqual(ano.Cookie2) { 4915 return false 4916 } 4917 return true 4918 } 4919 4920 func (p *ExampleJSONString) Field1DeepEqual(src *JSONObject) bool { 4921 4922 if !p.Query.DeepEqual(src) { 4923 return false 4924 } 4925 return true 4926 } 4927 func (p *ExampleJSONString) Field2DeepEqual(src []string) bool { 4928 4929 if len(p.Query2) != len(src) { 4930 return false 4931 } 4932 for i, v := range p.Query2 { 4933 _src := src[i] 4934 if strings.Compare(v, _src) != 0 { 4935 return false 4936 } 4937 } 4938 return true 4939 } 4940 func (p *ExampleJSONString) Field3DeepEqual(src *JSONObject) bool { 4941 4942 if !p.Header.DeepEqual(src) { 4943 return false 4944 } 4945 return true 4946 } 4947 func (p *ExampleJSONString) Field4DeepEqual(src map[int32]string) bool { 4948 4949 if len(p.Header2) != len(src) { 4950 return false 4951 } 4952 for k, v := range p.Header2 { 4953 _src := src[k] 4954 if strings.Compare(v, _src) != 0 { 4955 return false 4956 } 4957 } 4958 return true 4959 } 4960 func (p *ExampleJSONString) Field5DeepEqual(src *JSONObject) bool { 4961 4962 if !p.Cookie.DeepEqual(src) { 4963 return false 4964 } 4965 return true 4966 } 4967 func (p *ExampleJSONString) Field6DeepEqual(src []int32) bool { 4968 4969 if len(p.Cookie2) != len(src) { 4970 return false 4971 } 4972 for i, v := range p.Cookie2 { 4973 _src := src[i] 4974 if v != _src { 4975 return false 4976 } 4977 } 4978 return true 4979 } 4980 4981 type ExamplePartial struct { 4982 Msg string `thrift:"Msg,1" json:"msg"` 4983 } 4984 4985 func NewExamplePartial() *ExamplePartial { 4986 return &ExamplePartial{} 4987 } 4988 4989 func (p *ExamplePartial) GetMsg() (v string) { 4990 return p.Msg 4991 } 4992 func (p *ExamplePartial) SetMsg(val string) { 4993 p.Msg = val 4994 } 4995 4996 var fieldIDToName_ExamplePartial = map[int16]string{ 4997 1: "Msg", 4998 } 4999 5000 func (p *ExamplePartial) Read(iprot thrift.TProtocol) (err error) { 5001 5002 var fieldTypeId thrift.TType 5003 var fieldId int16 5004 5005 if _, err = iprot.ReadStructBegin(); err != nil { 5006 goto ReadStructBeginError 5007 } 5008 5009 for { 5010 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 5011 if err != nil { 5012 goto ReadFieldBeginError 5013 } 5014 if fieldTypeId == thrift.STOP { 5015 break 5016 } 5017 5018 switch fieldId { 5019 case 1: 5020 if fieldTypeId == thrift.STRING { 5021 if err = p.ReadField1(iprot); err != nil { 5022 goto ReadFieldError 5023 } 5024 } else { 5025 if err = iprot.Skip(fieldTypeId); err != nil { 5026 goto SkipFieldError 5027 } 5028 } 5029 default: 5030 if err = iprot.Skip(fieldTypeId); err != nil { 5031 goto SkipFieldError 5032 } 5033 } 5034 5035 if err = iprot.ReadFieldEnd(); err != nil { 5036 goto ReadFieldEndError 5037 } 5038 } 5039 if err = iprot.ReadStructEnd(); err != nil { 5040 goto ReadStructEndError 5041 } 5042 5043 return nil 5044 ReadStructBeginError: 5045 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 5046 ReadFieldBeginError: 5047 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 5048 ReadFieldError: 5049 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExamplePartial[fieldId]), err) 5050 SkipFieldError: 5051 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 5052 5053 ReadFieldEndError: 5054 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 5055 ReadStructEndError: 5056 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5057 } 5058 5059 func (p *ExamplePartial) ReadField1(iprot thrift.TProtocol) error { 5060 if v, err := iprot.ReadString(); err != nil { 5061 return err 5062 } else { 5063 p.Msg = v 5064 } 5065 return nil 5066 } 5067 5068 func (p *ExamplePartial) Write(oprot thrift.TProtocol) (err error) { 5069 var fieldId int16 5070 if err = oprot.WriteStructBegin("ExamplePartial"); err != nil { 5071 goto WriteStructBeginError 5072 } 5073 if p != nil { 5074 if err = p.writeField1(oprot); err != nil { 5075 fieldId = 1 5076 goto WriteFieldError 5077 } 5078 5079 } 5080 if err = oprot.WriteFieldStop(); err != nil { 5081 goto WriteFieldStopError 5082 } 5083 if err = oprot.WriteStructEnd(); err != nil { 5084 goto WriteStructEndError 5085 } 5086 return nil 5087 WriteStructBeginError: 5088 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5089 WriteFieldError: 5090 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 5091 WriteFieldStopError: 5092 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 5093 WriteStructEndError: 5094 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 5095 } 5096 5097 func (p *ExamplePartial) writeField1(oprot thrift.TProtocol) (err error) { 5098 if err = oprot.WriteFieldBegin("Msg", thrift.STRING, 1); err != nil { 5099 goto WriteFieldBeginError 5100 } 5101 if err := oprot.WriteString(p.Msg); err != nil { 5102 return err 5103 } 5104 if err = oprot.WriteFieldEnd(); err != nil { 5105 goto WriteFieldEndError 5106 } 5107 return nil 5108 WriteFieldBeginError: 5109 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 5110 WriteFieldEndError: 5111 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 5112 } 5113 5114 func (p *ExamplePartial) String() string { 5115 if p == nil { 5116 return "<nil>" 5117 } 5118 return fmt.Sprintf("ExamplePartial(%+v)", *p) 5119 } 5120 5121 func (p *ExamplePartial) DeepEqual(ano *ExamplePartial) bool { 5122 if p == ano { 5123 return true 5124 } else if p == nil || ano == nil { 5125 return false 5126 } 5127 if !p.Field1DeepEqual(ano.Msg) { 5128 return false 5129 } 5130 return true 5131 } 5132 5133 func (p *ExamplePartial) Field1DeepEqual(src string) bool { 5134 5135 if strings.Compare(p.Msg, src) != 0 { 5136 return false 5137 } 5138 return true 5139 } 5140 5141 type ExamplePartial2 struct { 5142 Msg string `thrift:"Msg,1" json:"msg"` 5143 Cookie *float64 `thrift:"Cookie,2" json:"Cookie,omitempty"` 5144 Status int32 `thrift:"Status,3,required" json:"Status"` 5145 Header *bool `thrift:"Header,4" json:"Header,omitempty"` 5146 Code int64 `thrift:"Code,6" json:"code_code"` 5147 Subfix float64 `thrift:"Subfix,32767" json:"Subfix"` 5148 InnerBase *InnerBasePartial `thrift:"InnerBase,7" json:"InnerBase"` 5149 BaseResp *base.BaseResp `thrift:"BaseResp,255" json:"BaseResp"` 5150 } 5151 5152 func NewExamplePartial2() *ExamplePartial2 { 5153 return &ExamplePartial2{} 5154 } 5155 5156 func (p *ExamplePartial2) GetMsg() (v string) { 5157 return p.Msg 5158 } 5159 5160 var ExamplePartial2_Cookie_DEFAULT float64 5161 5162 func (p *ExamplePartial2) GetCookie() (v float64) { 5163 if !p.IsSetCookie() { 5164 return ExamplePartial2_Cookie_DEFAULT 5165 } 5166 return *p.Cookie 5167 } 5168 5169 func (p *ExamplePartial2) GetStatus() (v int32) { 5170 return p.Status 5171 } 5172 5173 var ExamplePartial2_Header_DEFAULT bool 5174 5175 func (p *ExamplePartial2) GetHeader() (v bool) { 5176 if !p.IsSetHeader() { 5177 return ExamplePartial2_Header_DEFAULT 5178 } 5179 return *p.Header 5180 } 5181 5182 func (p *ExamplePartial2) GetCode() (v int64) { 5183 return p.Code 5184 } 5185 5186 func (p *ExamplePartial2) GetSubfix() (v float64) { 5187 return p.Subfix 5188 } 5189 5190 var ExamplePartial2_InnerBase_DEFAULT *InnerBasePartial 5191 5192 func (p *ExamplePartial2) GetInnerBase() (v *InnerBasePartial) { 5193 if !p.IsSetInnerBase() { 5194 return ExamplePartial2_InnerBase_DEFAULT 5195 } 5196 return p.InnerBase 5197 } 5198 5199 var ExamplePartial2_BaseResp_DEFAULT *base.BaseResp 5200 5201 func (p *ExamplePartial2) GetBaseResp() (v *base.BaseResp) { 5202 if !p.IsSetBaseResp() { 5203 return ExamplePartial2_BaseResp_DEFAULT 5204 } 5205 return p.BaseResp 5206 } 5207 func (p *ExamplePartial2) SetMsg(val string) { 5208 p.Msg = val 5209 } 5210 func (p *ExamplePartial2) SetCookie(val *float64) { 5211 p.Cookie = val 5212 } 5213 func (p *ExamplePartial2) SetStatus(val int32) { 5214 p.Status = val 5215 } 5216 func (p *ExamplePartial2) SetHeader(val *bool) { 5217 p.Header = val 5218 } 5219 func (p *ExamplePartial2) SetCode(val int64) { 5220 p.Code = val 5221 } 5222 func (p *ExamplePartial2) SetSubfix(val float64) { 5223 p.Subfix = val 5224 } 5225 func (p *ExamplePartial2) SetInnerBase(val *InnerBasePartial) { 5226 p.InnerBase = val 5227 } 5228 func (p *ExamplePartial2) SetBaseResp(val *base.BaseResp) { 5229 p.BaseResp = val 5230 } 5231 5232 var fieldIDToName_ExamplePartial2 = map[int16]string{ 5233 1: "Msg", 5234 2: "Cookie", 5235 3: "Status", 5236 4: "Header", 5237 6: "Code", 5238 32767: "Subfix", 5239 7: "InnerBase", 5240 255: "BaseResp", 5241 } 5242 5243 func (p *ExamplePartial2) IsSetCookie() bool { 5244 return p.Cookie != nil 5245 } 5246 5247 func (p *ExamplePartial2) IsSetHeader() bool { 5248 return p.Header != nil 5249 } 5250 5251 func (p *ExamplePartial2) IsSetInnerBase() bool { 5252 return p.InnerBase != nil 5253 } 5254 5255 func (p *ExamplePartial2) IsSetBaseResp() bool { 5256 return p.BaseResp != nil 5257 } 5258 5259 func (p *ExamplePartial2) Read(iprot thrift.TProtocol) (err error) { 5260 5261 var fieldTypeId thrift.TType 5262 var fieldId int16 5263 var issetStatus bool = false 5264 5265 if _, err = iprot.ReadStructBegin(); err != nil { 5266 goto ReadStructBeginError 5267 } 5268 5269 for { 5270 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 5271 if err != nil { 5272 goto ReadFieldBeginError 5273 } 5274 if fieldTypeId == thrift.STOP { 5275 break 5276 } 5277 5278 switch fieldId { 5279 case 1: 5280 if fieldTypeId == thrift.STRING { 5281 if err = p.ReadField1(iprot); err != nil { 5282 goto ReadFieldError 5283 } 5284 } else { 5285 if err = iprot.Skip(fieldTypeId); err != nil { 5286 goto SkipFieldError 5287 } 5288 } 5289 case 2: 5290 if fieldTypeId == thrift.DOUBLE { 5291 if err = p.ReadField2(iprot); err != nil { 5292 goto ReadFieldError 5293 } 5294 } else { 5295 if err = iprot.Skip(fieldTypeId); err != nil { 5296 goto SkipFieldError 5297 } 5298 } 5299 case 3: 5300 if fieldTypeId == thrift.I32 { 5301 if err = p.ReadField3(iprot); err != nil { 5302 goto ReadFieldError 5303 } 5304 issetStatus = true 5305 } else { 5306 if err = iprot.Skip(fieldTypeId); err != nil { 5307 goto SkipFieldError 5308 } 5309 } 5310 case 4: 5311 if fieldTypeId == thrift.BOOL { 5312 if err = p.ReadField4(iprot); err != nil { 5313 goto ReadFieldError 5314 } 5315 } else { 5316 if err = iprot.Skip(fieldTypeId); err != nil { 5317 goto SkipFieldError 5318 } 5319 } 5320 case 6: 5321 if fieldTypeId == thrift.I64 { 5322 if err = p.ReadField6(iprot); err != nil { 5323 goto ReadFieldError 5324 } 5325 } else { 5326 if err = iprot.Skip(fieldTypeId); err != nil { 5327 goto SkipFieldError 5328 } 5329 } 5330 case 32767: 5331 if fieldTypeId == thrift.DOUBLE { 5332 if err = p.ReadField32767(iprot); err != nil { 5333 goto ReadFieldError 5334 } 5335 } else { 5336 if err = iprot.Skip(fieldTypeId); err != nil { 5337 goto SkipFieldError 5338 } 5339 } 5340 case 7: 5341 if fieldTypeId == thrift.STRUCT { 5342 if err = p.ReadField7(iprot); err != nil { 5343 goto ReadFieldError 5344 } 5345 } else { 5346 if err = iprot.Skip(fieldTypeId); err != nil { 5347 goto SkipFieldError 5348 } 5349 } 5350 case 255: 5351 if fieldTypeId == thrift.STRUCT { 5352 if err = p.ReadField255(iprot); err != nil { 5353 goto ReadFieldError 5354 } 5355 } else { 5356 if err = iprot.Skip(fieldTypeId); err != nil { 5357 goto SkipFieldError 5358 } 5359 } 5360 default: 5361 if err = iprot.Skip(fieldTypeId); err != nil { 5362 goto SkipFieldError 5363 } 5364 } 5365 5366 if err = iprot.ReadFieldEnd(); err != nil { 5367 goto ReadFieldEndError 5368 } 5369 } 5370 if err = iprot.ReadStructEnd(); err != nil { 5371 goto ReadStructEndError 5372 } 5373 5374 if !issetStatus { 5375 fieldId = 3 5376 goto RequiredFieldNotSetError 5377 } 5378 return nil 5379 ReadStructBeginError: 5380 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 5381 ReadFieldBeginError: 5382 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 5383 ReadFieldError: 5384 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExamplePartial2[fieldId]), err) 5385 SkipFieldError: 5386 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 5387 5388 ReadFieldEndError: 5389 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 5390 ReadStructEndError: 5391 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5392 RequiredFieldNotSetError: 5393 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field %s is not set", fieldIDToName_ExamplePartial2[fieldId])) 5394 } 5395 5396 func (p *ExamplePartial2) ReadField1(iprot thrift.TProtocol) error { 5397 if v, err := iprot.ReadString(); err != nil { 5398 return err 5399 } else { 5400 p.Msg = v 5401 } 5402 return nil 5403 } 5404 5405 func (p *ExamplePartial2) ReadField2(iprot thrift.TProtocol) error { 5406 if v, err := iprot.ReadDouble(); err != nil { 5407 return err 5408 } else { 5409 p.Cookie = &v 5410 } 5411 return nil 5412 } 5413 5414 func (p *ExamplePartial2) ReadField3(iprot thrift.TProtocol) error { 5415 if v, err := iprot.ReadI32(); err != nil { 5416 return err 5417 } else { 5418 p.Status = v 5419 } 5420 return nil 5421 } 5422 5423 func (p *ExamplePartial2) ReadField4(iprot thrift.TProtocol) error { 5424 if v, err := iprot.ReadBool(); err != nil { 5425 return err 5426 } else { 5427 p.Header = &v 5428 } 5429 return nil 5430 } 5431 5432 func (p *ExamplePartial2) ReadField6(iprot thrift.TProtocol) error { 5433 if v, err := iprot.ReadI64(); err != nil { 5434 return err 5435 } else { 5436 p.Code = v 5437 } 5438 return nil 5439 } 5440 5441 func (p *ExamplePartial2) ReadField32767(iprot thrift.TProtocol) error { 5442 if v, err := iprot.ReadDouble(); err != nil { 5443 return err 5444 } else { 5445 p.Subfix = v 5446 } 5447 return nil 5448 } 5449 5450 func (p *ExamplePartial2) ReadField7(iprot thrift.TProtocol) error { 5451 p.InnerBase = NewInnerBasePartial() 5452 if err := p.InnerBase.Read(iprot); err != nil { 5453 return err 5454 } 5455 return nil 5456 } 5457 5458 func (p *ExamplePartial2) ReadField255(iprot thrift.TProtocol) error { 5459 p.BaseResp = base.NewBaseResp() 5460 if err := p.BaseResp.Read(iprot); err != nil { 5461 return err 5462 } 5463 return nil 5464 } 5465 5466 func (p *ExamplePartial2) Write(oprot thrift.TProtocol) (err error) { 5467 var fieldId int16 5468 if err = oprot.WriteStructBegin("ExamplePartial2"); err != nil { 5469 goto WriteStructBeginError 5470 } 5471 if p != nil { 5472 if err = p.writeField1(oprot); err != nil { 5473 fieldId = 1 5474 goto WriteFieldError 5475 } 5476 if err = p.writeField2(oprot); err != nil { 5477 fieldId = 2 5478 goto WriteFieldError 5479 } 5480 if err = p.writeField3(oprot); err != nil { 5481 fieldId = 3 5482 goto WriteFieldError 5483 } 5484 if err = p.writeField4(oprot); err != nil { 5485 fieldId = 4 5486 goto WriteFieldError 5487 } 5488 if err = p.writeField6(oprot); err != nil { 5489 fieldId = 6 5490 goto WriteFieldError 5491 } 5492 if err = p.writeField32767(oprot); err != nil { 5493 fieldId = 32767 5494 goto WriteFieldError 5495 } 5496 if err = p.writeField7(oprot); err != nil { 5497 fieldId = 7 5498 goto WriteFieldError 5499 } 5500 if err = p.writeField255(oprot); err != nil { 5501 fieldId = 255 5502 goto WriteFieldError 5503 } 5504 5505 } 5506 if err = oprot.WriteFieldStop(); err != nil { 5507 goto WriteFieldStopError 5508 } 5509 if err = oprot.WriteStructEnd(); err != nil { 5510 goto WriteStructEndError 5511 } 5512 return nil 5513 WriteStructBeginError: 5514 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5515 WriteFieldError: 5516 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 5517 WriteFieldStopError: 5518 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 5519 WriteStructEndError: 5520 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 5521 } 5522 5523 func (p *ExamplePartial2) writeField1(oprot thrift.TProtocol) (err error) { 5524 if err = oprot.WriteFieldBegin("Msg", thrift.STRING, 1); err != nil { 5525 goto WriteFieldBeginError 5526 } 5527 if err := oprot.WriteString(p.Msg); err != nil { 5528 return err 5529 } 5530 if err = oprot.WriteFieldEnd(); err != nil { 5531 goto WriteFieldEndError 5532 } 5533 return nil 5534 WriteFieldBeginError: 5535 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 5536 WriteFieldEndError: 5537 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 5538 } 5539 5540 func (p *ExamplePartial2) writeField2(oprot thrift.TProtocol) (err error) { 5541 if p.IsSetCookie() { 5542 if err = oprot.WriteFieldBegin("Cookie", thrift.DOUBLE, 2); err != nil { 5543 goto WriteFieldBeginError 5544 } 5545 if err := oprot.WriteDouble(*p.Cookie); err != nil { 5546 return err 5547 } 5548 if err = oprot.WriteFieldEnd(); err != nil { 5549 goto WriteFieldEndError 5550 } 5551 } 5552 return nil 5553 WriteFieldBeginError: 5554 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 5555 WriteFieldEndError: 5556 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 5557 } 5558 5559 func (p *ExamplePartial2) writeField3(oprot thrift.TProtocol) (err error) { 5560 if err = oprot.WriteFieldBegin("Status", thrift.I32, 3); err != nil { 5561 goto WriteFieldBeginError 5562 } 5563 if err := oprot.WriteI32(p.Status); err != nil { 5564 return err 5565 } 5566 if err = oprot.WriteFieldEnd(); err != nil { 5567 goto WriteFieldEndError 5568 } 5569 return nil 5570 WriteFieldBeginError: 5571 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 5572 WriteFieldEndError: 5573 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 5574 } 5575 5576 func (p *ExamplePartial2) writeField4(oprot thrift.TProtocol) (err error) { 5577 if p.IsSetHeader() { 5578 if err = oprot.WriteFieldBegin("Header", thrift.BOOL, 4); err != nil { 5579 goto WriteFieldBeginError 5580 } 5581 if err := oprot.WriteBool(*p.Header); err != nil { 5582 return err 5583 } 5584 if err = oprot.WriteFieldEnd(); err != nil { 5585 goto WriteFieldEndError 5586 } 5587 } 5588 return nil 5589 WriteFieldBeginError: 5590 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 5591 WriteFieldEndError: 5592 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 5593 } 5594 5595 func (p *ExamplePartial2) writeField6(oprot thrift.TProtocol) (err error) { 5596 if err = oprot.WriteFieldBegin("Code", thrift.I64, 6); err != nil { 5597 goto WriteFieldBeginError 5598 } 5599 if err := oprot.WriteI64(p.Code); err != nil { 5600 return err 5601 } 5602 if err = oprot.WriteFieldEnd(); err != nil { 5603 goto WriteFieldEndError 5604 } 5605 return nil 5606 WriteFieldBeginError: 5607 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 5608 WriteFieldEndError: 5609 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 5610 } 5611 5612 func (p *ExamplePartial2) writeField32767(oprot thrift.TProtocol) (err error) { 5613 if err = oprot.WriteFieldBegin("Subfix", thrift.DOUBLE, 32767); err != nil { 5614 goto WriteFieldBeginError 5615 } 5616 if err := oprot.WriteDouble(p.Subfix); err != nil { 5617 return err 5618 } 5619 if err = oprot.WriteFieldEnd(); err != nil { 5620 goto WriteFieldEndError 5621 } 5622 return nil 5623 WriteFieldBeginError: 5624 return thrift.PrependError(fmt.Sprintf("%T write field 32767 begin error: ", p), err) 5625 WriteFieldEndError: 5626 return thrift.PrependError(fmt.Sprintf("%T write field 32767 end error: ", p), err) 5627 } 5628 5629 func (p *ExamplePartial2) writeField7(oprot thrift.TProtocol) (err error) { 5630 if err = oprot.WriteFieldBegin("InnerBase", thrift.STRUCT, 7); err != nil { 5631 goto WriteFieldBeginError 5632 } 5633 if err := p.InnerBase.Write(oprot); err != nil { 5634 return err 5635 } 5636 if err = oprot.WriteFieldEnd(); err != nil { 5637 goto WriteFieldEndError 5638 } 5639 return nil 5640 WriteFieldBeginError: 5641 return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) 5642 WriteFieldEndError: 5643 return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) 5644 } 5645 5646 func (p *ExamplePartial2) writeField255(oprot thrift.TProtocol) (err error) { 5647 if err = oprot.WriteFieldBegin("BaseResp", thrift.STRUCT, 255); err != nil { 5648 goto WriteFieldBeginError 5649 } 5650 if err := p.BaseResp.Write(oprot); err != nil { 5651 return err 5652 } 5653 if err = oprot.WriteFieldEnd(); err != nil { 5654 goto WriteFieldEndError 5655 } 5656 return nil 5657 WriteFieldBeginError: 5658 return thrift.PrependError(fmt.Sprintf("%T write field 255 begin error: ", p), err) 5659 WriteFieldEndError: 5660 return thrift.PrependError(fmt.Sprintf("%T write field 255 end error: ", p), err) 5661 } 5662 5663 func (p *ExamplePartial2) String() string { 5664 if p == nil { 5665 return "<nil>" 5666 } 5667 return fmt.Sprintf("ExamplePartial2(%+v)", *p) 5668 } 5669 5670 func (p *ExamplePartial2) DeepEqual(ano *ExamplePartial2) bool { 5671 if p == ano { 5672 return true 5673 } else if p == nil || ano == nil { 5674 return false 5675 } 5676 if !p.Field1DeepEqual(ano.Msg) { 5677 return false 5678 } 5679 if !p.Field2DeepEqual(ano.Cookie) { 5680 return false 5681 } 5682 if !p.Field3DeepEqual(ano.Status) { 5683 return false 5684 } 5685 if !p.Field4DeepEqual(ano.Header) { 5686 return false 5687 } 5688 if !p.Field6DeepEqual(ano.Code) { 5689 return false 5690 } 5691 if !p.Field32767DeepEqual(ano.Subfix) { 5692 return false 5693 } 5694 if !p.Field7DeepEqual(ano.InnerBase) { 5695 return false 5696 } 5697 if !p.Field255DeepEqual(ano.BaseResp) { 5698 return false 5699 } 5700 return true 5701 } 5702 5703 func (p *ExamplePartial2) Field1DeepEqual(src string) bool { 5704 5705 if strings.Compare(p.Msg, src) != 0 { 5706 return false 5707 } 5708 return true 5709 } 5710 func (p *ExamplePartial2) Field2DeepEqual(src *float64) bool { 5711 5712 if p.Cookie == src { 5713 return true 5714 } else if p.Cookie == nil || src == nil { 5715 return false 5716 } 5717 if *p.Cookie != *src { 5718 return false 5719 } 5720 return true 5721 } 5722 func (p *ExamplePartial2) Field3DeepEqual(src int32) bool { 5723 5724 if p.Status != src { 5725 return false 5726 } 5727 return true 5728 } 5729 func (p *ExamplePartial2) Field4DeepEqual(src *bool) bool { 5730 5731 if p.Header == src { 5732 return true 5733 } else if p.Header == nil || src == nil { 5734 return false 5735 } 5736 if *p.Header != *src { 5737 return false 5738 } 5739 return true 5740 } 5741 func (p *ExamplePartial2) Field6DeepEqual(src int64) bool { 5742 5743 if p.Code != src { 5744 return false 5745 } 5746 return true 5747 } 5748 func (p *ExamplePartial2) Field32767DeepEqual(src float64) bool { 5749 5750 if p.Subfix != src { 5751 return false 5752 } 5753 return true 5754 } 5755 func (p *ExamplePartial2) Field7DeepEqual(src *InnerBasePartial) bool { 5756 5757 if !p.InnerBase.DeepEqual(src) { 5758 return false 5759 } 5760 return true 5761 } 5762 func (p *ExamplePartial2) Field255DeepEqual(src *base.BaseResp) bool { 5763 5764 if !p.BaseResp.DeepEqual(src) { 5765 return false 5766 } 5767 return true 5768 } 5769 5770 type InnerBasePartial struct { 5771 Bool bool `thrift:"Bool,1" json:"Bool"` 5772 Base *base.Base `thrift:"Base,255" json:"Base"` 5773 } 5774 5775 func NewInnerBasePartial() *InnerBasePartial { 5776 return &InnerBasePartial{} 5777 } 5778 5779 func (p *InnerBasePartial) GetBool() (v bool) { 5780 return p.Bool 5781 } 5782 5783 var InnerBasePartial_Base_DEFAULT *base.Base 5784 5785 func (p *InnerBasePartial) GetBase() (v *base.Base) { 5786 if !p.IsSetBase() { 5787 return InnerBasePartial_Base_DEFAULT 5788 } 5789 return p.Base 5790 } 5791 func (p *InnerBasePartial) SetBool(val bool) { 5792 p.Bool = val 5793 } 5794 func (p *InnerBasePartial) SetBase(val *base.Base) { 5795 p.Base = val 5796 } 5797 5798 var fieldIDToName_InnerBasePartial = map[int16]string{ 5799 1: "Bool", 5800 255: "Base", 5801 } 5802 5803 func (p *InnerBasePartial) IsSetBase() bool { 5804 return p.Base != nil 5805 } 5806 5807 func (p *InnerBasePartial) Read(iprot thrift.TProtocol) (err error) { 5808 5809 var fieldTypeId thrift.TType 5810 var fieldId int16 5811 5812 if _, err = iprot.ReadStructBegin(); err != nil { 5813 goto ReadStructBeginError 5814 } 5815 5816 for { 5817 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 5818 if err != nil { 5819 goto ReadFieldBeginError 5820 } 5821 if fieldTypeId == thrift.STOP { 5822 break 5823 } 5824 5825 switch fieldId { 5826 case 1: 5827 if fieldTypeId == thrift.BOOL { 5828 if err = p.ReadField1(iprot); err != nil { 5829 goto ReadFieldError 5830 } 5831 } else { 5832 if err = iprot.Skip(fieldTypeId); err != nil { 5833 goto SkipFieldError 5834 } 5835 } 5836 case 255: 5837 if fieldTypeId == thrift.STRUCT { 5838 if err = p.ReadField255(iprot); err != nil { 5839 goto ReadFieldError 5840 } 5841 } else { 5842 if err = iprot.Skip(fieldTypeId); err != nil { 5843 goto SkipFieldError 5844 } 5845 } 5846 default: 5847 if err = iprot.Skip(fieldTypeId); err != nil { 5848 goto SkipFieldError 5849 } 5850 } 5851 5852 if err = iprot.ReadFieldEnd(); err != nil { 5853 goto ReadFieldEndError 5854 } 5855 } 5856 if err = iprot.ReadStructEnd(); err != nil { 5857 goto ReadStructEndError 5858 } 5859 5860 return nil 5861 ReadStructBeginError: 5862 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 5863 ReadFieldBeginError: 5864 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 5865 ReadFieldError: 5866 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_InnerBasePartial[fieldId]), err) 5867 SkipFieldError: 5868 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 5869 5870 ReadFieldEndError: 5871 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 5872 ReadStructEndError: 5873 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 5874 } 5875 5876 func (p *InnerBasePartial) ReadField1(iprot thrift.TProtocol) error { 5877 if v, err := iprot.ReadBool(); err != nil { 5878 return err 5879 } else { 5880 p.Bool = v 5881 } 5882 return nil 5883 } 5884 5885 func (p *InnerBasePartial) ReadField255(iprot thrift.TProtocol) error { 5886 p.Base = base.NewBase() 5887 if err := p.Base.Read(iprot); err != nil { 5888 return err 5889 } 5890 return nil 5891 } 5892 5893 func (p *InnerBasePartial) Write(oprot thrift.TProtocol) (err error) { 5894 var fieldId int16 5895 if err = oprot.WriteStructBegin("InnerBasePartial"); err != nil { 5896 goto WriteStructBeginError 5897 } 5898 if p != nil { 5899 if err = p.writeField1(oprot); err != nil { 5900 fieldId = 1 5901 goto WriteFieldError 5902 } 5903 if err = p.writeField255(oprot); err != nil { 5904 fieldId = 255 5905 goto WriteFieldError 5906 } 5907 5908 } 5909 if err = oprot.WriteFieldStop(); err != nil { 5910 goto WriteFieldStopError 5911 } 5912 if err = oprot.WriteStructEnd(); err != nil { 5913 goto WriteStructEndError 5914 } 5915 return nil 5916 WriteStructBeginError: 5917 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 5918 WriteFieldError: 5919 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 5920 WriteFieldStopError: 5921 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 5922 WriteStructEndError: 5923 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 5924 } 5925 5926 func (p *InnerBasePartial) writeField1(oprot thrift.TProtocol) (err error) { 5927 if err = oprot.WriteFieldBegin("Bool", thrift.BOOL, 1); err != nil { 5928 goto WriteFieldBeginError 5929 } 5930 if err := oprot.WriteBool(p.Bool); err != nil { 5931 return err 5932 } 5933 if err = oprot.WriteFieldEnd(); err != nil { 5934 goto WriteFieldEndError 5935 } 5936 return nil 5937 WriteFieldBeginError: 5938 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 5939 WriteFieldEndError: 5940 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 5941 } 5942 5943 func (p *InnerBasePartial) writeField255(oprot thrift.TProtocol) (err error) { 5944 if err = oprot.WriteFieldBegin("Base", thrift.STRUCT, 255); err != nil { 5945 goto WriteFieldBeginError 5946 } 5947 if err := p.Base.Write(oprot); err != nil { 5948 return err 5949 } 5950 if err = oprot.WriteFieldEnd(); err != nil { 5951 goto WriteFieldEndError 5952 } 5953 return nil 5954 WriteFieldBeginError: 5955 return thrift.PrependError(fmt.Sprintf("%T write field 255 begin error: ", p), err) 5956 WriteFieldEndError: 5957 return thrift.PrependError(fmt.Sprintf("%T write field 255 end error: ", p), err) 5958 } 5959 5960 func (p *InnerBasePartial) String() string { 5961 if p == nil { 5962 return "<nil>" 5963 } 5964 return fmt.Sprintf("InnerBasePartial(%+v)", *p) 5965 } 5966 5967 func (p *InnerBasePartial) DeepEqual(ano *InnerBasePartial) bool { 5968 if p == ano { 5969 return true 5970 } else if p == nil || ano == nil { 5971 return false 5972 } 5973 if !p.Field1DeepEqual(ano.Bool) { 5974 return false 5975 } 5976 if !p.Field255DeepEqual(ano.Base) { 5977 return false 5978 } 5979 return true 5980 } 5981 5982 func (p *InnerBasePartial) Field1DeepEqual(src bool) bool { 5983 5984 if p.Bool != src { 5985 return false 5986 } 5987 return true 5988 } 5989 func (p *InnerBasePartial) Field255DeepEqual(src *base.Base) bool { 5990 5991 if !p.Base.DeepEqual(src) { 5992 return false 5993 } 5994 return true 5995 } 5996 5997 type ExampleFallback struct { 5998 Msg string `thrift:"Msg,2" json:"Msg"` 5999 Heeader string `thrift:"Heeader,3" json:"Heeader"` 6000 } 6001 6002 func NewExampleFallback() *ExampleFallback { 6003 return &ExampleFallback{} 6004 } 6005 6006 func (p *ExampleFallback) GetMsg() (v string) { 6007 return p.Msg 6008 } 6009 6010 func (p *ExampleFallback) GetHeeader() (v string) { 6011 return p.Heeader 6012 } 6013 func (p *ExampleFallback) SetMsg(val string) { 6014 p.Msg = val 6015 } 6016 func (p *ExampleFallback) SetHeeader(val string) { 6017 p.Heeader = val 6018 } 6019 6020 var fieldIDToName_ExampleFallback = map[int16]string{ 6021 2: "Msg", 6022 3: "Heeader", 6023 } 6024 6025 func (p *ExampleFallback) Read(iprot thrift.TProtocol) (err error) { 6026 6027 var fieldTypeId thrift.TType 6028 var fieldId int16 6029 6030 if _, err = iprot.ReadStructBegin(); err != nil { 6031 goto ReadStructBeginError 6032 } 6033 6034 for { 6035 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 6036 if err != nil { 6037 goto ReadFieldBeginError 6038 } 6039 if fieldTypeId == thrift.STOP { 6040 break 6041 } 6042 6043 switch fieldId { 6044 case 2: 6045 if fieldTypeId == thrift.STRING { 6046 if err = p.ReadField2(iprot); err != nil { 6047 goto ReadFieldError 6048 } 6049 } else { 6050 if err = iprot.Skip(fieldTypeId); err != nil { 6051 goto SkipFieldError 6052 } 6053 } 6054 case 3: 6055 if fieldTypeId == thrift.STRING { 6056 if err = p.ReadField3(iprot); err != nil { 6057 goto ReadFieldError 6058 } 6059 } else { 6060 if err = iprot.Skip(fieldTypeId); err != nil { 6061 goto SkipFieldError 6062 } 6063 } 6064 default: 6065 if err = iprot.Skip(fieldTypeId); err != nil { 6066 goto SkipFieldError 6067 } 6068 } 6069 6070 if err = iprot.ReadFieldEnd(); err != nil { 6071 goto ReadFieldEndError 6072 } 6073 } 6074 if err = iprot.ReadStructEnd(); err != nil { 6075 goto ReadStructEndError 6076 } 6077 6078 return nil 6079 ReadStructBeginError: 6080 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 6081 ReadFieldBeginError: 6082 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 6083 ReadFieldError: 6084 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleFallback[fieldId]), err) 6085 SkipFieldError: 6086 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 6087 6088 ReadFieldEndError: 6089 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 6090 ReadStructEndError: 6091 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6092 } 6093 6094 func (p *ExampleFallback) ReadField2(iprot thrift.TProtocol) error { 6095 if v, err := iprot.ReadString(); err != nil { 6096 return err 6097 } else { 6098 p.Msg = v 6099 } 6100 return nil 6101 } 6102 6103 func (p *ExampleFallback) ReadField3(iprot thrift.TProtocol) error { 6104 if v, err := iprot.ReadString(); err != nil { 6105 return err 6106 } else { 6107 p.Heeader = v 6108 } 6109 return nil 6110 } 6111 6112 func (p *ExampleFallback) Write(oprot thrift.TProtocol) (err error) { 6113 var fieldId int16 6114 if err = oprot.WriteStructBegin("ExampleFallback"); err != nil { 6115 goto WriteStructBeginError 6116 } 6117 if p != nil { 6118 if err = p.writeField2(oprot); err != nil { 6119 fieldId = 2 6120 goto WriteFieldError 6121 } 6122 if err = p.writeField3(oprot); err != nil { 6123 fieldId = 3 6124 goto WriteFieldError 6125 } 6126 6127 } 6128 if err = oprot.WriteFieldStop(); err != nil { 6129 goto WriteFieldStopError 6130 } 6131 if err = oprot.WriteStructEnd(); err != nil { 6132 goto WriteStructEndError 6133 } 6134 return nil 6135 WriteStructBeginError: 6136 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 6137 WriteFieldError: 6138 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 6139 WriteFieldStopError: 6140 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 6141 WriteStructEndError: 6142 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 6143 } 6144 6145 func (p *ExampleFallback) writeField2(oprot thrift.TProtocol) (err error) { 6146 if err = oprot.WriteFieldBegin("Msg", thrift.STRING, 2); err != nil { 6147 goto WriteFieldBeginError 6148 } 6149 if err := oprot.WriteString(p.Msg); err != nil { 6150 return err 6151 } 6152 if err = oprot.WriteFieldEnd(); err != nil { 6153 goto WriteFieldEndError 6154 } 6155 return nil 6156 WriteFieldBeginError: 6157 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 6158 WriteFieldEndError: 6159 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 6160 } 6161 6162 func (p *ExampleFallback) writeField3(oprot thrift.TProtocol) (err error) { 6163 if err = oprot.WriteFieldBegin("Heeader", thrift.STRING, 3); err != nil { 6164 goto WriteFieldBeginError 6165 } 6166 if err := oprot.WriteString(p.Heeader); err != nil { 6167 return err 6168 } 6169 if err = oprot.WriteFieldEnd(); err != nil { 6170 goto WriteFieldEndError 6171 } 6172 return nil 6173 WriteFieldBeginError: 6174 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 6175 WriteFieldEndError: 6176 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 6177 } 6178 6179 func (p *ExampleFallback) String() string { 6180 if p == nil { 6181 return "<nil>" 6182 } 6183 return fmt.Sprintf("ExampleFallback(%+v)", *p) 6184 } 6185 6186 func (p *ExampleFallback) DeepEqual(ano *ExampleFallback) bool { 6187 if p == ano { 6188 return true 6189 } else if p == nil || ano == nil { 6190 return false 6191 } 6192 if !p.Field2DeepEqual(ano.Msg) { 6193 return false 6194 } 6195 if !p.Field3DeepEqual(ano.Heeader) { 6196 return false 6197 } 6198 return true 6199 } 6200 6201 func (p *ExampleFallback) Field2DeepEqual(src string) bool { 6202 6203 if strings.Compare(p.Msg, src) != 0 { 6204 return false 6205 } 6206 return true 6207 } 6208 func (p *ExampleFallback) Field3DeepEqual(src string) bool { 6209 6210 if strings.Compare(p.Heeader, src) != 0 { 6211 return false 6212 } 6213 return true 6214 } 6215 6216 type InnerCode struct { 6217 C1 int64 `thrift:"C1,1" json:"C1"` 6218 C2 int16 `thrift:"C2,2" json:"code"` 6219 C3 []*InnerCode `thrift:"C3,3" json:"C3"` 6220 } 6221 6222 func NewInnerCode() *InnerCode { 6223 return &InnerCode{} 6224 } 6225 6226 func (p *InnerCode) GetC1() (v int64) { 6227 return p.C1 6228 } 6229 6230 func (p *InnerCode) GetC2() (v int16) { 6231 return p.C2 6232 } 6233 6234 func (p *InnerCode) GetC3() (v []*InnerCode) { 6235 return p.C3 6236 } 6237 func (p *InnerCode) SetC1(val int64) { 6238 p.C1 = val 6239 } 6240 func (p *InnerCode) SetC2(val int16) { 6241 p.C2 = val 6242 } 6243 func (p *InnerCode) SetC3(val []*InnerCode) { 6244 p.C3 = val 6245 } 6246 6247 var fieldIDToName_InnerCode = map[int16]string{ 6248 1: "C1", 6249 2: "C2", 6250 3: "C3", 6251 } 6252 6253 func (p *InnerCode) Read(iprot thrift.TProtocol) (err error) { 6254 6255 var fieldTypeId thrift.TType 6256 var fieldId int16 6257 6258 if _, err = iprot.ReadStructBegin(); err != nil { 6259 goto ReadStructBeginError 6260 } 6261 6262 for { 6263 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 6264 if err != nil { 6265 goto ReadFieldBeginError 6266 } 6267 if fieldTypeId == thrift.STOP { 6268 break 6269 } 6270 6271 switch fieldId { 6272 case 1: 6273 if fieldTypeId == thrift.I64 { 6274 if err = p.ReadField1(iprot); err != nil { 6275 goto ReadFieldError 6276 } 6277 } else { 6278 if err = iprot.Skip(fieldTypeId); err != nil { 6279 goto SkipFieldError 6280 } 6281 } 6282 case 2: 6283 if fieldTypeId == thrift.I16 { 6284 if err = p.ReadField2(iprot); err != nil { 6285 goto ReadFieldError 6286 } 6287 } else { 6288 if err = iprot.Skip(fieldTypeId); err != nil { 6289 goto SkipFieldError 6290 } 6291 } 6292 case 3: 6293 if fieldTypeId == thrift.LIST { 6294 if err = p.ReadField3(iprot); err != nil { 6295 goto ReadFieldError 6296 } 6297 } else { 6298 if err = iprot.Skip(fieldTypeId); err != nil { 6299 goto SkipFieldError 6300 } 6301 } 6302 default: 6303 if err = iprot.Skip(fieldTypeId); err != nil { 6304 goto SkipFieldError 6305 } 6306 } 6307 6308 if err = iprot.ReadFieldEnd(); err != nil { 6309 goto ReadFieldEndError 6310 } 6311 } 6312 if err = iprot.ReadStructEnd(); err != nil { 6313 goto ReadStructEndError 6314 } 6315 6316 return nil 6317 ReadStructBeginError: 6318 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 6319 ReadFieldBeginError: 6320 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 6321 ReadFieldError: 6322 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_InnerCode[fieldId]), err) 6323 SkipFieldError: 6324 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 6325 6326 ReadFieldEndError: 6327 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 6328 ReadStructEndError: 6329 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6330 } 6331 6332 func (p *InnerCode) ReadField1(iprot thrift.TProtocol) error { 6333 if v, err := iprot.ReadI64(); err != nil { 6334 return err 6335 } else { 6336 p.C1 = v 6337 } 6338 return nil 6339 } 6340 6341 func (p *InnerCode) ReadField2(iprot thrift.TProtocol) error { 6342 if v, err := iprot.ReadI16(); err != nil { 6343 return err 6344 } else { 6345 p.C2 = v 6346 } 6347 return nil 6348 } 6349 6350 func (p *InnerCode) ReadField3(iprot thrift.TProtocol) error { 6351 _, size, err := iprot.ReadListBegin() 6352 if err != nil { 6353 return err 6354 } 6355 p.C3 = make([]*InnerCode, 0, size) 6356 for i := 0; i < size; i++ { 6357 _elem := NewInnerCode() 6358 if err := _elem.Read(iprot); err != nil { 6359 return err 6360 } 6361 6362 p.C3 = append(p.C3, _elem) 6363 } 6364 if err := iprot.ReadListEnd(); err != nil { 6365 return err 6366 } 6367 return nil 6368 } 6369 6370 func (p *InnerCode) Write(oprot thrift.TProtocol) (err error) { 6371 var fieldId int16 6372 if err = oprot.WriteStructBegin("InnerCode"); err != nil { 6373 goto WriteStructBeginError 6374 } 6375 if p != nil { 6376 if err = p.writeField1(oprot); err != nil { 6377 fieldId = 1 6378 goto WriteFieldError 6379 } 6380 if err = p.writeField2(oprot); err != nil { 6381 fieldId = 2 6382 goto WriteFieldError 6383 } 6384 if err = p.writeField3(oprot); err != nil { 6385 fieldId = 3 6386 goto WriteFieldError 6387 } 6388 6389 } 6390 if err = oprot.WriteFieldStop(); err != nil { 6391 goto WriteFieldStopError 6392 } 6393 if err = oprot.WriteStructEnd(); err != nil { 6394 goto WriteStructEndError 6395 } 6396 return nil 6397 WriteStructBeginError: 6398 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 6399 WriteFieldError: 6400 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 6401 WriteFieldStopError: 6402 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 6403 WriteStructEndError: 6404 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 6405 } 6406 6407 func (p *InnerCode) writeField1(oprot thrift.TProtocol) (err error) { 6408 if err = oprot.WriteFieldBegin("C1", thrift.I64, 1); err != nil { 6409 goto WriteFieldBeginError 6410 } 6411 if err := oprot.WriteI64(p.C1); err != nil { 6412 return err 6413 } 6414 if err = oprot.WriteFieldEnd(); err != nil { 6415 goto WriteFieldEndError 6416 } 6417 return nil 6418 WriteFieldBeginError: 6419 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 6420 WriteFieldEndError: 6421 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 6422 } 6423 6424 func (p *InnerCode) writeField2(oprot thrift.TProtocol) (err error) { 6425 if err = oprot.WriteFieldBegin("C2", thrift.I16, 2); err != nil { 6426 goto WriteFieldBeginError 6427 } 6428 if err := oprot.WriteI16(p.C2); err != nil { 6429 return err 6430 } 6431 if err = oprot.WriteFieldEnd(); err != nil { 6432 goto WriteFieldEndError 6433 } 6434 return nil 6435 WriteFieldBeginError: 6436 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 6437 WriteFieldEndError: 6438 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 6439 } 6440 6441 func (p *InnerCode) writeField3(oprot thrift.TProtocol) (err error) { 6442 if err = oprot.WriteFieldBegin("C3", thrift.LIST, 3); err != nil { 6443 goto WriteFieldBeginError 6444 } 6445 if err := oprot.WriteListBegin(thrift.STRUCT, len(p.C3)); err != nil { 6446 return err 6447 } 6448 for _, v := range p.C3 { 6449 if err := v.Write(oprot); err != nil { 6450 return err 6451 } 6452 } 6453 if err := oprot.WriteListEnd(); err != nil { 6454 return err 6455 } 6456 if err = oprot.WriteFieldEnd(); err != nil { 6457 goto WriteFieldEndError 6458 } 6459 return nil 6460 WriteFieldBeginError: 6461 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 6462 WriteFieldEndError: 6463 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 6464 } 6465 6466 func (p *InnerCode) String() string { 6467 if p == nil { 6468 return "<nil>" 6469 } 6470 return fmt.Sprintf("InnerCode(%+v)", *p) 6471 } 6472 6473 func (p *InnerCode) DeepEqual(ano *InnerCode) bool { 6474 if p == ano { 6475 return true 6476 } else if p == nil || ano == nil { 6477 return false 6478 } 6479 if !p.Field1DeepEqual(ano.C1) { 6480 return false 6481 } 6482 if !p.Field2DeepEqual(ano.C2) { 6483 return false 6484 } 6485 if !p.Field3DeepEqual(ano.C3) { 6486 return false 6487 } 6488 return true 6489 } 6490 6491 func (p *InnerCode) Field1DeepEqual(src int64) bool { 6492 6493 if p.C1 != src { 6494 return false 6495 } 6496 return true 6497 } 6498 func (p *InnerCode) Field2DeepEqual(src int16) bool { 6499 6500 if p.C2 != src { 6501 return false 6502 } 6503 return true 6504 } 6505 func (p *InnerCode) Field3DeepEqual(src []*InnerCode) bool { 6506 6507 if len(p.C3) != len(src) { 6508 return false 6509 } 6510 for i, v := range p.C3 { 6511 _src := src[i] 6512 if !v.DeepEqual(_src) { 6513 return false 6514 } 6515 } 6516 return true 6517 } 6518 6519 type ExampleApiBody struct { 6520 Code int64 `thrift:"Code,1" json:"Code"` 6521 Code2 int16 `thrift:"Code2,2" json:"code"` 6522 InnerCode *InnerCode `thrift:"InnerCode,3" json:"InnerCode"` 6523 } 6524 6525 func NewExampleApiBody() *ExampleApiBody { 6526 return &ExampleApiBody{} 6527 } 6528 6529 func (p *ExampleApiBody) GetCode() (v int64) { 6530 return p.Code 6531 } 6532 6533 func (p *ExampleApiBody) GetCode2() (v int16) { 6534 return p.Code2 6535 } 6536 6537 var ExampleApiBody_InnerCode_DEFAULT *InnerCode 6538 6539 func (p *ExampleApiBody) GetInnerCode() (v *InnerCode) { 6540 if !p.IsSetInnerCode() { 6541 return ExampleApiBody_InnerCode_DEFAULT 6542 } 6543 return p.InnerCode 6544 } 6545 func (p *ExampleApiBody) SetCode(val int64) { 6546 p.Code = val 6547 } 6548 func (p *ExampleApiBody) SetCode2(val int16) { 6549 p.Code2 = val 6550 } 6551 func (p *ExampleApiBody) SetInnerCode(val *InnerCode) { 6552 p.InnerCode = val 6553 } 6554 6555 var fieldIDToName_ExampleApiBody = map[int16]string{ 6556 1: "Code", 6557 2: "Code2", 6558 3: "InnerCode", 6559 } 6560 6561 func (p *ExampleApiBody) IsSetInnerCode() bool { 6562 return p.InnerCode != nil 6563 } 6564 6565 func (p *ExampleApiBody) Read(iprot thrift.TProtocol) (err error) { 6566 6567 var fieldTypeId thrift.TType 6568 var fieldId int16 6569 6570 if _, err = iprot.ReadStructBegin(); err != nil { 6571 goto ReadStructBeginError 6572 } 6573 6574 for { 6575 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 6576 if err != nil { 6577 goto ReadFieldBeginError 6578 } 6579 if fieldTypeId == thrift.STOP { 6580 break 6581 } 6582 6583 switch fieldId { 6584 case 1: 6585 if fieldTypeId == thrift.I64 { 6586 if err = p.ReadField1(iprot); err != nil { 6587 goto ReadFieldError 6588 } 6589 } else { 6590 if err = iprot.Skip(fieldTypeId); err != nil { 6591 goto SkipFieldError 6592 } 6593 } 6594 case 2: 6595 if fieldTypeId == thrift.I16 { 6596 if err = p.ReadField2(iprot); err != nil { 6597 goto ReadFieldError 6598 } 6599 } else { 6600 if err = iprot.Skip(fieldTypeId); err != nil { 6601 goto SkipFieldError 6602 } 6603 } 6604 case 3: 6605 if fieldTypeId == thrift.STRUCT { 6606 if err = p.ReadField3(iprot); err != nil { 6607 goto ReadFieldError 6608 } 6609 } else { 6610 if err = iprot.Skip(fieldTypeId); err != nil { 6611 goto SkipFieldError 6612 } 6613 } 6614 default: 6615 if err = iprot.Skip(fieldTypeId); err != nil { 6616 goto SkipFieldError 6617 } 6618 } 6619 6620 if err = iprot.ReadFieldEnd(); err != nil { 6621 goto ReadFieldEndError 6622 } 6623 } 6624 if err = iprot.ReadStructEnd(); err != nil { 6625 goto ReadStructEndError 6626 } 6627 6628 return nil 6629 ReadStructBeginError: 6630 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 6631 ReadFieldBeginError: 6632 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 6633 ReadFieldError: 6634 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleApiBody[fieldId]), err) 6635 SkipFieldError: 6636 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 6637 6638 ReadFieldEndError: 6639 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 6640 ReadStructEndError: 6641 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6642 } 6643 6644 func (p *ExampleApiBody) ReadField1(iprot thrift.TProtocol) error { 6645 if v, err := iprot.ReadI64(); err != nil { 6646 return err 6647 } else { 6648 p.Code = v 6649 } 6650 return nil 6651 } 6652 6653 func (p *ExampleApiBody) ReadField2(iprot thrift.TProtocol) error { 6654 if v, err := iprot.ReadI16(); err != nil { 6655 return err 6656 } else { 6657 p.Code2 = v 6658 } 6659 return nil 6660 } 6661 6662 func (p *ExampleApiBody) ReadField3(iprot thrift.TProtocol) error { 6663 p.InnerCode = NewInnerCode() 6664 if err := p.InnerCode.Read(iprot); err != nil { 6665 return err 6666 } 6667 return nil 6668 } 6669 6670 func (p *ExampleApiBody) Write(oprot thrift.TProtocol) (err error) { 6671 var fieldId int16 6672 if err = oprot.WriteStructBegin("ExampleApiBody"); err != nil { 6673 goto WriteStructBeginError 6674 } 6675 if p != nil { 6676 if err = p.writeField1(oprot); err != nil { 6677 fieldId = 1 6678 goto WriteFieldError 6679 } 6680 if err = p.writeField2(oprot); err != nil { 6681 fieldId = 2 6682 goto WriteFieldError 6683 } 6684 if err = p.writeField3(oprot); err != nil { 6685 fieldId = 3 6686 goto WriteFieldError 6687 } 6688 6689 } 6690 if err = oprot.WriteFieldStop(); err != nil { 6691 goto WriteFieldStopError 6692 } 6693 if err = oprot.WriteStructEnd(); err != nil { 6694 goto WriteStructEndError 6695 } 6696 return nil 6697 WriteStructBeginError: 6698 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 6699 WriteFieldError: 6700 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 6701 WriteFieldStopError: 6702 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 6703 WriteStructEndError: 6704 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 6705 } 6706 6707 func (p *ExampleApiBody) writeField1(oprot thrift.TProtocol) (err error) { 6708 if err = oprot.WriteFieldBegin("Code", thrift.I64, 1); err != nil { 6709 goto WriteFieldBeginError 6710 } 6711 if err := oprot.WriteI64(p.Code); err != nil { 6712 return err 6713 } 6714 if err = oprot.WriteFieldEnd(); err != nil { 6715 goto WriteFieldEndError 6716 } 6717 return nil 6718 WriteFieldBeginError: 6719 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 6720 WriteFieldEndError: 6721 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 6722 } 6723 6724 func (p *ExampleApiBody) writeField2(oprot thrift.TProtocol) (err error) { 6725 if err = oprot.WriteFieldBegin("Code2", thrift.I16, 2); err != nil { 6726 goto WriteFieldBeginError 6727 } 6728 if err := oprot.WriteI16(p.Code2); err != nil { 6729 return err 6730 } 6731 if err = oprot.WriteFieldEnd(); err != nil { 6732 goto WriteFieldEndError 6733 } 6734 return nil 6735 WriteFieldBeginError: 6736 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 6737 WriteFieldEndError: 6738 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 6739 } 6740 6741 func (p *ExampleApiBody) writeField3(oprot thrift.TProtocol) (err error) { 6742 if err = oprot.WriteFieldBegin("InnerCode", thrift.STRUCT, 3); err != nil { 6743 goto WriteFieldBeginError 6744 } 6745 if err := p.InnerCode.Write(oprot); err != nil { 6746 return err 6747 } 6748 if err = oprot.WriteFieldEnd(); err != nil { 6749 goto WriteFieldEndError 6750 } 6751 return nil 6752 WriteFieldBeginError: 6753 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 6754 WriteFieldEndError: 6755 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 6756 } 6757 6758 func (p *ExampleApiBody) String() string { 6759 if p == nil { 6760 return "<nil>" 6761 } 6762 return fmt.Sprintf("ExampleApiBody(%+v)", *p) 6763 } 6764 6765 func (p *ExampleApiBody) DeepEqual(ano *ExampleApiBody) bool { 6766 if p == ano { 6767 return true 6768 } else if p == nil || ano == nil { 6769 return false 6770 } 6771 if !p.Field1DeepEqual(ano.Code) { 6772 return false 6773 } 6774 if !p.Field2DeepEqual(ano.Code2) { 6775 return false 6776 } 6777 if !p.Field3DeepEqual(ano.InnerCode) { 6778 return false 6779 } 6780 return true 6781 } 6782 6783 func (p *ExampleApiBody) Field1DeepEqual(src int64) bool { 6784 6785 if p.Code != src { 6786 return false 6787 } 6788 return true 6789 } 6790 func (p *ExampleApiBody) Field2DeepEqual(src int16) bool { 6791 6792 if p.Code2 != src { 6793 return false 6794 } 6795 return true 6796 } 6797 func (p *ExampleApiBody) Field3DeepEqual(src *InnerCode) bool { 6798 6799 if !p.InnerCode.DeepEqual(src) { 6800 return false 6801 } 6802 return true 6803 } 6804 6805 type InnerJSON struct { 6806 A string `thrift:"A,1" json:"a"` 6807 B int64 `thrift:"B,2" json:"b"` 6808 InnerForm float64 `thrift:"inner_form,3" json:"inner_form"` 6809 } 6810 6811 func NewInnerJSON() *InnerJSON { 6812 return &InnerJSON{} 6813 } 6814 6815 func (p *InnerJSON) GetA() (v string) { 6816 return p.A 6817 } 6818 6819 func (p *InnerJSON) GetB() (v int64) { 6820 return p.B 6821 } 6822 6823 func (p *InnerJSON) GetInnerForm() (v float64) { 6824 return p.InnerForm 6825 } 6826 func (p *InnerJSON) SetA(val string) { 6827 p.A = val 6828 } 6829 func (p *InnerJSON) SetB(val int64) { 6830 p.B = val 6831 } 6832 func (p *InnerJSON) SetInnerForm(val float64) { 6833 p.InnerForm = val 6834 } 6835 6836 var fieldIDToName_InnerJSON = map[int16]string{ 6837 1: "A", 6838 2: "B", 6839 3: "inner_form", 6840 } 6841 6842 func (p *InnerJSON) Read(iprot thrift.TProtocol) (err error) { 6843 6844 var fieldTypeId thrift.TType 6845 var fieldId int16 6846 6847 if _, err = iprot.ReadStructBegin(); err != nil { 6848 goto ReadStructBeginError 6849 } 6850 6851 for { 6852 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 6853 if err != nil { 6854 goto ReadFieldBeginError 6855 } 6856 if fieldTypeId == thrift.STOP { 6857 break 6858 } 6859 6860 switch fieldId { 6861 case 1: 6862 if fieldTypeId == thrift.STRING { 6863 if err = p.ReadField1(iprot); err != nil { 6864 goto ReadFieldError 6865 } 6866 } else { 6867 if err = iprot.Skip(fieldTypeId); err != nil { 6868 goto SkipFieldError 6869 } 6870 } 6871 case 2: 6872 if fieldTypeId == thrift.I64 { 6873 if err = p.ReadField2(iprot); err != nil { 6874 goto ReadFieldError 6875 } 6876 } else { 6877 if err = iprot.Skip(fieldTypeId); err != nil { 6878 goto SkipFieldError 6879 } 6880 } 6881 case 3: 6882 if fieldTypeId == thrift.DOUBLE { 6883 if err = p.ReadField3(iprot); err != nil { 6884 goto ReadFieldError 6885 } 6886 } else { 6887 if err = iprot.Skip(fieldTypeId); err != nil { 6888 goto SkipFieldError 6889 } 6890 } 6891 default: 6892 if err = iprot.Skip(fieldTypeId); err != nil { 6893 goto SkipFieldError 6894 } 6895 } 6896 6897 if err = iprot.ReadFieldEnd(); err != nil { 6898 goto ReadFieldEndError 6899 } 6900 } 6901 if err = iprot.ReadStructEnd(); err != nil { 6902 goto ReadStructEndError 6903 } 6904 6905 return nil 6906 ReadStructBeginError: 6907 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 6908 ReadFieldBeginError: 6909 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 6910 ReadFieldError: 6911 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_InnerJSON[fieldId]), err) 6912 SkipFieldError: 6913 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 6914 6915 ReadFieldEndError: 6916 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 6917 ReadStructEndError: 6918 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 6919 } 6920 6921 func (p *InnerJSON) ReadField1(iprot thrift.TProtocol) error { 6922 if v, err := iprot.ReadString(); err != nil { 6923 return err 6924 } else { 6925 p.A = v 6926 } 6927 return nil 6928 } 6929 6930 func (p *InnerJSON) ReadField2(iprot thrift.TProtocol) error { 6931 if v, err := iprot.ReadI64(); err != nil { 6932 return err 6933 } else { 6934 p.B = v 6935 } 6936 return nil 6937 } 6938 6939 func (p *InnerJSON) ReadField3(iprot thrift.TProtocol) error { 6940 if v, err := iprot.ReadDouble(); err != nil { 6941 return err 6942 } else { 6943 p.InnerForm = v 6944 } 6945 return nil 6946 } 6947 6948 func (p *InnerJSON) Write(oprot thrift.TProtocol) (err error) { 6949 var fieldId int16 6950 if err = oprot.WriteStructBegin("InnerJSON"); err != nil { 6951 goto WriteStructBeginError 6952 } 6953 if p != nil { 6954 if err = p.writeField1(oprot); err != nil { 6955 fieldId = 1 6956 goto WriteFieldError 6957 } 6958 if err = p.writeField2(oprot); err != nil { 6959 fieldId = 2 6960 goto WriteFieldError 6961 } 6962 if err = p.writeField3(oprot); err != nil { 6963 fieldId = 3 6964 goto WriteFieldError 6965 } 6966 6967 } 6968 if err = oprot.WriteFieldStop(); err != nil { 6969 goto WriteFieldStopError 6970 } 6971 if err = oprot.WriteStructEnd(); err != nil { 6972 goto WriteStructEndError 6973 } 6974 return nil 6975 WriteStructBeginError: 6976 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 6977 WriteFieldError: 6978 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 6979 WriteFieldStopError: 6980 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 6981 WriteStructEndError: 6982 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 6983 } 6984 6985 func (p *InnerJSON) writeField1(oprot thrift.TProtocol) (err error) { 6986 if err = oprot.WriteFieldBegin("A", thrift.STRING, 1); err != nil { 6987 goto WriteFieldBeginError 6988 } 6989 if err := oprot.WriteString(p.A); err != nil { 6990 return err 6991 } 6992 if err = oprot.WriteFieldEnd(); err != nil { 6993 goto WriteFieldEndError 6994 } 6995 return nil 6996 WriteFieldBeginError: 6997 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 6998 WriteFieldEndError: 6999 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 7000 } 7001 7002 func (p *InnerJSON) writeField2(oprot thrift.TProtocol) (err error) { 7003 if err = oprot.WriteFieldBegin("B", thrift.I64, 2); err != nil { 7004 goto WriteFieldBeginError 7005 } 7006 if err := oprot.WriteI64(p.B); err != nil { 7007 return err 7008 } 7009 if err = oprot.WriteFieldEnd(); err != nil { 7010 goto WriteFieldEndError 7011 } 7012 return nil 7013 WriteFieldBeginError: 7014 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 7015 WriteFieldEndError: 7016 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 7017 } 7018 7019 func (p *InnerJSON) writeField3(oprot thrift.TProtocol) (err error) { 7020 if err = oprot.WriteFieldBegin("inner_form", thrift.DOUBLE, 3); err != nil { 7021 goto WriteFieldBeginError 7022 } 7023 if err := oprot.WriteDouble(p.InnerForm); err != nil { 7024 return err 7025 } 7026 if err = oprot.WriteFieldEnd(); err != nil { 7027 goto WriteFieldEndError 7028 } 7029 return nil 7030 WriteFieldBeginError: 7031 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 7032 WriteFieldEndError: 7033 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 7034 } 7035 7036 func (p *InnerJSON) String() string { 7037 if p == nil { 7038 return "<nil>" 7039 } 7040 return fmt.Sprintf("InnerJSON(%+v)", *p) 7041 } 7042 7043 func (p *InnerJSON) DeepEqual(ano *InnerJSON) bool { 7044 if p == ano { 7045 return true 7046 } else if p == nil || ano == nil { 7047 return false 7048 } 7049 if !p.Field1DeepEqual(ano.A) { 7050 return false 7051 } 7052 if !p.Field2DeepEqual(ano.B) { 7053 return false 7054 } 7055 if !p.Field3DeepEqual(ano.InnerForm) { 7056 return false 7057 } 7058 return true 7059 } 7060 7061 func (p *InnerJSON) Field1DeepEqual(src string) bool { 7062 7063 if strings.Compare(p.A, src) != 0 { 7064 return false 7065 } 7066 return true 7067 } 7068 func (p *InnerJSON) Field2DeepEqual(src int64) bool { 7069 7070 if p.B != src { 7071 return false 7072 } 7073 return true 7074 } 7075 func (p *InnerJSON) Field3DeepEqual(src float64) bool { 7076 7077 if p.InnerForm != src { 7078 return false 7079 } 7080 return true 7081 } 7082 7083 type ExamplePostForm struct { 7084 Query string `thrift:"Query,1" json:"Query"` 7085 Form string `thrift:"Form,2" json:"Form"` 7086 JSON *InnerJSON `thrift:"JSON,3" json:"JSON"` 7087 } 7088 7089 func NewExamplePostForm() *ExamplePostForm { 7090 return &ExamplePostForm{} 7091 } 7092 7093 func (p *ExamplePostForm) GetQuery() (v string) { 7094 return p.Query 7095 } 7096 7097 func (p *ExamplePostForm) GetForm() (v string) { 7098 return p.Form 7099 } 7100 7101 var ExamplePostForm_JSON_DEFAULT *InnerJSON 7102 7103 func (p *ExamplePostForm) GetJSON() (v *InnerJSON) { 7104 if !p.IsSetJSON() { 7105 return ExamplePostForm_JSON_DEFAULT 7106 } 7107 return p.JSON 7108 } 7109 func (p *ExamplePostForm) SetQuery(val string) { 7110 p.Query = val 7111 } 7112 func (p *ExamplePostForm) SetForm(val string) { 7113 p.Form = val 7114 } 7115 func (p *ExamplePostForm) SetJSON(val *InnerJSON) { 7116 p.JSON = val 7117 } 7118 7119 var fieldIDToName_ExamplePostForm = map[int16]string{ 7120 1: "Query", 7121 2: "Form", 7122 3: "JSON", 7123 } 7124 7125 func (p *ExamplePostForm) IsSetJSON() bool { 7126 return p.JSON != nil 7127 } 7128 7129 func (p *ExamplePostForm) Read(iprot thrift.TProtocol) (err error) { 7130 7131 var fieldTypeId thrift.TType 7132 var fieldId int16 7133 7134 if _, err = iprot.ReadStructBegin(); err != nil { 7135 goto ReadStructBeginError 7136 } 7137 7138 for { 7139 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 7140 if err != nil { 7141 goto ReadFieldBeginError 7142 } 7143 if fieldTypeId == thrift.STOP { 7144 break 7145 } 7146 7147 switch fieldId { 7148 case 1: 7149 if fieldTypeId == thrift.STRING { 7150 if err = p.ReadField1(iprot); err != nil { 7151 goto ReadFieldError 7152 } 7153 } else { 7154 if err = iprot.Skip(fieldTypeId); err != nil { 7155 goto SkipFieldError 7156 } 7157 } 7158 case 2: 7159 if fieldTypeId == thrift.STRING { 7160 if err = p.ReadField2(iprot); err != nil { 7161 goto ReadFieldError 7162 } 7163 } else { 7164 if err = iprot.Skip(fieldTypeId); err != nil { 7165 goto SkipFieldError 7166 } 7167 } 7168 case 3: 7169 if fieldTypeId == thrift.STRUCT { 7170 if err = p.ReadField3(iprot); err != nil { 7171 goto ReadFieldError 7172 } 7173 } else { 7174 if err = iprot.Skip(fieldTypeId); err != nil { 7175 goto SkipFieldError 7176 } 7177 } 7178 default: 7179 if err = iprot.Skip(fieldTypeId); err != nil { 7180 goto SkipFieldError 7181 } 7182 } 7183 7184 if err = iprot.ReadFieldEnd(); err != nil { 7185 goto ReadFieldEndError 7186 } 7187 } 7188 if err = iprot.ReadStructEnd(); err != nil { 7189 goto ReadStructEndError 7190 } 7191 7192 return nil 7193 ReadStructBeginError: 7194 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 7195 ReadFieldBeginError: 7196 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 7197 ReadFieldError: 7198 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExamplePostForm[fieldId]), err) 7199 SkipFieldError: 7200 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 7201 7202 ReadFieldEndError: 7203 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 7204 ReadStructEndError: 7205 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7206 } 7207 7208 func (p *ExamplePostForm) ReadField1(iprot thrift.TProtocol) error { 7209 if v, err := iprot.ReadString(); err != nil { 7210 return err 7211 } else { 7212 p.Query = v 7213 } 7214 return nil 7215 } 7216 7217 func (p *ExamplePostForm) ReadField2(iprot thrift.TProtocol) error { 7218 if v, err := iprot.ReadString(); err != nil { 7219 return err 7220 } else { 7221 p.Form = v 7222 } 7223 return nil 7224 } 7225 7226 func (p *ExamplePostForm) ReadField3(iprot thrift.TProtocol) error { 7227 p.JSON = NewInnerJSON() 7228 if err := p.JSON.Read(iprot); err != nil { 7229 return err 7230 } 7231 return nil 7232 } 7233 7234 func (p *ExamplePostForm) Write(oprot thrift.TProtocol) (err error) { 7235 var fieldId int16 7236 if err = oprot.WriteStructBegin("ExamplePostForm"); err != nil { 7237 goto WriteStructBeginError 7238 } 7239 if p != nil { 7240 if err = p.writeField1(oprot); err != nil { 7241 fieldId = 1 7242 goto WriteFieldError 7243 } 7244 if err = p.writeField2(oprot); err != nil { 7245 fieldId = 2 7246 goto WriteFieldError 7247 } 7248 if err = p.writeField3(oprot); err != nil { 7249 fieldId = 3 7250 goto WriteFieldError 7251 } 7252 7253 } 7254 if err = oprot.WriteFieldStop(); err != nil { 7255 goto WriteFieldStopError 7256 } 7257 if err = oprot.WriteStructEnd(); err != nil { 7258 goto WriteStructEndError 7259 } 7260 return nil 7261 WriteStructBeginError: 7262 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 7263 WriteFieldError: 7264 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 7265 WriteFieldStopError: 7266 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 7267 WriteStructEndError: 7268 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 7269 } 7270 7271 func (p *ExamplePostForm) writeField1(oprot thrift.TProtocol) (err error) { 7272 if err = oprot.WriteFieldBegin("Query", thrift.STRING, 1); err != nil { 7273 goto WriteFieldBeginError 7274 } 7275 if err := oprot.WriteString(p.Query); err != nil { 7276 return err 7277 } 7278 if err = oprot.WriteFieldEnd(); err != nil { 7279 goto WriteFieldEndError 7280 } 7281 return nil 7282 WriteFieldBeginError: 7283 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 7284 WriteFieldEndError: 7285 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 7286 } 7287 7288 func (p *ExamplePostForm) writeField2(oprot thrift.TProtocol) (err error) { 7289 if err = oprot.WriteFieldBegin("Form", thrift.STRING, 2); err != nil { 7290 goto WriteFieldBeginError 7291 } 7292 if err := oprot.WriteString(p.Form); err != nil { 7293 return err 7294 } 7295 if err = oprot.WriteFieldEnd(); err != nil { 7296 goto WriteFieldEndError 7297 } 7298 return nil 7299 WriteFieldBeginError: 7300 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 7301 WriteFieldEndError: 7302 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 7303 } 7304 7305 func (p *ExamplePostForm) writeField3(oprot thrift.TProtocol) (err error) { 7306 if err = oprot.WriteFieldBegin("JSON", thrift.STRUCT, 3); err != nil { 7307 goto WriteFieldBeginError 7308 } 7309 if err := p.JSON.Write(oprot); err != nil { 7310 return err 7311 } 7312 if err = oprot.WriteFieldEnd(); err != nil { 7313 goto WriteFieldEndError 7314 } 7315 return nil 7316 WriteFieldBeginError: 7317 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 7318 WriteFieldEndError: 7319 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 7320 } 7321 7322 func (p *ExamplePostForm) String() string { 7323 if p == nil { 7324 return "<nil>" 7325 } 7326 return fmt.Sprintf("ExamplePostForm(%+v)", *p) 7327 } 7328 7329 func (p *ExamplePostForm) DeepEqual(ano *ExamplePostForm) bool { 7330 if p == ano { 7331 return true 7332 } else if p == nil || ano == nil { 7333 return false 7334 } 7335 if !p.Field1DeepEqual(ano.Query) { 7336 return false 7337 } 7338 if !p.Field2DeepEqual(ano.Form) { 7339 return false 7340 } 7341 if !p.Field3DeepEqual(ano.JSON) { 7342 return false 7343 } 7344 return true 7345 } 7346 7347 func (p *ExamplePostForm) Field1DeepEqual(src string) bool { 7348 7349 if strings.Compare(p.Query, src) != 0 { 7350 return false 7351 } 7352 return true 7353 } 7354 func (p *ExamplePostForm) Field2DeepEqual(src string) bool { 7355 7356 if strings.Compare(p.Form, src) != 0 { 7357 return false 7358 } 7359 return true 7360 } 7361 func (p *ExamplePostForm) Field3DeepEqual(src *InnerJSON) bool { 7362 7363 if !p.JSON.DeepEqual(src) { 7364 return false 7365 } 7366 return true 7367 } 7368 7369 type InnerStruct struct { 7370 InnerJSON string `thrift:"InnerJSON,1" json:"inner_json"` 7371 Must string `thrift:"Must,2,required" json:"Must"` 7372 } 7373 7374 func NewInnerStruct() *InnerStruct { 7375 return &InnerStruct{} 7376 } 7377 7378 func (p *InnerStruct) GetInnerJSON() (v string) { 7379 return p.InnerJSON 7380 } 7381 7382 func (p *InnerStruct) GetMust() (v string) { 7383 return p.Must 7384 } 7385 func (p *InnerStruct) SetInnerJSON(val string) { 7386 p.InnerJSON = val 7387 } 7388 func (p *InnerStruct) SetMust(val string) { 7389 p.Must = val 7390 } 7391 7392 var fieldIDToName_InnerStruct = map[int16]string{ 7393 1: "InnerJSON", 7394 2: "Must", 7395 } 7396 7397 func (p *InnerStruct) Read(iprot thrift.TProtocol) (err error) { 7398 7399 var fieldTypeId thrift.TType 7400 var fieldId int16 7401 var issetMust bool = false 7402 7403 if _, err = iprot.ReadStructBegin(); err != nil { 7404 goto ReadStructBeginError 7405 } 7406 7407 for { 7408 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 7409 if err != nil { 7410 goto ReadFieldBeginError 7411 } 7412 if fieldTypeId == thrift.STOP { 7413 break 7414 } 7415 7416 switch fieldId { 7417 case 1: 7418 if fieldTypeId == thrift.STRING { 7419 if err = p.ReadField1(iprot); err != nil { 7420 goto ReadFieldError 7421 } 7422 } else { 7423 if err = iprot.Skip(fieldTypeId); err != nil { 7424 goto SkipFieldError 7425 } 7426 } 7427 case 2: 7428 if fieldTypeId == thrift.STRING { 7429 if err = p.ReadField2(iprot); err != nil { 7430 goto ReadFieldError 7431 } 7432 issetMust = true 7433 } else { 7434 if err = iprot.Skip(fieldTypeId); err != nil { 7435 goto SkipFieldError 7436 } 7437 } 7438 default: 7439 if err = iprot.Skip(fieldTypeId); err != nil { 7440 goto SkipFieldError 7441 } 7442 } 7443 7444 if err = iprot.ReadFieldEnd(); err != nil { 7445 goto ReadFieldEndError 7446 } 7447 } 7448 if err = iprot.ReadStructEnd(); err != nil { 7449 goto ReadStructEndError 7450 } 7451 7452 if !issetMust { 7453 fieldId = 2 7454 goto RequiredFieldNotSetError 7455 } 7456 return nil 7457 ReadStructBeginError: 7458 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 7459 ReadFieldBeginError: 7460 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 7461 ReadFieldError: 7462 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_InnerStruct[fieldId]), err) 7463 SkipFieldError: 7464 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 7465 7466 ReadFieldEndError: 7467 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 7468 ReadStructEndError: 7469 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7470 RequiredFieldNotSetError: 7471 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field %s is not set", fieldIDToName_InnerStruct[fieldId])) 7472 } 7473 7474 func (p *InnerStruct) ReadField1(iprot thrift.TProtocol) error { 7475 if v, err := iprot.ReadString(); err != nil { 7476 return err 7477 } else { 7478 p.InnerJSON = v 7479 } 7480 return nil 7481 } 7482 7483 func (p *InnerStruct) ReadField2(iprot thrift.TProtocol) error { 7484 if v, err := iprot.ReadString(); err != nil { 7485 return err 7486 } else { 7487 p.Must = v 7488 } 7489 return nil 7490 } 7491 7492 func (p *InnerStruct) Write(oprot thrift.TProtocol) (err error) { 7493 var fieldId int16 7494 if err = oprot.WriteStructBegin("InnerStruct"); err != nil { 7495 goto WriteStructBeginError 7496 } 7497 if p != nil { 7498 if err = p.writeField1(oprot); err != nil { 7499 fieldId = 1 7500 goto WriteFieldError 7501 } 7502 if err = p.writeField2(oprot); err != nil { 7503 fieldId = 2 7504 goto WriteFieldError 7505 } 7506 7507 } 7508 if err = oprot.WriteFieldStop(); err != nil { 7509 goto WriteFieldStopError 7510 } 7511 if err = oprot.WriteStructEnd(); err != nil { 7512 goto WriteStructEndError 7513 } 7514 return nil 7515 WriteStructBeginError: 7516 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 7517 WriteFieldError: 7518 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 7519 WriteFieldStopError: 7520 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 7521 WriteStructEndError: 7522 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 7523 } 7524 7525 func (p *InnerStruct) writeField1(oprot thrift.TProtocol) (err error) { 7526 if err = oprot.WriteFieldBegin("InnerJSON", thrift.STRING, 1); err != nil { 7527 goto WriteFieldBeginError 7528 } 7529 if err := oprot.WriteString(p.InnerJSON); err != nil { 7530 return err 7531 } 7532 if err = oprot.WriteFieldEnd(); err != nil { 7533 goto WriteFieldEndError 7534 } 7535 return nil 7536 WriteFieldBeginError: 7537 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 7538 WriteFieldEndError: 7539 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 7540 } 7541 7542 func (p *InnerStruct) writeField2(oprot thrift.TProtocol) (err error) { 7543 if err = oprot.WriteFieldBegin("Must", thrift.STRING, 2); err != nil { 7544 goto WriteFieldBeginError 7545 } 7546 if err := oprot.WriteString(p.Must); err != nil { 7547 return err 7548 } 7549 if err = oprot.WriteFieldEnd(); err != nil { 7550 goto WriteFieldEndError 7551 } 7552 return nil 7553 WriteFieldBeginError: 7554 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 7555 WriteFieldEndError: 7556 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 7557 } 7558 7559 func (p *InnerStruct) String() string { 7560 if p == nil { 7561 return "<nil>" 7562 } 7563 return fmt.Sprintf("InnerStruct(%+v)", *p) 7564 } 7565 7566 func (p *InnerStruct) DeepEqual(ano *InnerStruct) bool { 7567 if p == ano { 7568 return true 7569 } else if p == nil || ano == nil { 7570 return false 7571 } 7572 if !p.Field1DeepEqual(ano.InnerJSON) { 7573 return false 7574 } 7575 if !p.Field2DeepEqual(ano.Must) { 7576 return false 7577 } 7578 return true 7579 } 7580 7581 func (p *InnerStruct) Field1DeepEqual(src string) bool { 7582 7583 if strings.Compare(p.InnerJSON, src) != 0 { 7584 return false 7585 } 7586 return true 7587 } 7588 func (p *InnerStruct) Field2DeepEqual(src string) bool { 7589 7590 if strings.Compare(p.Must, src) != 0 { 7591 return false 7592 } 7593 return true 7594 } 7595 7596 type ExampleDynamicStruct struct { 7597 Query string `thrift:"Query,1,required" json:"Query"` 7598 JSON string `thrift:"JSON,2" json:"json"` 7599 InnerStruct *InnerStruct `thrift:"InnerStruct,3" json:"inner_struct"` 7600 } 7601 7602 func NewExampleDynamicStruct() *ExampleDynamicStruct { 7603 return &ExampleDynamicStruct{} 7604 } 7605 7606 func (p *ExampleDynamicStruct) GetQuery() (v string) { 7607 return p.Query 7608 } 7609 7610 func (p *ExampleDynamicStruct) GetJSON() (v string) { 7611 return p.JSON 7612 } 7613 7614 var ExampleDynamicStruct_InnerStruct_DEFAULT *InnerStruct 7615 7616 func (p *ExampleDynamicStruct) GetInnerStruct() (v *InnerStruct) { 7617 if !p.IsSetInnerStruct() { 7618 return ExampleDynamicStruct_InnerStruct_DEFAULT 7619 } 7620 return p.InnerStruct 7621 } 7622 func (p *ExampleDynamicStruct) SetQuery(val string) { 7623 p.Query = val 7624 } 7625 func (p *ExampleDynamicStruct) SetJSON(val string) { 7626 p.JSON = val 7627 } 7628 func (p *ExampleDynamicStruct) SetInnerStruct(val *InnerStruct) { 7629 p.InnerStruct = val 7630 } 7631 7632 var fieldIDToName_ExampleDynamicStruct = map[int16]string{ 7633 1: "Query", 7634 2: "JSON", 7635 3: "InnerStruct", 7636 } 7637 7638 func (p *ExampleDynamicStruct) IsSetInnerStruct() bool { 7639 return p.InnerStruct != nil 7640 } 7641 7642 func (p *ExampleDynamicStruct) Read(iprot thrift.TProtocol) (err error) { 7643 7644 var fieldTypeId thrift.TType 7645 var fieldId int16 7646 var issetQuery bool = false 7647 7648 if _, err = iprot.ReadStructBegin(); err != nil { 7649 goto ReadStructBeginError 7650 } 7651 7652 for { 7653 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 7654 if err != nil { 7655 goto ReadFieldBeginError 7656 } 7657 if fieldTypeId == thrift.STOP { 7658 break 7659 } 7660 7661 switch fieldId { 7662 case 1: 7663 if fieldTypeId == thrift.STRING { 7664 if err = p.ReadField1(iprot); err != nil { 7665 goto ReadFieldError 7666 } 7667 issetQuery = true 7668 } else { 7669 if err = iprot.Skip(fieldTypeId); err != nil { 7670 goto SkipFieldError 7671 } 7672 } 7673 case 2: 7674 if fieldTypeId == thrift.STRING { 7675 if err = p.ReadField2(iprot); err != nil { 7676 goto ReadFieldError 7677 } 7678 } else { 7679 if err = iprot.Skip(fieldTypeId); err != nil { 7680 goto SkipFieldError 7681 } 7682 } 7683 case 3: 7684 if fieldTypeId == thrift.STRUCT { 7685 if err = p.ReadField3(iprot); err != nil { 7686 goto ReadFieldError 7687 } 7688 } else { 7689 if err = iprot.Skip(fieldTypeId); err != nil { 7690 goto SkipFieldError 7691 } 7692 } 7693 default: 7694 if err = iprot.Skip(fieldTypeId); err != nil { 7695 goto SkipFieldError 7696 } 7697 } 7698 7699 if err = iprot.ReadFieldEnd(); err != nil { 7700 goto ReadFieldEndError 7701 } 7702 } 7703 if err = iprot.ReadStructEnd(); err != nil { 7704 goto ReadStructEndError 7705 } 7706 7707 if !issetQuery { 7708 fieldId = 1 7709 goto RequiredFieldNotSetError 7710 } 7711 return nil 7712 ReadStructBeginError: 7713 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 7714 ReadFieldBeginError: 7715 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 7716 ReadFieldError: 7717 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleDynamicStruct[fieldId]), err) 7718 SkipFieldError: 7719 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 7720 7721 ReadFieldEndError: 7722 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 7723 ReadStructEndError: 7724 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7725 RequiredFieldNotSetError: 7726 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field %s is not set", fieldIDToName_ExampleDynamicStruct[fieldId])) 7727 } 7728 7729 func (p *ExampleDynamicStruct) ReadField1(iprot thrift.TProtocol) error { 7730 if v, err := iprot.ReadString(); err != nil { 7731 return err 7732 } else { 7733 p.Query = v 7734 } 7735 return nil 7736 } 7737 7738 func (p *ExampleDynamicStruct) ReadField2(iprot thrift.TProtocol) error { 7739 if v, err := iprot.ReadString(); err != nil { 7740 return err 7741 } else { 7742 p.JSON = v 7743 } 7744 return nil 7745 } 7746 7747 func (p *ExampleDynamicStruct) ReadField3(iprot thrift.TProtocol) error { 7748 p.InnerStruct = NewInnerStruct() 7749 if err := p.InnerStruct.Read(iprot); err != nil { 7750 return err 7751 } 7752 return nil 7753 } 7754 7755 func (p *ExampleDynamicStruct) Write(oprot thrift.TProtocol) (err error) { 7756 var fieldId int16 7757 if err = oprot.WriteStructBegin("ExampleDynamicStruct"); err != nil { 7758 goto WriteStructBeginError 7759 } 7760 if p != nil { 7761 if err = p.writeField1(oprot); err != nil { 7762 fieldId = 1 7763 goto WriteFieldError 7764 } 7765 if err = p.writeField2(oprot); err != nil { 7766 fieldId = 2 7767 goto WriteFieldError 7768 } 7769 if err = p.writeField3(oprot); err != nil { 7770 fieldId = 3 7771 goto WriteFieldError 7772 } 7773 7774 } 7775 if err = oprot.WriteFieldStop(); err != nil { 7776 goto WriteFieldStopError 7777 } 7778 if err = oprot.WriteStructEnd(); err != nil { 7779 goto WriteStructEndError 7780 } 7781 return nil 7782 WriteStructBeginError: 7783 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 7784 WriteFieldError: 7785 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 7786 WriteFieldStopError: 7787 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 7788 WriteStructEndError: 7789 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 7790 } 7791 7792 func (p *ExampleDynamicStruct) writeField1(oprot thrift.TProtocol) (err error) { 7793 if err = oprot.WriteFieldBegin("Query", thrift.STRING, 1); err != nil { 7794 goto WriteFieldBeginError 7795 } 7796 if err := oprot.WriteString(p.Query); err != nil { 7797 return err 7798 } 7799 if err = oprot.WriteFieldEnd(); err != nil { 7800 goto WriteFieldEndError 7801 } 7802 return nil 7803 WriteFieldBeginError: 7804 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 7805 WriteFieldEndError: 7806 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 7807 } 7808 7809 func (p *ExampleDynamicStruct) writeField2(oprot thrift.TProtocol) (err error) { 7810 if err = oprot.WriteFieldBegin("JSON", thrift.STRING, 2); err != nil { 7811 goto WriteFieldBeginError 7812 } 7813 if err := oprot.WriteString(p.JSON); err != nil { 7814 return err 7815 } 7816 if err = oprot.WriteFieldEnd(); err != nil { 7817 goto WriteFieldEndError 7818 } 7819 return nil 7820 WriteFieldBeginError: 7821 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 7822 WriteFieldEndError: 7823 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 7824 } 7825 7826 func (p *ExampleDynamicStruct) writeField3(oprot thrift.TProtocol) (err error) { 7827 if err = oprot.WriteFieldBegin("InnerStruct", thrift.STRUCT, 3); err != nil { 7828 goto WriteFieldBeginError 7829 } 7830 if err := p.InnerStruct.Write(oprot); err != nil { 7831 return err 7832 } 7833 if err = oprot.WriteFieldEnd(); err != nil { 7834 goto WriteFieldEndError 7835 } 7836 return nil 7837 WriteFieldBeginError: 7838 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 7839 WriteFieldEndError: 7840 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 7841 } 7842 7843 func (p *ExampleDynamicStruct) String() string { 7844 if p == nil { 7845 return "<nil>" 7846 } 7847 return fmt.Sprintf("ExampleDynamicStruct(%+v)", *p) 7848 } 7849 7850 func (p *ExampleDynamicStruct) DeepEqual(ano *ExampleDynamicStruct) bool { 7851 if p == ano { 7852 return true 7853 } else if p == nil || ano == nil { 7854 return false 7855 } 7856 if !p.Field1DeepEqual(ano.Query) { 7857 return false 7858 } 7859 if !p.Field2DeepEqual(ano.JSON) { 7860 return false 7861 } 7862 if !p.Field3DeepEqual(ano.InnerStruct) { 7863 return false 7864 } 7865 return true 7866 } 7867 7868 func (p *ExampleDynamicStruct) Field1DeepEqual(src string) bool { 7869 7870 if strings.Compare(p.Query, src) != 0 { 7871 return false 7872 } 7873 return true 7874 } 7875 func (p *ExampleDynamicStruct) Field2DeepEqual(src string) bool { 7876 7877 if strings.Compare(p.JSON, src) != 0 { 7878 return false 7879 } 7880 return true 7881 } 7882 func (p *ExampleDynamicStruct) Field3DeepEqual(src *InnerStruct) bool { 7883 7884 if !p.InnerStruct.DeepEqual(src) { 7885 return false 7886 } 7887 return true 7888 } 7889 7890 type ExampleBase64Binary struct { 7891 Binary []byte `thrift:"Binary,1" json:"Binary"` 7892 Binary2 []byte `thrift:"Binary2,2" json:"Binary2"` 7893 } 7894 7895 func NewExampleBase64Binary() *ExampleBase64Binary { 7896 return &ExampleBase64Binary{} 7897 } 7898 7899 func (p *ExampleBase64Binary) GetBinary() (v []byte) { 7900 return p.Binary 7901 } 7902 7903 func (p *ExampleBase64Binary) GetBinary2() (v []byte) { 7904 return p.Binary2 7905 } 7906 func (p *ExampleBase64Binary) SetBinary(val []byte) { 7907 p.Binary = val 7908 } 7909 func (p *ExampleBase64Binary) SetBinary2(val []byte) { 7910 p.Binary2 = val 7911 } 7912 7913 var fieldIDToName_ExampleBase64Binary = map[int16]string{ 7914 1: "Binary", 7915 2: "Binary2", 7916 } 7917 7918 func (p *ExampleBase64Binary) Read(iprot thrift.TProtocol) (err error) { 7919 7920 var fieldTypeId thrift.TType 7921 var fieldId int16 7922 7923 if _, err = iprot.ReadStructBegin(); err != nil { 7924 goto ReadStructBeginError 7925 } 7926 7927 for { 7928 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 7929 if err != nil { 7930 goto ReadFieldBeginError 7931 } 7932 if fieldTypeId == thrift.STOP { 7933 break 7934 } 7935 7936 switch fieldId { 7937 case 1: 7938 if fieldTypeId == thrift.STRING { 7939 if err = p.ReadField1(iprot); err != nil { 7940 goto ReadFieldError 7941 } 7942 } else { 7943 if err = iprot.Skip(fieldTypeId); err != nil { 7944 goto SkipFieldError 7945 } 7946 } 7947 case 2: 7948 if fieldTypeId == thrift.STRING { 7949 if err = p.ReadField2(iprot); err != nil { 7950 goto ReadFieldError 7951 } 7952 } else { 7953 if err = iprot.Skip(fieldTypeId); err != nil { 7954 goto SkipFieldError 7955 } 7956 } 7957 default: 7958 if err = iprot.Skip(fieldTypeId); err != nil { 7959 goto SkipFieldError 7960 } 7961 } 7962 7963 if err = iprot.ReadFieldEnd(); err != nil { 7964 goto ReadFieldEndError 7965 } 7966 } 7967 if err = iprot.ReadStructEnd(); err != nil { 7968 goto ReadStructEndError 7969 } 7970 7971 return nil 7972 ReadStructBeginError: 7973 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 7974 ReadFieldBeginError: 7975 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 7976 ReadFieldError: 7977 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleBase64Binary[fieldId]), err) 7978 SkipFieldError: 7979 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 7980 7981 ReadFieldEndError: 7982 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 7983 ReadStructEndError: 7984 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 7985 } 7986 7987 func (p *ExampleBase64Binary) ReadField1(iprot thrift.TProtocol) error { 7988 if v, err := iprot.ReadBinary(); err != nil { 7989 return err 7990 } else { 7991 p.Binary = []byte(v) 7992 } 7993 return nil 7994 } 7995 7996 func (p *ExampleBase64Binary) ReadField2(iprot thrift.TProtocol) error { 7997 if v, err := iprot.ReadBinary(); err != nil { 7998 return err 7999 } else { 8000 p.Binary2 = []byte(v) 8001 } 8002 return nil 8003 } 8004 8005 func (p *ExampleBase64Binary) Write(oprot thrift.TProtocol) (err error) { 8006 var fieldId int16 8007 if err = oprot.WriteStructBegin("ExampleBase64Binary"); err != nil { 8008 goto WriteStructBeginError 8009 } 8010 if p != nil { 8011 if err = p.writeField1(oprot); err != nil { 8012 fieldId = 1 8013 goto WriteFieldError 8014 } 8015 if err = p.writeField2(oprot); err != nil { 8016 fieldId = 2 8017 goto WriteFieldError 8018 } 8019 8020 } 8021 if err = oprot.WriteFieldStop(); err != nil { 8022 goto WriteFieldStopError 8023 } 8024 if err = oprot.WriteStructEnd(); err != nil { 8025 goto WriteStructEndError 8026 } 8027 return nil 8028 WriteStructBeginError: 8029 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 8030 WriteFieldError: 8031 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 8032 WriteFieldStopError: 8033 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 8034 WriteStructEndError: 8035 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 8036 } 8037 8038 func (p *ExampleBase64Binary) writeField1(oprot thrift.TProtocol) (err error) { 8039 if err = oprot.WriteFieldBegin("Binary", thrift.STRING, 1); err != nil { 8040 goto WriteFieldBeginError 8041 } 8042 if err := oprot.WriteBinary([]byte(p.Binary)); err != nil { 8043 return err 8044 } 8045 if err = oprot.WriteFieldEnd(); err != nil { 8046 goto WriteFieldEndError 8047 } 8048 return nil 8049 WriteFieldBeginError: 8050 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 8051 WriteFieldEndError: 8052 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 8053 } 8054 8055 func (p *ExampleBase64Binary) writeField2(oprot thrift.TProtocol) (err error) { 8056 if err = oprot.WriteFieldBegin("Binary2", thrift.STRING, 2); err != nil { 8057 goto WriteFieldBeginError 8058 } 8059 if err := oprot.WriteBinary([]byte(p.Binary2)); err != nil { 8060 return err 8061 } 8062 if err = oprot.WriteFieldEnd(); err != nil { 8063 goto WriteFieldEndError 8064 } 8065 return nil 8066 WriteFieldBeginError: 8067 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 8068 WriteFieldEndError: 8069 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 8070 } 8071 8072 func (p *ExampleBase64Binary) String() string { 8073 if p == nil { 8074 return "<nil>" 8075 } 8076 return fmt.Sprintf("ExampleBase64Binary(%+v)", *p) 8077 } 8078 8079 func (p *ExampleBase64Binary) DeepEqual(ano *ExampleBase64Binary) bool { 8080 if p == ano { 8081 return true 8082 } else if p == nil || ano == nil { 8083 return false 8084 } 8085 if !p.Field1DeepEqual(ano.Binary) { 8086 return false 8087 } 8088 if !p.Field2DeepEqual(ano.Binary2) { 8089 return false 8090 } 8091 return true 8092 } 8093 8094 func (p *ExampleBase64Binary) Field1DeepEqual(src []byte) bool { 8095 8096 if bytes.Compare(p.Binary, src) != 0 { 8097 return false 8098 } 8099 return true 8100 } 8101 func (p *ExampleBase64Binary) Field2DeepEqual(src []byte) bool { 8102 8103 if bytes.Compare(p.Binary2, src) != 0 { 8104 return false 8105 } 8106 return true 8107 } 8108 8109 type ExampleDefaultValue struct { 8110 A string `thrift:"A,1" json:"A"` 8111 B int32 `thrift:"B,2" json:"B"` 8112 C float64 `thrift:"C,3" json:"C"` 8113 D string `thrift:"D,4" json:"D"` 8114 } 8115 8116 func NewExampleDefaultValue() *ExampleDefaultValue { 8117 return &ExampleDefaultValue{ 8118 8119 A: "hello", 8120 B: int32(ref.FOO_A), 8121 C: 1.2, 8122 D: ref.ConstString, 8123 } 8124 } 8125 8126 func (p *ExampleDefaultValue) GetA() (v string) { 8127 return p.A 8128 } 8129 8130 func (p *ExampleDefaultValue) GetB() (v int32) { 8131 return p.B 8132 } 8133 8134 func (p *ExampleDefaultValue) GetC() (v float64) { 8135 return p.C 8136 } 8137 8138 func (p *ExampleDefaultValue) GetD() (v string) { 8139 return p.D 8140 } 8141 func (p *ExampleDefaultValue) SetA(val string) { 8142 p.A = val 8143 } 8144 func (p *ExampleDefaultValue) SetB(val int32) { 8145 p.B = val 8146 } 8147 func (p *ExampleDefaultValue) SetC(val float64) { 8148 p.C = val 8149 } 8150 func (p *ExampleDefaultValue) SetD(val string) { 8151 p.D = val 8152 } 8153 8154 var fieldIDToName_ExampleDefaultValue = map[int16]string{ 8155 1: "A", 8156 2: "B", 8157 3: "C", 8158 4: "D", 8159 } 8160 8161 func (p *ExampleDefaultValue) Read(iprot thrift.TProtocol) (err error) { 8162 8163 var fieldTypeId thrift.TType 8164 var fieldId int16 8165 8166 if _, err = iprot.ReadStructBegin(); err != nil { 8167 goto ReadStructBeginError 8168 } 8169 8170 for { 8171 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 8172 if err != nil { 8173 goto ReadFieldBeginError 8174 } 8175 if fieldTypeId == thrift.STOP { 8176 break 8177 } 8178 8179 switch fieldId { 8180 case 1: 8181 if fieldTypeId == thrift.STRING { 8182 if err = p.ReadField1(iprot); err != nil { 8183 goto ReadFieldError 8184 } 8185 } else { 8186 if err = iprot.Skip(fieldTypeId); err != nil { 8187 goto SkipFieldError 8188 } 8189 } 8190 case 2: 8191 if fieldTypeId == thrift.I32 { 8192 if err = p.ReadField2(iprot); err != nil { 8193 goto ReadFieldError 8194 } 8195 } else { 8196 if err = iprot.Skip(fieldTypeId); err != nil { 8197 goto SkipFieldError 8198 } 8199 } 8200 case 3: 8201 if fieldTypeId == thrift.DOUBLE { 8202 if err = p.ReadField3(iprot); err != nil { 8203 goto ReadFieldError 8204 } 8205 } else { 8206 if err = iprot.Skip(fieldTypeId); err != nil { 8207 goto SkipFieldError 8208 } 8209 } 8210 case 4: 8211 if fieldTypeId == thrift.STRING { 8212 if err = p.ReadField4(iprot); err != nil { 8213 goto ReadFieldError 8214 } 8215 } else { 8216 if err = iprot.Skip(fieldTypeId); err != nil { 8217 goto SkipFieldError 8218 } 8219 } 8220 default: 8221 if err = iprot.Skip(fieldTypeId); err != nil { 8222 goto SkipFieldError 8223 } 8224 } 8225 8226 if err = iprot.ReadFieldEnd(); err != nil { 8227 goto ReadFieldEndError 8228 } 8229 } 8230 if err = iprot.ReadStructEnd(); err != nil { 8231 goto ReadStructEndError 8232 } 8233 8234 return nil 8235 ReadStructBeginError: 8236 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 8237 ReadFieldBeginError: 8238 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 8239 ReadFieldError: 8240 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleDefaultValue[fieldId]), err) 8241 SkipFieldError: 8242 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 8243 8244 ReadFieldEndError: 8245 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 8246 ReadStructEndError: 8247 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 8248 } 8249 8250 func (p *ExampleDefaultValue) ReadField1(iprot thrift.TProtocol) error { 8251 if v, err := iprot.ReadString(); err != nil { 8252 return err 8253 } else { 8254 p.A = v 8255 } 8256 return nil 8257 } 8258 8259 func (p *ExampleDefaultValue) ReadField2(iprot thrift.TProtocol) error { 8260 if v, err := iprot.ReadI32(); err != nil { 8261 return err 8262 } else { 8263 p.B = v 8264 } 8265 return nil 8266 } 8267 8268 func (p *ExampleDefaultValue) ReadField3(iprot thrift.TProtocol) error { 8269 if v, err := iprot.ReadDouble(); err != nil { 8270 return err 8271 } else { 8272 p.C = v 8273 } 8274 return nil 8275 } 8276 8277 func (p *ExampleDefaultValue) ReadField4(iprot thrift.TProtocol) error { 8278 if v, err := iprot.ReadString(); err != nil { 8279 return err 8280 } else { 8281 p.D = v 8282 } 8283 return nil 8284 } 8285 8286 func (p *ExampleDefaultValue) Write(oprot thrift.TProtocol) (err error) { 8287 var fieldId int16 8288 if err = oprot.WriteStructBegin("ExampleDefaultValue"); err != nil { 8289 goto WriteStructBeginError 8290 } 8291 if p != nil { 8292 if err = p.writeField1(oprot); err != nil { 8293 fieldId = 1 8294 goto WriteFieldError 8295 } 8296 if err = p.writeField2(oprot); err != nil { 8297 fieldId = 2 8298 goto WriteFieldError 8299 } 8300 if err = p.writeField3(oprot); err != nil { 8301 fieldId = 3 8302 goto WriteFieldError 8303 } 8304 if err = p.writeField4(oprot); err != nil { 8305 fieldId = 4 8306 goto WriteFieldError 8307 } 8308 8309 } 8310 if err = oprot.WriteFieldStop(); err != nil { 8311 goto WriteFieldStopError 8312 } 8313 if err = oprot.WriteStructEnd(); err != nil { 8314 goto WriteStructEndError 8315 } 8316 return nil 8317 WriteStructBeginError: 8318 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 8319 WriteFieldError: 8320 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 8321 WriteFieldStopError: 8322 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 8323 WriteStructEndError: 8324 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 8325 } 8326 8327 func (p *ExampleDefaultValue) writeField1(oprot thrift.TProtocol) (err error) { 8328 if err = oprot.WriteFieldBegin("A", thrift.STRING, 1); err != nil { 8329 goto WriteFieldBeginError 8330 } 8331 if err := oprot.WriteString(p.A); err != nil { 8332 return err 8333 } 8334 if err = oprot.WriteFieldEnd(); err != nil { 8335 goto WriteFieldEndError 8336 } 8337 return nil 8338 WriteFieldBeginError: 8339 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 8340 WriteFieldEndError: 8341 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 8342 } 8343 8344 func (p *ExampleDefaultValue) writeField2(oprot thrift.TProtocol) (err error) { 8345 if err = oprot.WriteFieldBegin("B", thrift.I32, 2); err != nil { 8346 goto WriteFieldBeginError 8347 } 8348 if err := oprot.WriteI32(p.B); err != nil { 8349 return err 8350 } 8351 if err = oprot.WriteFieldEnd(); err != nil { 8352 goto WriteFieldEndError 8353 } 8354 return nil 8355 WriteFieldBeginError: 8356 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 8357 WriteFieldEndError: 8358 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 8359 } 8360 8361 func (p *ExampleDefaultValue) writeField3(oprot thrift.TProtocol) (err error) { 8362 if err = oprot.WriteFieldBegin("C", thrift.DOUBLE, 3); err != nil { 8363 goto WriteFieldBeginError 8364 } 8365 if err := oprot.WriteDouble(p.C); err != nil { 8366 return err 8367 } 8368 if err = oprot.WriteFieldEnd(); err != nil { 8369 goto WriteFieldEndError 8370 } 8371 return nil 8372 WriteFieldBeginError: 8373 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 8374 WriteFieldEndError: 8375 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 8376 } 8377 8378 func (p *ExampleDefaultValue) writeField4(oprot thrift.TProtocol) (err error) { 8379 if err = oprot.WriteFieldBegin("D", thrift.STRING, 4); err != nil { 8380 goto WriteFieldBeginError 8381 } 8382 if err := oprot.WriteString(p.D); err != nil { 8383 return err 8384 } 8385 if err = oprot.WriteFieldEnd(); err != nil { 8386 goto WriteFieldEndError 8387 } 8388 return nil 8389 WriteFieldBeginError: 8390 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 8391 WriteFieldEndError: 8392 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 8393 } 8394 8395 func (p *ExampleDefaultValue) String() string { 8396 if p == nil { 8397 return "<nil>" 8398 } 8399 return fmt.Sprintf("ExampleDefaultValue(%+v)", *p) 8400 } 8401 8402 func (p *ExampleDefaultValue) DeepEqual(ano *ExampleDefaultValue) bool { 8403 if p == ano { 8404 return true 8405 } else if p == nil || ano == nil { 8406 return false 8407 } 8408 if !p.Field1DeepEqual(ano.A) { 8409 return false 8410 } 8411 if !p.Field2DeepEqual(ano.B) { 8412 return false 8413 } 8414 if !p.Field3DeepEqual(ano.C) { 8415 return false 8416 } 8417 if !p.Field4DeepEqual(ano.D) { 8418 return false 8419 } 8420 return true 8421 } 8422 8423 func (p *ExampleDefaultValue) Field1DeepEqual(src string) bool { 8424 8425 if strings.Compare(p.A, src) != 0 { 8426 return false 8427 } 8428 return true 8429 } 8430 func (p *ExampleDefaultValue) Field2DeepEqual(src int32) bool { 8431 8432 if p.B != src { 8433 return false 8434 } 8435 return true 8436 } 8437 func (p *ExampleDefaultValue) Field3DeepEqual(src float64) bool { 8438 8439 if p.C != src { 8440 return false 8441 } 8442 return true 8443 } 8444 func (p *ExampleDefaultValue) Field4DeepEqual(src string) bool { 8445 8446 if strings.Compare(p.D, src) != 0 { 8447 return false 8448 } 8449 return true 8450 } 8451 8452 type ExampleOptionalDefaultValue struct { 8453 A string `thrift:"A,1" json:"A,omitempty"` 8454 B int32 `thrift:"B,2,required" json:"B"` 8455 C float64 `thrift:"C,3" json:"C,omitempty"` 8456 D string `thrift:"D,4,required" json:"D"` 8457 E *string `thrift:"E,5" json:"E,omitempty"` 8458 F *string `thrift:"F,6" json:"F,omitempty"` 8459 } 8460 8461 func NewExampleOptionalDefaultValue() *ExampleOptionalDefaultValue { 8462 return &ExampleOptionalDefaultValue{ 8463 8464 A: "hello", 8465 B: int32(ref.FOO_A), 8466 C: 1.2, 8467 D: ref.ConstString, 8468 } 8469 } 8470 8471 var ExampleOptionalDefaultValue_A_DEFAULT string = "hello" 8472 8473 func (p *ExampleOptionalDefaultValue) GetA() (v string) { 8474 if !p.IsSetA() { 8475 return ExampleOptionalDefaultValue_A_DEFAULT 8476 } 8477 return p.A 8478 } 8479 8480 func (p *ExampleOptionalDefaultValue) GetB() (v int32) { 8481 return p.B 8482 } 8483 8484 var ExampleOptionalDefaultValue_C_DEFAULT float64 = 1.2 8485 8486 func (p *ExampleOptionalDefaultValue) GetC() (v float64) { 8487 if !p.IsSetC() { 8488 return ExampleOptionalDefaultValue_C_DEFAULT 8489 } 8490 return p.C 8491 } 8492 8493 func (p *ExampleOptionalDefaultValue) GetD() (v string) { 8494 return p.D 8495 } 8496 8497 var ExampleOptionalDefaultValue_E_DEFAULT string 8498 8499 func (p *ExampleOptionalDefaultValue) GetE() (v string) { 8500 if !p.IsSetE() { 8501 return ExampleOptionalDefaultValue_E_DEFAULT 8502 } 8503 return *p.E 8504 } 8505 8506 var ExampleOptionalDefaultValue_F_DEFAULT string 8507 8508 func (p *ExampleOptionalDefaultValue) GetF() (v string) { 8509 if !p.IsSetF() { 8510 return ExampleOptionalDefaultValue_F_DEFAULT 8511 } 8512 return *p.F 8513 } 8514 func (p *ExampleOptionalDefaultValue) SetA(val string) { 8515 p.A = val 8516 } 8517 func (p *ExampleOptionalDefaultValue) SetB(val int32) { 8518 p.B = val 8519 } 8520 func (p *ExampleOptionalDefaultValue) SetC(val float64) { 8521 p.C = val 8522 } 8523 func (p *ExampleOptionalDefaultValue) SetD(val string) { 8524 p.D = val 8525 } 8526 func (p *ExampleOptionalDefaultValue) SetE(val *string) { 8527 p.E = val 8528 } 8529 func (p *ExampleOptionalDefaultValue) SetF(val *string) { 8530 p.F = val 8531 } 8532 8533 var fieldIDToName_ExampleOptionalDefaultValue = map[int16]string{ 8534 1: "A", 8535 2: "B", 8536 3: "C", 8537 4: "D", 8538 5: "E", 8539 6: "F", 8540 } 8541 8542 func (p *ExampleOptionalDefaultValue) IsSetA() bool { 8543 return p.A != ExampleOptionalDefaultValue_A_DEFAULT 8544 } 8545 8546 func (p *ExampleOptionalDefaultValue) IsSetC() bool { 8547 return p.C != ExampleOptionalDefaultValue_C_DEFAULT 8548 } 8549 8550 func (p *ExampleOptionalDefaultValue) IsSetE() bool { 8551 return p.E != nil 8552 } 8553 8554 func (p *ExampleOptionalDefaultValue) IsSetF() bool { 8555 return p.F != nil 8556 } 8557 8558 func (p *ExampleOptionalDefaultValue) Read(iprot thrift.TProtocol) (err error) { 8559 8560 var fieldTypeId thrift.TType 8561 var fieldId int16 8562 var issetB bool = false 8563 var issetD bool = false 8564 8565 if _, err = iprot.ReadStructBegin(); err != nil { 8566 goto ReadStructBeginError 8567 } 8568 8569 for { 8570 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 8571 if err != nil { 8572 goto ReadFieldBeginError 8573 } 8574 if fieldTypeId == thrift.STOP { 8575 break 8576 } 8577 8578 switch fieldId { 8579 case 1: 8580 if fieldTypeId == thrift.STRING { 8581 if err = p.ReadField1(iprot); err != nil { 8582 goto ReadFieldError 8583 } 8584 } else { 8585 if err = iprot.Skip(fieldTypeId); err != nil { 8586 goto SkipFieldError 8587 } 8588 } 8589 case 2: 8590 if fieldTypeId == thrift.I32 { 8591 if err = p.ReadField2(iprot); err != nil { 8592 goto ReadFieldError 8593 } 8594 issetB = true 8595 } else { 8596 if err = iprot.Skip(fieldTypeId); err != nil { 8597 goto SkipFieldError 8598 } 8599 } 8600 case 3: 8601 if fieldTypeId == thrift.DOUBLE { 8602 if err = p.ReadField3(iprot); err != nil { 8603 goto ReadFieldError 8604 } 8605 } else { 8606 if err = iprot.Skip(fieldTypeId); err != nil { 8607 goto SkipFieldError 8608 } 8609 } 8610 case 4: 8611 if fieldTypeId == thrift.STRING { 8612 if err = p.ReadField4(iprot); err != nil { 8613 goto ReadFieldError 8614 } 8615 issetD = true 8616 } else { 8617 if err = iprot.Skip(fieldTypeId); err != nil { 8618 goto SkipFieldError 8619 } 8620 } 8621 case 5: 8622 if fieldTypeId == thrift.STRING { 8623 if err = p.ReadField5(iprot); err != nil { 8624 goto ReadFieldError 8625 } 8626 } else { 8627 if err = iprot.Skip(fieldTypeId); err != nil { 8628 goto SkipFieldError 8629 } 8630 } 8631 case 6: 8632 if fieldTypeId == thrift.STRING { 8633 if err = p.ReadField6(iprot); err != nil { 8634 goto ReadFieldError 8635 } 8636 } else { 8637 if err = iprot.Skip(fieldTypeId); err != nil { 8638 goto SkipFieldError 8639 } 8640 } 8641 default: 8642 if err = iprot.Skip(fieldTypeId); err != nil { 8643 goto SkipFieldError 8644 } 8645 } 8646 8647 if err = iprot.ReadFieldEnd(); err != nil { 8648 goto ReadFieldEndError 8649 } 8650 } 8651 if err = iprot.ReadStructEnd(); err != nil { 8652 goto ReadStructEndError 8653 } 8654 8655 if !issetB { 8656 fieldId = 2 8657 goto RequiredFieldNotSetError 8658 } 8659 8660 if !issetD { 8661 fieldId = 4 8662 goto RequiredFieldNotSetError 8663 } 8664 return nil 8665 ReadStructBeginError: 8666 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 8667 ReadFieldBeginError: 8668 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 8669 ReadFieldError: 8670 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleOptionalDefaultValue[fieldId]), err) 8671 SkipFieldError: 8672 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 8673 8674 ReadFieldEndError: 8675 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 8676 ReadStructEndError: 8677 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 8678 RequiredFieldNotSetError: 8679 return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field %s is not set", fieldIDToName_ExampleOptionalDefaultValue[fieldId])) 8680 } 8681 8682 func (p *ExampleOptionalDefaultValue) ReadField1(iprot thrift.TProtocol) error { 8683 if v, err := iprot.ReadString(); err != nil { 8684 return err 8685 } else { 8686 p.A = v 8687 } 8688 return nil 8689 } 8690 8691 func (p *ExampleOptionalDefaultValue) ReadField2(iprot thrift.TProtocol) error { 8692 if v, err := iprot.ReadI32(); err != nil { 8693 return err 8694 } else { 8695 p.B = v 8696 } 8697 return nil 8698 } 8699 8700 func (p *ExampleOptionalDefaultValue) ReadField3(iprot thrift.TProtocol) error { 8701 if v, err := iprot.ReadDouble(); err != nil { 8702 return err 8703 } else { 8704 p.C = v 8705 } 8706 return nil 8707 } 8708 8709 func (p *ExampleOptionalDefaultValue) ReadField4(iprot thrift.TProtocol) error { 8710 if v, err := iprot.ReadString(); err != nil { 8711 return err 8712 } else { 8713 p.D = v 8714 } 8715 return nil 8716 } 8717 8718 func (p *ExampleOptionalDefaultValue) ReadField5(iprot thrift.TProtocol) error { 8719 if v, err := iprot.ReadString(); err != nil { 8720 return err 8721 } else { 8722 p.E = &v 8723 } 8724 return nil 8725 } 8726 8727 func (p *ExampleOptionalDefaultValue) ReadField6(iprot thrift.TProtocol) error { 8728 if v, err := iprot.ReadString(); err != nil { 8729 return err 8730 } else { 8731 p.F = &v 8732 } 8733 return nil 8734 } 8735 8736 func (p *ExampleOptionalDefaultValue) Write(oprot thrift.TProtocol) (err error) { 8737 var fieldId int16 8738 if err = oprot.WriteStructBegin("ExampleOptionalDefaultValue"); err != nil { 8739 goto WriteStructBeginError 8740 } 8741 if p != nil { 8742 if err = p.writeField1(oprot); err != nil { 8743 fieldId = 1 8744 goto WriteFieldError 8745 } 8746 if err = p.writeField2(oprot); err != nil { 8747 fieldId = 2 8748 goto WriteFieldError 8749 } 8750 if err = p.writeField3(oprot); err != nil { 8751 fieldId = 3 8752 goto WriteFieldError 8753 } 8754 if err = p.writeField4(oprot); err != nil { 8755 fieldId = 4 8756 goto WriteFieldError 8757 } 8758 if err = p.writeField5(oprot); err != nil { 8759 fieldId = 5 8760 goto WriteFieldError 8761 } 8762 if err = p.writeField6(oprot); err != nil { 8763 fieldId = 6 8764 goto WriteFieldError 8765 } 8766 8767 } 8768 if err = oprot.WriteFieldStop(); err != nil { 8769 goto WriteFieldStopError 8770 } 8771 if err = oprot.WriteStructEnd(); err != nil { 8772 goto WriteStructEndError 8773 } 8774 return nil 8775 WriteStructBeginError: 8776 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 8777 WriteFieldError: 8778 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 8779 WriteFieldStopError: 8780 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 8781 WriteStructEndError: 8782 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 8783 } 8784 8785 func (p *ExampleOptionalDefaultValue) writeField1(oprot thrift.TProtocol) (err error) { 8786 if p.IsSetA() { 8787 if err = oprot.WriteFieldBegin("A", thrift.STRING, 1); err != nil { 8788 goto WriteFieldBeginError 8789 } 8790 if err := oprot.WriteString(p.A); err != nil { 8791 return err 8792 } 8793 if err = oprot.WriteFieldEnd(); err != nil { 8794 goto WriteFieldEndError 8795 } 8796 } 8797 return nil 8798 WriteFieldBeginError: 8799 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 8800 WriteFieldEndError: 8801 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 8802 } 8803 8804 func (p *ExampleOptionalDefaultValue) writeField2(oprot thrift.TProtocol) (err error) { 8805 if err = oprot.WriteFieldBegin("B", thrift.I32, 2); err != nil { 8806 goto WriteFieldBeginError 8807 } 8808 if err := oprot.WriteI32(p.B); err != nil { 8809 return err 8810 } 8811 if err = oprot.WriteFieldEnd(); err != nil { 8812 goto WriteFieldEndError 8813 } 8814 return nil 8815 WriteFieldBeginError: 8816 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 8817 WriteFieldEndError: 8818 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 8819 } 8820 8821 func (p *ExampleOptionalDefaultValue) writeField3(oprot thrift.TProtocol) (err error) { 8822 if p.IsSetC() { 8823 if err = oprot.WriteFieldBegin("C", thrift.DOUBLE, 3); err != nil { 8824 goto WriteFieldBeginError 8825 } 8826 if err := oprot.WriteDouble(p.C); err != nil { 8827 return err 8828 } 8829 if err = oprot.WriteFieldEnd(); err != nil { 8830 goto WriteFieldEndError 8831 } 8832 } 8833 return nil 8834 WriteFieldBeginError: 8835 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 8836 WriteFieldEndError: 8837 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 8838 } 8839 8840 func (p *ExampleOptionalDefaultValue) writeField4(oprot thrift.TProtocol) (err error) { 8841 if err = oprot.WriteFieldBegin("D", thrift.STRING, 4); err != nil { 8842 goto WriteFieldBeginError 8843 } 8844 if err := oprot.WriteString(p.D); err != nil { 8845 return err 8846 } 8847 if err = oprot.WriteFieldEnd(); err != nil { 8848 goto WriteFieldEndError 8849 } 8850 return nil 8851 WriteFieldBeginError: 8852 return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) 8853 WriteFieldEndError: 8854 return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) 8855 } 8856 8857 func (p *ExampleOptionalDefaultValue) writeField5(oprot thrift.TProtocol) (err error) { 8858 if p.IsSetE() { 8859 if err = oprot.WriteFieldBegin("E", thrift.STRING, 5); err != nil { 8860 goto WriteFieldBeginError 8861 } 8862 if err := oprot.WriteString(*p.E); err != nil { 8863 return err 8864 } 8865 if err = oprot.WriteFieldEnd(); err != nil { 8866 goto WriteFieldEndError 8867 } 8868 } 8869 return nil 8870 WriteFieldBeginError: 8871 return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) 8872 WriteFieldEndError: 8873 return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) 8874 } 8875 8876 func (p *ExampleOptionalDefaultValue) writeField6(oprot thrift.TProtocol) (err error) { 8877 if p.IsSetF() { 8878 if err = oprot.WriteFieldBegin("F", thrift.STRING, 6); err != nil { 8879 goto WriteFieldBeginError 8880 } 8881 if err := oprot.WriteString(*p.F); err != nil { 8882 return err 8883 } 8884 if err = oprot.WriteFieldEnd(); err != nil { 8885 goto WriteFieldEndError 8886 } 8887 } 8888 return nil 8889 WriteFieldBeginError: 8890 return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) 8891 WriteFieldEndError: 8892 return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) 8893 } 8894 8895 func (p *ExampleOptionalDefaultValue) String() string { 8896 if p == nil { 8897 return "<nil>" 8898 } 8899 return fmt.Sprintf("ExampleOptionalDefaultValue(%+v)", *p) 8900 } 8901 8902 func (p *ExampleOptionalDefaultValue) DeepEqual(ano *ExampleOptionalDefaultValue) bool { 8903 if p == ano { 8904 return true 8905 } else if p == nil || ano == nil { 8906 return false 8907 } 8908 if !p.Field1DeepEqual(ano.A) { 8909 return false 8910 } 8911 if !p.Field2DeepEqual(ano.B) { 8912 return false 8913 } 8914 if !p.Field3DeepEqual(ano.C) { 8915 return false 8916 } 8917 if !p.Field4DeepEqual(ano.D) { 8918 return false 8919 } 8920 if !p.Field5DeepEqual(ano.E) { 8921 return false 8922 } 8923 if !p.Field6DeepEqual(ano.F) { 8924 return false 8925 } 8926 return true 8927 } 8928 8929 func (p *ExampleOptionalDefaultValue) Field1DeepEqual(src string) bool { 8930 8931 if strings.Compare(p.A, src) != 0 { 8932 return false 8933 } 8934 return true 8935 } 8936 func (p *ExampleOptionalDefaultValue) Field2DeepEqual(src int32) bool { 8937 8938 if p.B != src { 8939 return false 8940 } 8941 return true 8942 } 8943 func (p *ExampleOptionalDefaultValue) Field3DeepEqual(src float64) bool { 8944 8945 if p.C != src { 8946 return false 8947 } 8948 return true 8949 } 8950 func (p *ExampleOptionalDefaultValue) Field4DeepEqual(src string) bool { 8951 8952 if strings.Compare(p.D, src) != 0 { 8953 return false 8954 } 8955 return true 8956 } 8957 func (p *ExampleOptionalDefaultValue) Field5DeepEqual(src *string) bool { 8958 8959 if p.E == src { 8960 return true 8961 } else if p.E == nil || src == nil { 8962 return false 8963 } 8964 if strings.Compare(*p.E, *src) != 0 { 8965 return false 8966 } 8967 return true 8968 } 8969 func (p *ExampleOptionalDefaultValue) Field6DeepEqual(src *string) bool { 8970 8971 if p.F == src { 8972 return true 8973 } else if p.F == nil || src == nil { 8974 return false 8975 } 8976 if strings.Compare(*p.F, *src) != 0 { 8977 return false 8978 } 8979 return true 8980 } 8981 8982 type ExampleNoBodyStruct struct { 8983 NoBodyStruct *NoBodyStruct `thrift:"NoBodyStruct,1" json:"NoBodyStruct"` 8984 } 8985 8986 func NewExampleNoBodyStruct() *ExampleNoBodyStruct { 8987 return &ExampleNoBodyStruct{} 8988 } 8989 8990 var ExampleNoBodyStruct_NoBodyStruct_DEFAULT *NoBodyStruct 8991 8992 func (p *ExampleNoBodyStruct) GetNoBodyStruct() (v *NoBodyStruct) { 8993 if !p.IsSetNoBodyStruct() { 8994 return ExampleNoBodyStruct_NoBodyStruct_DEFAULT 8995 } 8996 return p.NoBodyStruct 8997 } 8998 func (p *ExampleNoBodyStruct) SetNoBodyStruct(val *NoBodyStruct) { 8999 p.NoBodyStruct = val 9000 } 9001 9002 var fieldIDToName_ExampleNoBodyStruct = map[int16]string{ 9003 1: "NoBodyStruct", 9004 } 9005 9006 func (p *ExampleNoBodyStruct) IsSetNoBodyStruct() bool { 9007 return p.NoBodyStruct != nil 9008 } 9009 9010 func (p *ExampleNoBodyStruct) Read(iprot thrift.TProtocol) (err error) { 9011 9012 var fieldTypeId thrift.TType 9013 var fieldId int16 9014 9015 if _, err = iprot.ReadStructBegin(); err != nil { 9016 goto ReadStructBeginError 9017 } 9018 9019 for { 9020 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 9021 if err != nil { 9022 goto ReadFieldBeginError 9023 } 9024 if fieldTypeId == thrift.STOP { 9025 break 9026 } 9027 9028 switch fieldId { 9029 case 1: 9030 if fieldTypeId == thrift.STRUCT { 9031 if err = p.ReadField1(iprot); err != nil { 9032 goto ReadFieldError 9033 } 9034 } else { 9035 if err = iprot.Skip(fieldTypeId); err != nil { 9036 goto SkipFieldError 9037 } 9038 } 9039 default: 9040 if err = iprot.Skip(fieldTypeId); err != nil { 9041 goto SkipFieldError 9042 } 9043 } 9044 9045 if err = iprot.ReadFieldEnd(); err != nil { 9046 goto ReadFieldEndError 9047 } 9048 } 9049 if err = iprot.ReadStructEnd(); err != nil { 9050 goto ReadStructEndError 9051 } 9052 9053 return nil 9054 ReadStructBeginError: 9055 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 9056 ReadFieldBeginError: 9057 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 9058 ReadFieldError: 9059 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleNoBodyStruct[fieldId]), err) 9060 SkipFieldError: 9061 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 9062 9063 ReadFieldEndError: 9064 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 9065 ReadStructEndError: 9066 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9067 } 9068 9069 func (p *ExampleNoBodyStruct) ReadField1(iprot thrift.TProtocol) error { 9070 p.NoBodyStruct = NewNoBodyStruct() 9071 if err := p.NoBodyStruct.Read(iprot); err != nil { 9072 return err 9073 } 9074 return nil 9075 } 9076 9077 func (p *ExampleNoBodyStruct) Write(oprot thrift.TProtocol) (err error) { 9078 var fieldId int16 9079 if err = oprot.WriteStructBegin("ExampleNoBodyStruct"); err != nil { 9080 goto WriteStructBeginError 9081 } 9082 if p != nil { 9083 if err = p.writeField1(oprot); err != nil { 9084 fieldId = 1 9085 goto WriteFieldError 9086 } 9087 9088 } 9089 if err = oprot.WriteFieldStop(); err != nil { 9090 goto WriteFieldStopError 9091 } 9092 if err = oprot.WriteStructEnd(); err != nil { 9093 goto WriteStructEndError 9094 } 9095 return nil 9096 WriteStructBeginError: 9097 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 9098 WriteFieldError: 9099 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 9100 WriteFieldStopError: 9101 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 9102 WriteStructEndError: 9103 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 9104 } 9105 9106 func (p *ExampleNoBodyStruct) writeField1(oprot thrift.TProtocol) (err error) { 9107 if err = oprot.WriteFieldBegin("NoBodyStruct", thrift.STRUCT, 1); err != nil { 9108 goto WriteFieldBeginError 9109 } 9110 if err := p.NoBodyStruct.Write(oprot); err != nil { 9111 return err 9112 } 9113 if err = oprot.WriteFieldEnd(); err != nil { 9114 goto WriteFieldEndError 9115 } 9116 return nil 9117 WriteFieldBeginError: 9118 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 9119 WriteFieldEndError: 9120 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 9121 } 9122 9123 func (p *ExampleNoBodyStruct) String() string { 9124 if p == nil { 9125 return "<nil>" 9126 } 9127 return fmt.Sprintf("ExampleNoBodyStruct(%+v)", *p) 9128 } 9129 9130 func (p *ExampleNoBodyStruct) DeepEqual(ano *ExampleNoBodyStruct) bool { 9131 if p == ano { 9132 return true 9133 } else if p == nil || ano == nil { 9134 return false 9135 } 9136 if !p.Field1DeepEqual(ano.NoBodyStruct) { 9137 return false 9138 } 9139 return true 9140 } 9141 9142 func (p *ExampleNoBodyStruct) Field1DeepEqual(src *NoBodyStruct) bool { 9143 9144 if !p.NoBodyStruct.DeepEqual(src) { 9145 return false 9146 } 9147 return true 9148 } 9149 9150 type NoBodyStruct struct { 9151 A *int32 `thrift:"A,1" json:"A,omitempty"` 9152 B *int32 `thrift:"B,2" json:"B,omitempty"` 9153 C int32 `thrift:"C,3" json:"C,omitempty"` 9154 } 9155 9156 func NewNoBodyStruct() *NoBodyStruct { 9157 return &NoBodyStruct{ 9158 9159 C: 1, 9160 } 9161 } 9162 9163 var NoBodyStruct_A_DEFAULT int32 9164 9165 func (p *NoBodyStruct) GetA() (v int32) { 9166 if !p.IsSetA() { 9167 return NoBodyStruct_A_DEFAULT 9168 } 9169 return *p.A 9170 } 9171 9172 var NoBodyStruct_B_DEFAULT int32 9173 9174 func (p *NoBodyStruct) GetB() (v int32) { 9175 if !p.IsSetB() { 9176 return NoBodyStruct_B_DEFAULT 9177 } 9178 return *p.B 9179 } 9180 9181 var NoBodyStruct_C_DEFAULT int32 = 1 9182 9183 func (p *NoBodyStruct) GetC() (v int32) { 9184 if !p.IsSetC() { 9185 return NoBodyStruct_C_DEFAULT 9186 } 9187 return p.C 9188 } 9189 func (p *NoBodyStruct) SetA(val *int32) { 9190 p.A = val 9191 } 9192 func (p *NoBodyStruct) SetB(val *int32) { 9193 p.B = val 9194 } 9195 func (p *NoBodyStruct) SetC(val int32) { 9196 p.C = val 9197 } 9198 9199 var fieldIDToName_NoBodyStruct = map[int16]string{ 9200 1: "A", 9201 2: "B", 9202 3: "C", 9203 } 9204 9205 func (p *NoBodyStruct) IsSetA() bool { 9206 return p.A != nil 9207 } 9208 9209 func (p *NoBodyStruct) IsSetB() bool { 9210 return p.B != nil 9211 } 9212 9213 func (p *NoBodyStruct) IsSetC() bool { 9214 return p.C != NoBodyStruct_C_DEFAULT 9215 } 9216 9217 func (p *NoBodyStruct) Read(iprot thrift.TProtocol) (err error) { 9218 9219 var fieldTypeId thrift.TType 9220 var fieldId int16 9221 9222 if _, err = iprot.ReadStructBegin(); err != nil { 9223 goto ReadStructBeginError 9224 } 9225 9226 for { 9227 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 9228 if err != nil { 9229 goto ReadFieldBeginError 9230 } 9231 if fieldTypeId == thrift.STOP { 9232 break 9233 } 9234 9235 switch fieldId { 9236 case 1: 9237 if fieldTypeId == thrift.I32 { 9238 if err = p.ReadField1(iprot); err != nil { 9239 goto ReadFieldError 9240 } 9241 } else { 9242 if err = iprot.Skip(fieldTypeId); err != nil { 9243 goto SkipFieldError 9244 } 9245 } 9246 case 2: 9247 if fieldTypeId == thrift.I32 { 9248 if err = p.ReadField2(iprot); err != nil { 9249 goto ReadFieldError 9250 } 9251 } else { 9252 if err = iprot.Skip(fieldTypeId); err != nil { 9253 goto SkipFieldError 9254 } 9255 } 9256 case 3: 9257 if fieldTypeId == thrift.I32 { 9258 if err = p.ReadField3(iprot); err != nil { 9259 goto ReadFieldError 9260 } 9261 } else { 9262 if err = iprot.Skip(fieldTypeId); err != nil { 9263 goto SkipFieldError 9264 } 9265 } 9266 default: 9267 if err = iprot.Skip(fieldTypeId); err != nil { 9268 goto SkipFieldError 9269 } 9270 } 9271 9272 if err = iprot.ReadFieldEnd(); err != nil { 9273 goto ReadFieldEndError 9274 } 9275 } 9276 if err = iprot.ReadStructEnd(); err != nil { 9277 goto ReadStructEndError 9278 } 9279 9280 return nil 9281 ReadStructBeginError: 9282 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 9283 ReadFieldBeginError: 9284 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 9285 ReadFieldError: 9286 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_NoBodyStruct[fieldId]), err) 9287 SkipFieldError: 9288 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 9289 9290 ReadFieldEndError: 9291 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 9292 ReadStructEndError: 9293 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9294 } 9295 9296 func (p *NoBodyStruct) ReadField1(iprot thrift.TProtocol) error { 9297 if v, err := iprot.ReadI32(); err != nil { 9298 return err 9299 } else { 9300 p.A = &v 9301 } 9302 return nil 9303 } 9304 9305 func (p *NoBodyStruct) ReadField2(iprot thrift.TProtocol) error { 9306 if v, err := iprot.ReadI32(); err != nil { 9307 return err 9308 } else { 9309 p.B = &v 9310 } 9311 return nil 9312 } 9313 9314 func (p *NoBodyStruct) ReadField3(iprot thrift.TProtocol) error { 9315 if v, err := iprot.ReadI32(); err != nil { 9316 return err 9317 } else { 9318 p.C = v 9319 } 9320 return nil 9321 } 9322 9323 func (p *NoBodyStruct) Write(oprot thrift.TProtocol) (err error) { 9324 var fieldId int16 9325 if err = oprot.WriteStructBegin("NoBodyStruct"); err != nil { 9326 goto WriteStructBeginError 9327 } 9328 if p != nil { 9329 if err = p.writeField1(oprot); err != nil { 9330 fieldId = 1 9331 goto WriteFieldError 9332 } 9333 if err = p.writeField2(oprot); err != nil { 9334 fieldId = 2 9335 goto WriteFieldError 9336 } 9337 if err = p.writeField3(oprot); err != nil { 9338 fieldId = 3 9339 goto WriteFieldError 9340 } 9341 9342 } 9343 if err = oprot.WriteFieldStop(); err != nil { 9344 goto WriteFieldStopError 9345 } 9346 if err = oprot.WriteStructEnd(); err != nil { 9347 goto WriteStructEndError 9348 } 9349 return nil 9350 WriteStructBeginError: 9351 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 9352 WriteFieldError: 9353 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 9354 WriteFieldStopError: 9355 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 9356 WriteStructEndError: 9357 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 9358 } 9359 9360 func (p *NoBodyStruct) writeField1(oprot thrift.TProtocol) (err error) { 9361 if p.IsSetA() { 9362 if err = oprot.WriteFieldBegin("A", thrift.I32, 1); err != nil { 9363 goto WriteFieldBeginError 9364 } 9365 if err := oprot.WriteI32(*p.A); err != nil { 9366 return err 9367 } 9368 if err = oprot.WriteFieldEnd(); err != nil { 9369 goto WriteFieldEndError 9370 } 9371 } 9372 return nil 9373 WriteFieldBeginError: 9374 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 9375 WriteFieldEndError: 9376 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 9377 } 9378 9379 func (p *NoBodyStruct) writeField2(oprot thrift.TProtocol) (err error) { 9380 if p.IsSetB() { 9381 if err = oprot.WriteFieldBegin("B", thrift.I32, 2); err != nil { 9382 goto WriteFieldBeginError 9383 } 9384 if err := oprot.WriteI32(*p.B); err != nil { 9385 return err 9386 } 9387 if err = oprot.WriteFieldEnd(); err != nil { 9388 goto WriteFieldEndError 9389 } 9390 } 9391 return nil 9392 WriteFieldBeginError: 9393 return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) 9394 WriteFieldEndError: 9395 return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) 9396 } 9397 9398 func (p *NoBodyStruct) writeField3(oprot thrift.TProtocol) (err error) { 9399 if p.IsSetC() { 9400 if err = oprot.WriteFieldBegin("C", thrift.I32, 3); err != nil { 9401 goto WriteFieldBeginError 9402 } 9403 if err := oprot.WriteI32(p.C); err != nil { 9404 return err 9405 } 9406 if err = oprot.WriteFieldEnd(); err != nil { 9407 goto WriteFieldEndError 9408 } 9409 } 9410 return nil 9411 WriteFieldBeginError: 9412 return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) 9413 WriteFieldEndError: 9414 return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) 9415 } 9416 9417 func (p *NoBodyStruct) String() string { 9418 if p == nil { 9419 return "<nil>" 9420 } 9421 return fmt.Sprintf("NoBodyStruct(%+v)", *p) 9422 } 9423 9424 func (p *NoBodyStruct) DeepEqual(ano *NoBodyStruct) bool { 9425 if p == ano { 9426 return true 9427 } else if p == nil || ano == nil { 9428 return false 9429 } 9430 if !p.Field1DeepEqual(ano.A) { 9431 return false 9432 } 9433 if !p.Field2DeepEqual(ano.B) { 9434 return false 9435 } 9436 if !p.Field3DeepEqual(ano.C) { 9437 return false 9438 } 9439 return true 9440 } 9441 9442 func (p *NoBodyStruct) Field1DeepEqual(src *int32) bool { 9443 9444 if p.A == src { 9445 return true 9446 } else if p.A == nil || src == nil { 9447 return false 9448 } 9449 if *p.A != *src { 9450 return false 9451 } 9452 return true 9453 } 9454 func (p *NoBodyStruct) Field2DeepEqual(src *int32) bool { 9455 9456 if p.B == src { 9457 return true 9458 } else if p.B == nil || src == nil { 9459 return false 9460 } 9461 if *p.B != *src { 9462 return false 9463 } 9464 return true 9465 } 9466 func (p *NoBodyStruct) Field3DeepEqual(src int32) bool { 9467 9468 if p.C != src { 9469 return false 9470 } 9471 return true 9472 } 9473 9474 type Exception struct { 9475 Code int32 `thrift:"code,1" json:"code"` 9476 Msg string `thrift:"msg,255" json:"msg"` 9477 } 9478 9479 func NewException() *Exception { 9480 return &Exception{} 9481 } 9482 9483 func (p *Exception) GetCode() (v int32) { 9484 return p.Code 9485 } 9486 9487 func (p *Exception) GetMsg() (v string) { 9488 return p.Msg 9489 } 9490 func (p *Exception) SetCode(val int32) { 9491 p.Code = val 9492 } 9493 func (p *Exception) SetMsg(val string) { 9494 p.Msg = val 9495 } 9496 9497 var fieldIDToName_Exception = map[int16]string{ 9498 1: "code", 9499 255: "msg", 9500 } 9501 9502 func (p *Exception) Read(iprot thrift.TProtocol) (err error) { 9503 9504 var fieldTypeId thrift.TType 9505 var fieldId int16 9506 9507 if _, err = iprot.ReadStructBegin(); err != nil { 9508 goto ReadStructBeginError 9509 } 9510 9511 for { 9512 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 9513 if err != nil { 9514 goto ReadFieldBeginError 9515 } 9516 if fieldTypeId == thrift.STOP { 9517 break 9518 } 9519 9520 switch fieldId { 9521 case 1: 9522 if fieldTypeId == thrift.I32 { 9523 if err = p.ReadField1(iprot); err != nil { 9524 goto ReadFieldError 9525 } 9526 } else { 9527 if err = iprot.Skip(fieldTypeId); err != nil { 9528 goto SkipFieldError 9529 } 9530 } 9531 case 255: 9532 if fieldTypeId == thrift.STRING { 9533 if err = p.ReadField255(iprot); err != nil { 9534 goto ReadFieldError 9535 } 9536 } else { 9537 if err = iprot.Skip(fieldTypeId); err != nil { 9538 goto SkipFieldError 9539 } 9540 } 9541 default: 9542 if err = iprot.Skip(fieldTypeId); err != nil { 9543 goto SkipFieldError 9544 } 9545 } 9546 9547 if err = iprot.ReadFieldEnd(); err != nil { 9548 goto ReadFieldEndError 9549 } 9550 } 9551 if err = iprot.ReadStructEnd(); err != nil { 9552 goto ReadStructEndError 9553 } 9554 9555 return nil 9556 ReadStructBeginError: 9557 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 9558 ReadFieldBeginError: 9559 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 9560 ReadFieldError: 9561 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_Exception[fieldId]), err) 9562 SkipFieldError: 9563 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 9564 9565 ReadFieldEndError: 9566 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 9567 ReadStructEndError: 9568 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 9569 } 9570 9571 func (p *Exception) ReadField1(iprot thrift.TProtocol) error { 9572 if v, err := iprot.ReadI32(); err != nil { 9573 return err 9574 } else { 9575 p.Code = v 9576 } 9577 return nil 9578 } 9579 9580 func (p *Exception) ReadField255(iprot thrift.TProtocol) error { 9581 if v, err := iprot.ReadString(); err != nil { 9582 return err 9583 } else { 9584 p.Msg = v 9585 } 9586 return nil 9587 } 9588 9589 func (p *Exception) Write(oprot thrift.TProtocol) (err error) { 9590 var fieldId int16 9591 if err = oprot.WriteStructBegin("Exception"); err != nil { 9592 goto WriteStructBeginError 9593 } 9594 if p != nil { 9595 if err = p.writeField1(oprot); err != nil { 9596 fieldId = 1 9597 goto WriteFieldError 9598 } 9599 if err = p.writeField255(oprot); err != nil { 9600 fieldId = 255 9601 goto WriteFieldError 9602 } 9603 9604 } 9605 if err = oprot.WriteFieldStop(); err != nil { 9606 goto WriteFieldStopError 9607 } 9608 if err = oprot.WriteStructEnd(); err != nil { 9609 goto WriteStructEndError 9610 } 9611 return nil 9612 WriteStructBeginError: 9613 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 9614 WriteFieldError: 9615 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 9616 WriteFieldStopError: 9617 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 9618 WriteStructEndError: 9619 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 9620 } 9621 9622 func (p *Exception) writeField1(oprot thrift.TProtocol) (err error) { 9623 if err = oprot.WriteFieldBegin("code", thrift.I32, 1); err != nil { 9624 goto WriteFieldBeginError 9625 } 9626 if err := oprot.WriteI32(p.Code); err != nil { 9627 return err 9628 } 9629 if err = oprot.WriteFieldEnd(); err != nil { 9630 goto WriteFieldEndError 9631 } 9632 return nil 9633 WriteFieldBeginError: 9634 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 9635 WriteFieldEndError: 9636 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 9637 } 9638 9639 func (p *Exception) writeField255(oprot thrift.TProtocol) (err error) { 9640 if err = oprot.WriteFieldBegin("msg", thrift.STRING, 255); err != nil { 9641 goto WriteFieldBeginError 9642 } 9643 if err := oprot.WriteString(p.Msg); err != nil { 9644 return err 9645 } 9646 if err = oprot.WriteFieldEnd(); err != nil { 9647 goto WriteFieldEndError 9648 } 9649 return nil 9650 WriteFieldBeginError: 9651 return thrift.PrependError(fmt.Sprintf("%T write field 255 begin error: ", p), err) 9652 WriteFieldEndError: 9653 return thrift.PrependError(fmt.Sprintf("%T write field 255 end error: ", p), err) 9654 } 9655 9656 func (p *Exception) String() string { 9657 if p == nil { 9658 return "<nil>" 9659 } 9660 return fmt.Sprintf("Exception(%+v)", *p) 9661 } 9662 func (p *Exception) Error() string { 9663 return p.String() 9664 } 9665 9666 func (p *Exception) DeepEqual(ano *Exception) bool { 9667 if p == ano { 9668 return true 9669 } else if p == nil || ano == nil { 9670 return false 9671 } 9672 if !p.Field1DeepEqual(ano.Code) { 9673 return false 9674 } 9675 if !p.Field255DeepEqual(ano.Msg) { 9676 return false 9677 } 9678 return true 9679 } 9680 9681 func (p *Exception) Field1DeepEqual(src int32) bool { 9682 9683 if p.Code != src { 9684 return false 9685 } 9686 return true 9687 } 9688 func (p *Exception) Field255DeepEqual(src string) bool { 9689 9690 if strings.Compare(p.Msg, src) != 0 { 9691 return false 9692 } 9693 return true 9694 } 9695 9696 type ExampleService interface { 9697 ExampleMethod(ctx context.Context, req *ExampleReq) (r *ExampleResp, err error) 9698 9699 ErrorMethod(ctx context.Context, req *ExampleError) (r *ExampleErrorResp, err error) 9700 9701 Int2FloatMethod(ctx context.Context, req *ExampleInt2Float) (r *ExampleInt2Float, err error) 9702 9703 JSONStringMethod(ctx context.Context, req *ExampleJSONString) (r *ExampleJSONString, err error) 9704 9705 PartialMethod(ctx context.Context, req *ExamplePartial2) (r *ExamplePartial, err error) 9706 9707 FallbackMethod(ctx context.Context, req *ExampleFallback) (r *ExampleFallback, err error) 9708 9709 ApiBodyMethod(ctx context.Context, req *ExampleApiBody) (r *ExampleApiBody, err error) 9710 9711 PostFormMethod(ctx context.Context, req *ExamplePostForm) (r *ExamplePostForm, err error) 9712 9713 DynamicStructMethod(ctx context.Context, req *ExampleDynamicStruct) (r *ExampleDynamicStruct, err error) 9714 9715 Base64BinaryMethod(ctx context.Context, req *ExampleBase64Binary) (r *ExampleBase64Binary, err error) 9716 9717 DefaultValueMethod(ctx context.Context, req *ExampleDefaultValue) (r *ExampleDefaultValue, err error) 9718 9719 OptionalDefaultValueMethod(ctx context.Context, req *ExampleOptionalDefaultValue) (r *ExampleOptionalDefaultValue, err error) 9720 9721 NoBodyStructMethod(ctx context.Context, req *ExampleNoBodyStruct) (r *ExampleNoBodyStruct, err error) 9722 9723 String(ctx context.Context, req string) (r string, err error) 9724 9725 I64(ctx context.Context, req int64) (r int64, err error) 9726 } 9727 9728 type ExampleServiceClient struct { 9729 c thrift.TClient 9730 } 9731 9732 func NewExampleServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ExampleServiceClient { 9733 return &ExampleServiceClient{ 9734 c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), 9735 } 9736 } 9737 9738 func NewExampleServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ExampleServiceClient { 9739 return &ExampleServiceClient{ 9740 c: thrift.NewTStandardClient(iprot, oprot), 9741 } 9742 } 9743 9744 func NewExampleServiceClient(c thrift.TClient) *ExampleServiceClient { 9745 return &ExampleServiceClient{ 9746 c: c, 9747 } 9748 } 9749 9750 func (p *ExampleServiceClient) Client_() thrift.TClient { 9751 return p.c 9752 } 9753 9754 func (p *ExampleServiceClient) ExampleMethod(ctx context.Context, req *ExampleReq) (r *ExampleResp, err error) { 9755 var _args ExampleServiceExampleMethodArgs 9756 _args.Req = req 9757 var _result ExampleServiceExampleMethodResult 9758 if err = p.Client_().Call(ctx, "ExampleMethod", &_args, &_result); err != nil { 9759 return 9760 } 9761 switch { 9762 case _result.Err != nil: 9763 return r, _result.Err 9764 } 9765 return _result.GetSuccess(), nil 9766 } 9767 9768 func (p *ExampleServiceClient) ErrorMethod(ctx context.Context, req *ExampleError) (r *ExampleErrorResp, err error) { 9769 var _args ExampleServiceErrorMethodArgs 9770 _args.Req = req 9771 var _result ExampleServiceErrorMethodResult 9772 if err = p.Client_().Call(ctx, "ErrorMethod", &_args, &_result); err != nil { 9773 return 9774 } 9775 return _result.GetSuccess(), nil 9776 } 9777 9778 func (p *ExampleServiceClient) Int2FloatMethod(ctx context.Context, req *ExampleInt2Float) (r *ExampleInt2Float, err error) { 9779 var _args ExampleServiceInt2FloatMethodArgs 9780 _args.Req = req 9781 var _result ExampleServiceInt2FloatMethodResult 9782 if err = p.Client_().Call(ctx, "Int2FloatMethod", &_args, &_result); err != nil { 9783 return 9784 } 9785 return _result.GetSuccess(), nil 9786 } 9787 9788 func (p *ExampleServiceClient) JSONStringMethod(ctx context.Context, req *ExampleJSONString) (r *ExampleJSONString, err error) { 9789 var _args ExampleServiceJSONStringMethodArgs 9790 _args.Req = req 9791 var _result ExampleServiceJSONStringMethodResult 9792 if err = p.Client_().Call(ctx, "JSONStringMethod", &_args, &_result); err != nil { 9793 return 9794 } 9795 return _result.GetSuccess(), nil 9796 } 9797 9798 func (p *ExampleServiceClient) PartialMethod(ctx context.Context, req *ExamplePartial2) (r *ExamplePartial, err error) { 9799 var _args ExampleServicePartialMethodArgs 9800 _args.Req = req 9801 var _result ExampleServicePartialMethodResult 9802 if err = p.Client_().Call(ctx, "PartialMethod", &_args, &_result); err != nil { 9803 return 9804 } 9805 return _result.GetSuccess(), nil 9806 } 9807 9808 func (p *ExampleServiceClient) FallbackMethod(ctx context.Context, req *ExampleFallback) (r *ExampleFallback, err error) { 9809 var _args ExampleServiceFallbackMethodArgs 9810 _args.Req = req 9811 var _result ExampleServiceFallbackMethodResult 9812 if err = p.Client_().Call(ctx, "FallbackMethod", &_args, &_result); err != nil { 9813 return 9814 } 9815 return _result.GetSuccess(), nil 9816 } 9817 9818 func (p *ExampleServiceClient) ApiBodyMethod(ctx context.Context, req *ExampleApiBody) (r *ExampleApiBody, err error) { 9819 var _args ExampleServiceApiBodyMethodArgs 9820 _args.Req = req 9821 var _result ExampleServiceApiBodyMethodResult 9822 if err = p.Client_().Call(ctx, "ApiBodyMethod", &_args, &_result); err != nil { 9823 return 9824 } 9825 return _result.GetSuccess(), nil 9826 } 9827 9828 func (p *ExampleServiceClient) PostFormMethod(ctx context.Context, req *ExamplePostForm) (r *ExamplePostForm, err error) { 9829 var _args ExampleServicePostFormMethodArgs 9830 _args.Req = req 9831 var _result ExampleServicePostFormMethodResult 9832 if err = p.Client_().Call(ctx, "PostFormMethod", &_args, &_result); err != nil { 9833 return 9834 } 9835 return _result.GetSuccess(), nil 9836 } 9837 9838 func (p *ExampleServiceClient) DynamicStructMethod(ctx context.Context, req *ExampleDynamicStruct) (r *ExampleDynamicStruct, err error) { 9839 var _args ExampleServiceDynamicStructMethodArgs 9840 _args.Req = req 9841 var _result ExampleServiceDynamicStructMethodResult 9842 if err = p.Client_().Call(ctx, "DynamicStructMethod", &_args, &_result); err != nil { 9843 return 9844 } 9845 return _result.GetSuccess(), nil 9846 } 9847 9848 func (p *ExampleServiceClient) Base64BinaryMethod(ctx context.Context, req *ExampleBase64Binary) (r *ExampleBase64Binary, err error) { 9849 var _args ExampleServiceBase64BinaryMethodArgs 9850 _args.Req = req 9851 var _result ExampleServiceBase64BinaryMethodResult 9852 if err = p.Client_().Call(ctx, "Base64BinaryMethod", &_args, &_result); err != nil { 9853 return 9854 } 9855 return _result.GetSuccess(), nil 9856 } 9857 9858 func (p *ExampleServiceClient) DefaultValueMethod(ctx context.Context, req *ExampleDefaultValue) (r *ExampleDefaultValue, err error) { 9859 var _args ExampleServiceDefaultValueMethodArgs 9860 _args.Req = req 9861 var _result ExampleServiceDefaultValueMethodResult 9862 if err = p.Client_().Call(ctx, "DefaultValueMethod", &_args, &_result); err != nil { 9863 return 9864 } 9865 return _result.GetSuccess(), nil 9866 } 9867 9868 func (p *ExampleServiceClient) OptionalDefaultValueMethod(ctx context.Context, req *ExampleOptionalDefaultValue) (r *ExampleOptionalDefaultValue, err error) { 9869 var _args ExampleServiceOptionalDefaultValueMethodArgs 9870 _args.Req = req 9871 var _result ExampleServiceOptionalDefaultValueMethodResult 9872 if err = p.Client_().Call(ctx, "OptionalDefaultValueMethod", &_args, &_result); err != nil { 9873 return 9874 } 9875 return _result.GetSuccess(), nil 9876 } 9877 9878 func (p *ExampleServiceClient) NoBodyStructMethod(ctx context.Context, req *ExampleNoBodyStruct) (r *ExampleNoBodyStruct, err error) { 9879 var _args ExampleServiceNoBodyStructMethodArgs 9880 _args.Req = req 9881 var _result ExampleServiceNoBodyStructMethodResult 9882 if err = p.Client_().Call(ctx, "NoBodyStructMethod", &_args, &_result); err != nil { 9883 return 9884 } 9885 return _result.GetSuccess(), nil 9886 } 9887 9888 func (p *ExampleServiceClient) String(ctx context.Context, req string) (r string, err error) { 9889 var _args ExampleServiceStringArgs 9890 _args.Req = req 9891 var _result ExampleServiceStringResult 9892 if err = p.Client_().Call(ctx, "String", &_args, &_result); err != nil { 9893 return 9894 } 9895 return _result.GetSuccess(), nil 9896 } 9897 9898 func (p *ExampleServiceClient) I64(ctx context.Context, req int64) (r int64, err error) { 9899 var _args ExampleServiceI64Args 9900 _args.Req = req 9901 var _result ExampleServiceI64Result 9902 if err = p.Client_().Call(ctx, "I64", &_args, &_result); err != nil { 9903 return 9904 } 9905 return _result.GetSuccess(), nil 9906 } 9907 9908 type ExampleServiceProcessor struct { 9909 processorMap map[string]thrift.TProcessorFunction 9910 handler ExampleService 9911 } 9912 9913 func (p *ExampleServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { 9914 p.processorMap[key] = processor 9915 } 9916 9917 func (p *ExampleServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { 9918 processor, ok = p.processorMap[key] 9919 return processor, ok 9920 } 9921 9922 func (p *ExampleServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { 9923 return p.processorMap 9924 } 9925 9926 func NewExampleServiceProcessor(handler ExampleService) *ExampleServiceProcessor { 9927 self := &ExampleServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} 9928 self.AddToProcessorMap("ExampleMethod", &exampleServiceProcessorExampleMethod{handler: handler}) 9929 self.AddToProcessorMap("ErrorMethod", &exampleServiceProcessorErrorMethod{handler: handler}) 9930 self.AddToProcessorMap("Int2FloatMethod", &exampleServiceProcessorInt2FloatMethod{handler: handler}) 9931 self.AddToProcessorMap("JSONStringMethod", &exampleServiceProcessorJSONStringMethod{handler: handler}) 9932 self.AddToProcessorMap("PartialMethod", &exampleServiceProcessorPartialMethod{handler: handler}) 9933 self.AddToProcessorMap("FallbackMethod", &exampleServiceProcessorFallbackMethod{handler: handler}) 9934 self.AddToProcessorMap("ApiBodyMethod", &exampleServiceProcessorApiBodyMethod{handler: handler}) 9935 self.AddToProcessorMap("PostFormMethod", &exampleServiceProcessorPostFormMethod{handler: handler}) 9936 self.AddToProcessorMap("DynamicStructMethod", &exampleServiceProcessorDynamicStructMethod{handler: handler}) 9937 self.AddToProcessorMap("Base64BinaryMethod", &exampleServiceProcessorBase64BinaryMethod{handler: handler}) 9938 self.AddToProcessorMap("DefaultValueMethod", &exampleServiceProcessorDefaultValueMethod{handler: handler}) 9939 self.AddToProcessorMap("OptionalDefaultValueMethod", &exampleServiceProcessorOptionalDefaultValueMethod{handler: handler}) 9940 self.AddToProcessorMap("NoBodyStructMethod", &exampleServiceProcessorNoBodyStructMethod{handler: handler}) 9941 self.AddToProcessorMap("String", &exampleServiceProcessorString{handler: handler}) 9942 self.AddToProcessorMap("I64", &exampleServiceProcessorI64{handler: handler}) 9943 return self 9944 } 9945 func (p *ExampleServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 9946 name, _, seqId, err := iprot.ReadMessageBegin() 9947 if err != nil { 9948 return false, err 9949 } 9950 if processor, ok := p.GetProcessorFunction(name); ok { 9951 return processor.Process(ctx, seqId, iprot, oprot) 9952 } 9953 iprot.Skip(thrift.STRUCT) 9954 iprot.ReadMessageEnd() 9955 x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) 9956 oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) 9957 x.Write(oprot) 9958 oprot.WriteMessageEnd() 9959 oprot.Flush(ctx) 9960 return false, x 9961 } 9962 9963 type exampleServiceProcessorExampleMethod struct { 9964 handler ExampleService 9965 } 9966 9967 func (p *exampleServiceProcessorExampleMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 9968 args := ExampleServiceExampleMethodArgs{} 9969 if err = args.Read(iprot); err != nil { 9970 iprot.ReadMessageEnd() 9971 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 9972 oprot.WriteMessageBegin("ExampleMethod", thrift.EXCEPTION, seqId) 9973 x.Write(oprot) 9974 oprot.WriteMessageEnd() 9975 oprot.Flush(ctx) 9976 return false, err 9977 } 9978 9979 iprot.ReadMessageEnd() 9980 var err2 error 9981 result := ExampleServiceExampleMethodResult{} 9982 var retval *ExampleResp 9983 if retval, err2 = p.handler.ExampleMethod(ctx, args.Req); err2 != nil { 9984 switch v := err2.(type) { 9985 case *Exception: 9986 result.Err = v 9987 default: 9988 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ExampleMethod: "+err2.Error()) 9989 oprot.WriteMessageBegin("ExampleMethod", thrift.EXCEPTION, seqId) 9990 x.Write(oprot) 9991 oprot.WriteMessageEnd() 9992 oprot.Flush(ctx) 9993 return true, err2 9994 } 9995 } else { 9996 result.Success = retval 9997 } 9998 if err2 = oprot.WriteMessageBegin("ExampleMethod", thrift.REPLY, seqId); err2 != nil { 9999 err = err2 10000 } 10001 if err2 = result.Write(oprot); err == nil && err2 != nil { 10002 err = err2 10003 } 10004 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10005 err = err2 10006 } 10007 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10008 err = err2 10009 } 10010 if err != nil { 10011 return 10012 } 10013 return true, err 10014 } 10015 10016 type exampleServiceProcessorErrorMethod struct { 10017 handler ExampleService 10018 } 10019 10020 func (p *exampleServiceProcessorErrorMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10021 args := ExampleServiceErrorMethodArgs{} 10022 if err = args.Read(iprot); err != nil { 10023 iprot.ReadMessageEnd() 10024 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10025 oprot.WriteMessageBegin("ErrorMethod", thrift.EXCEPTION, seqId) 10026 x.Write(oprot) 10027 oprot.WriteMessageEnd() 10028 oprot.Flush(ctx) 10029 return false, err 10030 } 10031 10032 iprot.ReadMessageEnd() 10033 var err2 error 10034 result := ExampleServiceErrorMethodResult{} 10035 var retval *ExampleErrorResp 10036 if retval, err2 = p.handler.ErrorMethod(ctx, args.Req); err2 != nil { 10037 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ErrorMethod: "+err2.Error()) 10038 oprot.WriteMessageBegin("ErrorMethod", thrift.EXCEPTION, seqId) 10039 x.Write(oprot) 10040 oprot.WriteMessageEnd() 10041 oprot.Flush(ctx) 10042 return true, err2 10043 } else { 10044 result.Success = retval 10045 } 10046 if err2 = oprot.WriteMessageBegin("ErrorMethod", thrift.REPLY, seqId); err2 != nil { 10047 err = err2 10048 } 10049 if err2 = result.Write(oprot); err == nil && err2 != nil { 10050 err = err2 10051 } 10052 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10053 err = err2 10054 } 10055 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10056 err = err2 10057 } 10058 if err != nil { 10059 return 10060 } 10061 return true, err 10062 } 10063 10064 type exampleServiceProcessorInt2FloatMethod struct { 10065 handler ExampleService 10066 } 10067 10068 func (p *exampleServiceProcessorInt2FloatMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10069 args := ExampleServiceInt2FloatMethodArgs{} 10070 if err = args.Read(iprot); err != nil { 10071 iprot.ReadMessageEnd() 10072 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10073 oprot.WriteMessageBegin("Int2FloatMethod", thrift.EXCEPTION, seqId) 10074 x.Write(oprot) 10075 oprot.WriteMessageEnd() 10076 oprot.Flush(ctx) 10077 return false, err 10078 } 10079 10080 iprot.ReadMessageEnd() 10081 var err2 error 10082 result := ExampleServiceInt2FloatMethodResult{} 10083 var retval *ExampleInt2Float 10084 if retval, err2 = p.handler.Int2FloatMethod(ctx, args.Req); err2 != nil { 10085 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Int2FloatMethod: "+err2.Error()) 10086 oprot.WriteMessageBegin("Int2FloatMethod", thrift.EXCEPTION, seqId) 10087 x.Write(oprot) 10088 oprot.WriteMessageEnd() 10089 oprot.Flush(ctx) 10090 return true, err2 10091 } else { 10092 result.Success = retval 10093 } 10094 if err2 = oprot.WriteMessageBegin("Int2FloatMethod", thrift.REPLY, seqId); err2 != nil { 10095 err = err2 10096 } 10097 if err2 = result.Write(oprot); err == nil && err2 != nil { 10098 err = err2 10099 } 10100 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10101 err = err2 10102 } 10103 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10104 err = err2 10105 } 10106 if err != nil { 10107 return 10108 } 10109 return true, err 10110 } 10111 10112 type exampleServiceProcessorJSONStringMethod struct { 10113 handler ExampleService 10114 } 10115 10116 func (p *exampleServiceProcessorJSONStringMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10117 args := ExampleServiceJSONStringMethodArgs{} 10118 if err = args.Read(iprot); err != nil { 10119 iprot.ReadMessageEnd() 10120 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10121 oprot.WriteMessageBegin("JSONStringMethod", thrift.EXCEPTION, seqId) 10122 x.Write(oprot) 10123 oprot.WriteMessageEnd() 10124 oprot.Flush(ctx) 10125 return false, err 10126 } 10127 10128 iprot.ReadMessageEnd() 10129 var err2 error 10130 result := ExampleServiceJSONStringMethodResult{} 10131 var retval *ExampleJSONString 10132 if retval, err2 = p.handler.JSONStringMethod(ctx, args.Req); err2 != nil { 10133 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing JSONStringMethod: "+err2.Error()) 10134 oprot.WriteMessageBegin("JSONStringMethod", thrift.EXCEPTION, seqId) 10135 x.Write(oprot) 10136 oprot.WriteMessageEnd() 10137 oprot.Flush(ctx) 10138 return true, err2 10139 } else { 10140 result.Success = retval 10141 } 10142 if err2 = oprot.WriteMessageBegin("JSONStringMethod", thrift.REPLY, seqId); err2 != nil { 10143 err = err2 10144 } 10145 if err2 = result.Write(oprot); err == nil && err2 != nil { 10146 err = err2 10147 } 10148 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10149 err = err2 10150 } 10151 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10152 err = err2 10153 } 10154 if err != nil { 10155 return 10156 } 10157 return true, err 10158 } 10159 10160 type exampleServiceProcessorPartialMethod struct { 10161 handler ExampleService 10162 } 10163 10164 func (p *exampleServiceProcessorPartialMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10165 args := ExampleServicePartialMethodArgs{} 10166 if err = args.Read(iprot); err != nil { 10167 iprot.ReadMessageEnd() 10168 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10169 oprot.WriteMessageBegin("PartialMethod", thrift.EXCEPTION, seqId) 10170 x.Write(oprot) 10171 oprot.WriteMessageEnd() 10172 oprot.Flush(ctx) 10173 return false, err 10174 } 10175 10176 iprot.ReadMessageEnd() 10177 var err2 error 10178 result := ExampleServicePartialMethodResult{} 10179 var retval *ExamplePartial 10180 if retval, err2 = p.handler.PartialMethod(ctx, args.Req); err2 != nil { 10181 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing PartialMethod: "+err2.Error()) 10182 oprot.WriteMessageBegin("PartialMethod", thrift.EXCEPTION, seqId) 10183 x.Write(oprot) 10184 oprot.WriteMessageEnd() 10185 oprot.Flush(ctx) 10186 return true, err2 10187 } else { 10188 result.Success = retval 10189 } 10190 if err2 = oprot.WriteMessageBegin("PartialMethod", thrift.REPLY, seqId); err2 != nil { 10191 err = err2 10192 } 10193 if err2 = result.Write(oprot); err == nil && err2 != nil { 10194 err = err2 10195 } 10196 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10197 err = err2 10198 } 10199 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10200 err = err2 10201 } 10202 if err != nil { 10203 return 10204 } 10205 return true, err 10206 } 10207 10208 type exampleServiceProcessorFallbackMethod struct { 10209 handler ExampleService 10210 } 10211 10212 func (p *exampleServiceProcessorFallbackMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10213 args := ExampleServiceFallbackMethodArgs{} 10214 if err = args.Read(iprot); err != nil { 10215 iprot.ReadMessageEnd() 10216 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10217 oprot.WriteMessageBegin("FallbackMethod", thrift.EXCEPTION, seqId) 10218 x.Write(oprot) 10219 oprot.WriteMessageEnd() 10220 oprot.Flush(ctx) 10221 return false, err 10222 } 10223 10224 iprot.ReadMessageEnd() 10225 var err2 error 10226 result := ExampleServiceFallbackMethodResult{} 10227 var retval *ExampleFallback 10228 if retval, err2 = p.handler.FallbackMethod(ctx, args.Req); err2 != nil { 10229 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing FallbackMethod: "+err2.Error()) 10230 oprot.WriteMessageBegin("FallbackMethod", thrift.EXCEPTION, seqId) 10231 x.Write(oprot) 10232 oprot.WriteMessageEnd() 10233 oprot.Flush(ctx) 10234 return true, err2 10235 } else { 10236 result.Success = retval 10237 } 10238 if err2 = oprot.WriteMessageBegin("FallbackMethod", thrift.REPLY, seqId); err2 != nil { 10239 err = err2 10240 } 10241 if err2 = result.Write(oprot); err == nil && err2 != nil { 10242 err = err2 10243 } 10244 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10245 err = err2 10246 } 10247 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10248 err = err2 10249 } 10250 if err != nil { 10251 return 10252 } 10253 return true, err 10254 } 10255 10256 type exampleServiceProcessorApiBodyMethod struct { 10257 handler ExampleService 10258 } 10259 10260 func (p *exampleServiceProcessorApiBodyMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10261 args := ExampleServiceApiBodyMethodArgs{} 10262 if err = args.Read(iprot); err != nil { 10263 iprot.ReadMessageEnd() 10264 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10265 oprot.WriteMessageBegin("ApiBodyMethod", thrift.EXCEPTION, seqId) 10266 x.Write(oprot) 10267 oprot.WriteMessageEnd() 10268 oprot.Flush(ctx) 10269 return false, err 10270 } 10271 10272 iprot.ReadMessageEnd() 10273 var err2 error 10274 result := ExampleServiceApiBodyMethodResult{} 10275 var retval *ExampleApiBody 10276 if retval, err2 = p.handler.ApiBodyMethod(ctx, args.Req); err2 != nil { 10277 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ApiBodyMethod: "+err2.Error()) 10278 oprot.WriteMessageBegin("ApiBodyMethod", thrift.EXCEPTION, seqId) 10279 x.Write(oprot) 10280 oprot.WriteMessageEnd() 10281 oprot.Flush(ctx) 10282 return true, err2 10283 } else { 10284 result.Success = retval 10285 } 10286 if err2 = oprot.WriteMessageBegin("ApiBodyMethod", thrift.REPLY, seqId); err2 != nil { 10287 err = err2 10288 } 10289 if err2 = result.Write(oprot); err == nil && err2 != nil { 10290 err = err2 10291 } 10292 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10293 err = err2 10294 } 10295 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10296 err = err2 10297 } 10298 if err != nil { 10299 return 10300 } 10301 return true, err 10302 } 10303 10304 type exampleServiceProcessorPostFormMethod struct { 10305 handler ExampleService 10306 } 10307 10308 func (p *exampleServiceProcessorPostFormMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10309 args := ExampleServicePostFormMethodArgs{} 10310 if err = args.Read(iprot); err != nil { 10311 iprot.ReadMessageEnd() 10312 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10313 oprot.WriteMessageBegin("PostFormMethod", thrift.EXCEPTION, seqId) 10314 x.Write(oprot) 10315 oprot.WriteMessageEnd() 10316 oprot.Flush(ctx) 10317 return false, err 10318 } 10319 10320 iprot.ReadMessageEnd() 10321 var err2 error 10322 result := ExampleServicePostFormMethodResult{} 10323 var retval *ExamplePostForm 10324 if retval, err2 = p.handler.PostFormMethod(ctx, args.Req); err2 != nil { 10325 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing PostFormMethod: "+err2.Error()) 10326 oprot.WriteMessageBegin("PostFormMethod", thrift.EXCEPTION, seqId) 10327 x.Write(oprot) 10328 oprot.WriteMessageEnd() 10329 oprot.Flush(ctx) 10330 return true, err2 10331 } else { 10332 result.Success = retval 10333 } 10334 if err2 = oprot.WriteMessageBegin("PostFormMethod", thrift.REPLY, seqId); err2 != nil { 10335 err = err2 10336 } 10337 if err2 = result.Write(oprot); err == nil && err2 != nil { 10338 err = err2 10339 } 10340 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10341 err = err2 10342 } 10343 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10344 err = err2 10345 } 10346 if err != nil { 10347 return 10348 } 10349 return true, err 10350 } 10351 10352 type exampleServiceProcessorDynamicStructMethod struct { 10353 handler ExampleService 10354 } 10355 10356 func (p *exampleServiceProcessorDynamicStructMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10357 args := ExampleServiceDynamicStructMethodArgs{} 10358 if err = args.Read(iprot); err != nil { 10359 iprot.ReadMessageEnd() 10360 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10361 oprot.WriteMessageBegin("DynamicStructMethod", thrift.EXCEPTION, seqId) 10362 x.Write(oprot) 10363 oprot.WriteMessageEnd() 10364 oprot.Flush(ctx) 10365 return false, err 10366 } 10367 10368 iprot.ReadMessageEnd() 10369 var err2 error 10370 result := ExampleServiceDynamicStructMethodResult{} 10371 var retval *ExampleDynamicStruct 10372 if retval, err2 = p.handler.DynamicStructMethod(ctx, args.Req); err2 != nil { 10373 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing DynamicStructMethod: "+err2.Error()) 10374 oprot.WriteMessageBegin("DynamicStructMethod", thrift.EXCEPTION, seqId) 10375 x.Write(oprot) 10376 oprot.WriteMessageEnd() 10377 oprot.Flush(ctx) 10378 return true, err2 10379 } else { 10380 result.Success = retval 10381 } 10382 if err2 = oprot.WriteMessageBegin("DynamicStructMethod", thrift.REPLY, seqId); err2 != nil { 10383 err = err2 10384 } 10385 if err2 = result.Write(oprot); err == nil && err2 != nil { 10386 err = err2 10387 } 10388 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10389 err = err2 10390 } 10391 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10392 err = err2 10393 } 10394 if err != nil { 10395 return 10396 } 10397 return true, err 10398 } 10399 10400 type exampleServiceProcessorBase64BinaryMethod struct { 10401 handler ExampleService 10402 } 10403 10404 func (p *exampleServiceProcessorBase64BinaryMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10405 args := ExampleServiceBase64BinaryMethodArgs{} 10406 if err = args.Read(iprot); err != nil { 10407 iprot.ReadMessageEnd() 10408 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10409 oprot.WriteMessageBegin("Base64BinaryMethod", thrift.EXCEPTION, seqId) 10410 x.Write(oprot) 10411 oprot.WriteMessageEnd() 10412 oprot.Flush(ctx) 10413 return false, err 10414 } 10415 10416 iprot.ReadMessageEnd() 10417 var err2 error 10418 result := ExampleServiceBase64BinaryMethodResult{} 10419 var retval *ExampleBase64Binary 10420 if retval, err2 = p.handler.Base64BinaryMethod(ctx, args.Req); err2 != nil { 10421 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Base64BinaryMethod: "+err2.Error()) 10422 oprot.WriteMessageBegin("Base64BinaryMethod", thrift.EXCEPTION, seqId) 10423 x.Write(oprot) 10424 oprot.WriteMessageEnd() 10425 oprot.Flush(ctx) 10426 return true, err2 10427 } else { 10428 result.Success = retval 10429 } 10430 if err2 = oprot.WriteMessageBegin("Base64BinaryMethod", thrift.REPLY, seqId); err2 != nil { 10431 err = err2 10432 } 10433 if err2 = result.Write(oprot); err == nil && err2 != nil { 10434 err = err2 10435 } 10436 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10437 err = err2 10438 } 10439 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10440 err = err2 10441 } 10442 if err != nil { 10443 return 10444 } 10445 return true, err 10446 } 10447 10448 type exampleServiceProcessorDefaultValueMethod struct { 10449 handler ExampleService 10450 } 10451 10452 func (p *exampleServiceProcessorDefaultValueMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10453 args := ExampleServiceDefaultValueMethodArgs{} 10454 if err = args.Read(iprot); err != nil { 10455 iprot.ReadMessageEnd() 10456 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10457 oprot.WriteMessageBegin("DefaultValueMethod", thrift.EXCEPTION, seqId) 10458 x.Write(oprot) 10459 oprot.WriteMessageEnd() 10460 oprot.Flush(ctx) 10461 return false, err 10462 } 10463 10464 iprot.ReadMessageEnd() 10465 var err2 error 10466 result := ExampleServiceDefaultValueMethodResult{} 10467 var retval *ExampleDefaultValue 10468 if retval, err2 = p.handler.DefaultValueMethod(ctx, args.Req); err2 != nil { 10469 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing DefaultValueMethod: "+err2.Error()) 10470 oprot.WriteMessageBegin("DefaultValueMethod", thrift.EXCEPTION, seqId) 10471 x.Write(oprot) 10472 oprot.WriteMessageEnd() 10473 oprot.Flush(ctx) 10474 return true, err2 10475 } else { 10476 result.Success = retval 10477 } 10478 if err2 = oprot.WriteMessageBegin("DefaultValueMethod", thrift.REPLY, seqId); err2 != nil { 10479 err = err2 10480 } 10481 if err2 = result.Write(oprot); err == nil && err2 != nil { 10482 err = err2 10483 } 10484 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10485 err = err2 10486 } 10487 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10488 err = err2 10489 } 10490 if err != nil { 10491 return 10492 } 10493 return true, err 10494 } 10495 10496 type exampleServiceProcessorOptionalDefaultValueMethod struct { 10497 handler ExampleService 10498 } 10499 10500 func (p *exampleServiceProcessorOptionalDefaultValueMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10501 args := ExampleServiceOptionalDefaultValueMethodArgs{} 10502 if err = args.Read(iprot); err != nil { 10503 iprot.ReadMessageEnd() 10504 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10505 oprot.WriteMessageBegin("OptionalDefaultValueMethod", thrift.EXCEPTION, seqId) 10506 x.Write(oprot) 10507 oprot.WriteMessageEnd() 10508 oprot.Flush(ctx) 10509 return false, err 10510 } 10511 10512 iprot.ReadMessageEnd() 10513 var err2 error 10514 result := ExampleServiceOptionalDefaultValueMethodResult{} 10515 var retval *ExampleOptionalDefaultValue 10516 if retval, err2 = p.handler.OptionalDefaultValueMethod(ctx, args.Req); err2 != nil { 10517 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing OptionalDefaultValueMethod: "+err2.Error()) 10518 oprot.WriteMessageBegin("OptionalDefaultValueMethod", thrift.EXCEPTION, seqId) 10519 x.Write(oprot) 10520 oprot.WriteMessageEnd() 10521 oprot.Flush(ctx) 10522 return true, err2 10523 } else { 10524 result.Success = retval 10525 } 10526 if err2 = oprot.WriteMessageBegin("OptionalDefaultValueMethod", thrift.REPLY, seqId); err2 != nil { 10527 err = err2 10528 } 10529 if err2 = result.Write(oprot); err == nil && err2 != nil { 10530 err = err2 10531 } 10532 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10533 err = err2 10534 } 10535 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10536 err = err2 10537 } 10538 if err != nil { 10539 return 10540 } 10541 return true, err 10542 } 10543 10544 type exampleServiceProcessorNoBodyStructMethod struct { 10545 handler ExampleService 10546 } 10547 10548 func (p *exampleServiceProcessorNoBodyStructMethod) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10549 args := ExampleServiceNoBodyStructMethodArgs{} 10550 if err = args.Read(iprot); err != nil { 10551 iprot.ReadMessageEnd() 10552 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10553 oprot.WriteMessageBegin("NoBodyStructMethod", thrift.EXCEPTION, seqId) 10554 x.Write(oprot) 10555 oprot.WriteMessageEnd() 10556 oprot.Flush(ctx) 10557 return false, err 10558 } 10559 10560 iprot.ReadMessageEnd() 10561 var err2 error 10562 result := ExampleServiceNoBodyStructMethodResult{} 10563 var retval *ExampleNoBodyStruct 10564 if retval, err2 = p.handler.NoBodyStructMethod(ctx, args.Req); err2 != nil { 10565 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing NoBodyStructMethod: "+err2.Error()) 10566 oprot.WriteMessageBegin("NoBodyStructMethod", thrift.EXCEPTION, seqId) 10567 x.Write(oprot) 10568 oprot.WriteMessageEnd() 10569 oprot.Flush(ctx) 10570 return true, err2 10571 } else { 10572 result.Success = retval 10573 } 10574 if err2 = oprot.WriteMessageBegin("NoBodyStructMethod", thrift.REPLY, seqId); err2 != nil { 10575 err = err2 10576 } 10577 if err2 = result.Write(oprot); err == nil && err2 != nil { 10578 err = err2 10579 } 10580 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10581 err = err2 10582 } 10583 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10584 err = err2 10585 } 10586 if err != nil { 10587 return 10588 } 10589 return true, err 10590 } 10591 10592 type exampleServiceProcessorString struct { 10593 handler ExampleService 10594 } 10595 10596 func (p *exampleServiceProcessorString) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10597 args := ExampleServiceStringArgs{} 10598 if err = args.Read(iprot); err != nil { 10599 iprot.ReadMessageEnd() 10600 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10601 oprot.WriteMessageBegin("String", thrift.EXCEPTION, seqId) 10602 x.Write(oprot) 10603 oprot.WriteMessageEnd() 10604 oprot.Flush(ctx) 10605 return false, err 10606 } 10607 10608 iprot.ReadMessageEnd() 10609 var err2 error 10610 result := ExampleServiceStringResult{} 10611 var retval string 10612 if retval, err2 = p.handler.String(ctx, args.Req); err2 != nil { 10613 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing String: "+err2.Error()) 10614 oprot.WriteMessageBegin("String", thrift.EXCEPTION, seqId) 10615 x.Write(oprot) 10616 oprot.WriteMessageEnd() 10617 oprot.Flush(ctx) 10618 return true, err2 10619 } else { 10620 result.Success = &retval 10621 } 10622 if err2 = oprot.WriteMessageBegin("String", thrift.REPLY, seqId); err2 != nil { 10623 err = err2 10624 } 10625 if err2 = result.Write(oprot); err == nil && err2 != nil { 10626 err = err2 10627 } 10628 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10629 err = err2 10630 } 10631 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10632 err = err2 10633 } 10634 if err != nil { 10635 return 10636 } 10637 return true, err 10638 } 10639 10640 type exampleServiceProcessorI64 struct { 10641 handler ExampleService 10642 } 10643 10644 func (p *exampleServiceProcessorI64) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { 10645 args := ExampleServiceI64Args{} 10646 if err = args.Read(iprot); err != nil { 10647 iprot.ReadMessageEnd() 10648 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) 10649 oprot.WriteMessageBegin("I64", thrift.EXCEPTION, seqId) 10650 x.Write(oprot) 10651 oprot.WriteMessageEnd() 10652 oprot.Flush(ctx) 10653 return false, err 10654 } 10655 10656 iprot.ReadMessageEnd() 10657 var err2 error 10658 result := ExampleServiceI64Result{} 10659 var retval int64 10660 if retval, err2 = p.handler.I64(ctx, args.Req); err2 != nil { 10661 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing I64: "+err2.Error()) 10662 oprot.WriteMessageBegin("I64", thrift.EXCEPTION, seqId) 10663 x.Write(oprot) 10664 oprot.WriteMessageEnd() 10665 oprot.Flush(ctx) 10666 return true, err2 10667 } else { 10668 result.Success = &retval 10669 } 10670 if err2 = oprot.WriteMessageBegin("I64", thrift.REPLY, seqId); err2 != nil { 10671 err = err2 10672 } 10673 if err2 = result.Write(oprot); err == nil && err2 != nil { 10674 err = err2 10675 } 10676 if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { 10677 err = err2 10678 } 10679 if err2 = oprot.Flush(ctx); err == nil && err2 != nil { 10680 err = err2 10681 } 10682 if err != nil { 10683 return 10684 } 10685 return true, err 10686 } 10687 10688 type ExampleServiceExampleMethodArgs struct { 10689 Req *ExampleReq `thrift:"req,1" json:"req"` 10690 } 10691 10692 func NewExampleServiceExampleMethodArgs() *ExampleServiceExampleMethodArgs { 10693 return &ExampleServiceExampleMethodArgs{} 10694 } 10695 10696 var ExampleServiceExampleMethodArgs_Req_DEFAULT *ExampleReq 10697 10698 func (p *ExampleServiceExampleMethodArgs) GetReq() (v *ExampleReq) { 10699 if !p.IsSetReq() { 10700 return ExampleServiceExampleMethodArgs_Req_DEFAULT 10701 } 10702 return p.Req 10703 } 10704 func (p *ExampleServiceExampleMethodArgs) SetReq(val *ExampleReq) { 10705 p.Req = val 10706 } 10707 10708 var fieldIDToName_ExampleServiceExampleMethodArgs = map[int16]string{ 10709 1: "req", 10710 } 10711 10712 func (p *ExampleServiceExampleMethodArgs) IsSetReq() bool { 10713 return p.Req != nil 10714 } 10715 10716 func (p *ExampleServiceExampleMethodArgs) Read(iprot thrift.TProtocol) (err error) { 10717 10718 var fieldTypeId thrift.TType 10719 var fieldId int16 10720 10721 if _, err = iprot.ReadStructBegin(); err != nil { 10722 goto ReadStructBeginError 10723 } 10724 10725 for { 10726 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 10727 if err != nil { 10728 goto ReadFieldBeginError 10729 } 10730 if fieldTypeId == thrift.STOP { 10731 break 10732 } 10733 10734 switch fieldId { 10735 case 1: 10736 if fieldTypeId == thrift.STRUCT { 10737 if err = p.ReadField1(iprot); err != nil { 10738 goto ReadFieldError 10739 } 10740 } else { 10741 if err = iprot.Skip(fieldTypeId); err != nil { 10742 goto SkipFieldError 10743 } 10744 } 10745 default: 10746 if err = iprot.Skip(fieldTypeId); err != nil { 10747 goto SkipFieldError 10748 } 10749 } 10750 10751 if err = iprot.ReadFieldEnd(); err != nil { 10752 goto ReadFieldEndError 10753 } 10754 } 10755 if err = iprot.ReadStructEnd(); err != nil { 10756 goto ReadStructEndError 10757 } 10758 10759 return nil 10760 ReadStructBeginError: 10761 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 10762 ReadFieldBeginError: 10763 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 10764 ReadFieldError: 10765 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceExampleMethodArgs[fieldId]), err) 10766 SkipFieldError: 10767 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 10768 10769 ReadFieldEndError: 10770 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 10771 ReadStructEndError: 10772 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 10773 } 10774 10775 func (p *ExampleServiceExampleMethodArgs) ReadField1(iprot thrift.TProtocol) error { 10776 p.Req = NewExampleReq() 10777 if err := p.Req.Read(iprot); err != nil { 10778 return err 10779 } 10780 return nil 10781 } 10782 10783 func (p *ExampleServiceExampleMethodArgs) Write(oprot thrift.TProtocol) (err error) { 10784 var fieldId int16 10785 if err = oprot.WriteStructBegin("ExampleMethod_args"); err != nil { 10786 goto WriteStructBeginError 10787 } 10788 if p != nil { 10789 if err = p.writeField1(oprot); err != nil { 10790 fieldId = 1 10791 goto WriteFieldError 10792 } 10793 10794 } 10795 if err = oprot.WriteFieldStop(); err != nil { 10796 goto WriteFieldStopError 10797 } 10798 if err = oprot.WriteStructEnd(); err != nil { 10799 goto WriteStructEndError 10800 } 10801 return nil 10802 WriteStructBeginError: 10803 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 10804 WriteFieldError: 10805 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 10806 WriteFieldStopError: 10807 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 10808 WriteStructEndError: 10809 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 10810 } 10811 10812 func (p *ExampleServiceExampleMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 10813 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 10814 goto WriteFieldBeginError 10815 } 10816 if err := p.Req.Write(oprot); err != nil { 10817 return err 10818 } 10819 if err = oprot.WriteFieldEnd(); err != nil { 10820 goto WriteFieldEndError 10821 } 10822 return nil 10823 WriteFieldBeginError: 10824 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 10825 WriteFieldEndError: 10826 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 10827 } 10828 10829 func (p *ExampleServiceExampleMethodArgs) String() string { 10830 if p == nil { 10831 return "<nil>" 10832 } 10833 return fmt.Sprintf("ExampleServiceExampleMethodArgs(%+v)", *p) 10834 } 10835 10836 func (p *ExampleServiceExampleMethodArgs) DeepEqual(ano *ExampleServiceExampleMethodArgs) bool { 10837 if p == ano { 10838 return true 10839 } else if p == nil || ano == nil { 10840 return false 10841 } 10842 if !p.Field1DeepEqual(ano.Req) { 10843 return false 10844 } 10845 return true 10846 } 10847 10848 func (p *ExampleServiceExampleMethodArgs) Field1DeepEqual(src *ExampleReq) bool { 10849 10850 if !p.Req.DeepEqual(src) { 10851 return false 10852 } 10853 return true 10854 } 10855 10856 type ExampleServiceExampleMethodResult struct { 10857 Success *ExampleResp `thrift:"success,0" json:"success,omitempty"` 10858 Err *Exception `thrift:"err,1" json:"err,omitempty"` 10859 } 10860 10861 func NewExampleServiceExampleMethodResult() *ExampleServiceExampleMethodResult { 10862 return &ExampleServiceExampleMethodResult{} 10863 } 10864 10865 var ExampleServiceExampleMethodResult_Success_DEFAULT *ExampleResp 10866 10867 func (p *ExampleServiceExampleMethodResult) GetSuccess() (v *ExampleResp) { 10868 if !p.IsSetSuccess() { 10869 return ExampleServiceExampleMethodResult_Success_DEFAULT 10870 } 10871 return p.Success 10872 } 10873 10874 var ExampleServiceExampleMethodResult_Err_DEFAULT *Exception 10875 10876 func (p *ExampleServiceExampleMethodResult) GetErr() (v *Exception) { 10877 if !p.IsSetErr() { 10878 return ExampleServiceExampleMethodResult_Err_DEFAULT 10879 } 10880 return p.Err 10881 } 10882 func (p *ExampleServiceExampleMethodResult) SetSuccess(x interface{}) { 10883 p.Success = x.(*ExampleResp) 10884 } 10885 func (p *ExampleServiceExampleMethodResult) SetErr(val *Exception) { 10886 p.Err = val 10887 } 10888 10889 var fieldIDToName_ExampleServiceExampleMethodResult = map[int16]string{ 10890 0: "success", 10891 1: "err", 10892 } 10893 10894 func (p *ExampleServiceExampleMethodResult) IsSetSuccess() bool { 10895 return p.Success != nil 10896 } 10897 10898 func (p *ExampleServiceExampleMethodResult) IsSetErr() bool { 10899 return p.Err != nil 10900 } 10901 10902 func (p *ExampleServiceExampleMethodResult) Read(iprot thrift.TProtocol) (err error) { 10903 10904 var fieldTypeId thrift.TType 10905 var fieldId int16 10906 10907 if _, err = iprot.ReadStructBegin(); err != nil { 10908 goto ReadStructBeginError 10909 } 10910 10911 for { 10912 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 10913 if err != nil { 10914 goto ReadFieldBeginError 10915 } 10916 if fieldTypeId == thrift.STOP { 10917 break 10918 } 10919 10920 switch fieldId { 10921 case 0: 10922 if fieldTypeId == thrift.STRUCT { 10923 if err = p.ReadField0(iprot); err != nil { 10924 goto ReadFieldError 10925 } 10926 } else { 10927 if err = iprot.Skip(fieldTypeId); err != nil { 10928 goto SkipFieldError 10929 } 10930 } 10931 case 1: 10932 if fieldTypeId == thrift.STRUCT { 10933 if err = p.ReadField1(iprot); err != nil { 10934 goto ReadFieldError 10935 } 10936 } else { 10937 if err = iprot.Skip(fieldTypeId); err != nil { 10938 goto SkipFieldError 10939 } 10940 } 10941 default: 10942 if err = iprot.Skip(fieldTypeId); err != nil { 10943 goto SkipFieldError 10944 } 10945 } 10946 10947 if err = iprot.ReadFieldEnd(); err != nil { 10948 goto ReadFieldEndError 10949 } 10950 } 10951 if err = iprot.ReadStructEnd(); err != nil { 10952 goto ReadStructEndError 10953 } 10954 10955 return nil 10956 ReadStructBeginError: 10957 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 10958 ReadFieldBeginError: 10959 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 10960 ReadFieldError: 10961 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceExampleMethodResult[fieldId]), err) 10962 SkipFieldError: 10963 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 10964 10965 ReadFieldEndError: 10966 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 10967 ReadStructEndError: 10968 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 10969 } 10970 10971 func (p *ExampleServiceExampleMethodResult) ReadField0(iprot thrift.TProtocol) error { 10972 p.Success = NewExampleResp() 10973 if err := p.Success.Read(iprot); err != nil { 10974 return err 10975 } 10976 return nil 10977 } 10978 10979 func (p *ExampleServiceExampleMethodResult) ReadField1(iprot thrift.TProtocol) error { 10980 p.Err = NewException() 10981 if err := p.Err.Read(iprot); err != nil { 10982 return err 10983 } 10984 return nil 10985 } 10986 10987 func (p *ExampleServiceExampleMethodResult) Write(oprot thrift.TProtocol) (err error) { 10988 var fieldId int16 10989 if err = oprot.WriteStructBegin("ExampleMethod_result"); err != nil { 10990 goto WriteStructBeginError 10991 } 10992 if p != nil { 10993 if err = p.writeField0(oprot); err != nil { 10994 fieldId = 0 10995 goto WriteFieldError 10996 } 10997 if err = p.writeField1(oprot); err != nil { 10998 fieldId = 1 10999 goto WriteFieldError 11000 } 11001 11002 } 11003 if err = oprot.WriteFieldStop(); err != nil { 11004 goto WriteFieldStopError 11005 } 11006 if err = oprot.WriteStructEnd(); err != nil { 11007 goto WriteStructEndError 11008 } 11009 return nil 11010 WriteStructBeginError: 11011 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 11012 WriteFieldError: 11013 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 11014 WriteFieldStopError: 11015 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 11016 WriteStructEndError: 11017 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 11018 } 11019 11020 func (p *ExampleServiceExampleMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 11021 if p.IsSetSuccess() { 11022 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 11023 goto WriteFieldBeginError 11024 } 11025 if err := p.Success.Write(oprot); err != nil { 11026 return err 11027 } 11028 if err = oprot.WriteFieldEnd(); err != nil { 11029 goto WriteFieldEndError 11030 } 11031 } 11032 return nil 11033 WriteFieldBeginError: 11034 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 11035 WriteFieldEndError: 11036 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 11037 } 11038 11039 func (p *ExampleServiceExampleMethodResult) writeField1(oprot thrift.TProtocol) (err error) { 11040 if p.IsSetErr() { 11041 if err = oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil { 11042 goto WriteFieldBeginError 11043 } 11044 if err := p.Err.Write(oprot); err != nil { 11045 return err 11046 } 11047 if err = oprot.WriteFieldEnd(); err != nil { 11048 goto WriteFieldEndError 11049 } 11050 } 11051 return nil 11052 WriteFieldBeginError: 11053 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 11054 WriteFieldEndError: 11055 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 11056 } 11057 11058 func (p *ExampleServiceExampleMethodResult) String() string { 11059 if p == nil { 11060 return "<nil>" 11061 } 11062 return fmt.Sprintf("ExampleServiceExampleMethodResult(%+v)", *p) 11063 } 11064 11065 func (p *ExampleServiceExampleMethodResult) DeepEqual(ano *ExampleServiceExampleMethodResult) bool { 11066 if p == ano { 11067 return true 11068 } else if p == nil || ano == nil { 11069 return false 11070 } 11071 if !p.Field0DeepEqual(ano.Success) { 11072 return false 11073 } 11074 if !p.Field1DeepEqual(ano.Err) { 11075 return false 11076 } 11077 return true 11078 } 11079 11080 func (p *ExampleServiceExampleMethodResult) Field0DeepEqual(src *ExampleResp) bool { 11081 11082 if !p.Success.DeepEqual(src) { 11083 return false 11084 } 11085 return true 11086 } 11087 func (p *ExampleServiceExampleMethodResult) Field1DeepEqual(src *Exception) bool { 11088 11089 if !p.Err.DeepEqual(src) { 11090 return false 11091 } 11092 return true 11093 } 11094 11095 type ExampleServiceErrorMethodArgs struct { 11096 Req *ExampleError `thrift:"req,1" json:"req"` 11097 } 11098 11099 func NewExampleServiceErrorMethodArgs() *ExampleServiceErrorMethodArgs { 11100 return &ExampleServiceErrorMethodArgs{} 11101 } 11102 11103 var ExampleServiceErrorMethodArgs_Req_DEFAULT *ExampleError 11104 11105 func (p *ExampleServiceErrorMethodArgs) GetReq() (v *ExampleError) { 11106 if !p.IsSetReq() { 11107 return ExampleServiceErrorMethodArgs_Req_DEFAULT 11108 } 11109 return p.Req 11110 } 11111 func (p *ExampleServiceErrorMethodArgs) SetReq(val *ExampleError) { 11112 p.Req = val 11113 } 11114 11115 var fieldIDToName_ExampleServiceErrorMethodArgs = map[int16]string{ 11116 1: "req", 11117 } 11118 11119 func (p *ExampleServiceErrorMethodArgs) IsSetReq() bool { 11120 return p.Req != nil 11121 } 11122 11123 func (p *ExampleServiceErrorMethodArgs) Read(iprot thrift.TProtocol) (err error) { 11124 11125 var fieldTypeId thrift.TType 11126 var fieldId int16 11127 11128 if _, err = iprot.ReadStructBegin(); err != nil { 11129 goto ReadStructBeginError 11130 } 11131 11132 for { 11133 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 11134 if err != nil { 11135 goto ReadFieldBeginError 11136 } 11137 if fieldTypeId == thrift.STOP { 11138 break 11139 } 11140 11141 switch fieldId { 11142 case 1: 11143 if fieldTypeId == thrift.STRUCT { 11144 if err = p.ReadField1(iprot); err != nil { 11145 goto ReadFieldError 11146 } 11147 } else { 11148 if err = iprot.Skip(fieldTypeId); err != nil { 11149 goto SkipFieldError 11150 } 11151 } 11152 default: 11153 if err = iprot.Skip(fieldTypeId); err != nil { 11154 goto SkipFieldError 11155 } 11156 } 11157 11158 if err = iprot.ReadFieldEnd(); err != nil { 11159 goto ReadFieldEndError 11160 } 11161 } 11162 if err = iprot.ReadStructEnd(); err != nil { 11163 goto ReadStructEndError 11164 } 11165 11166 return nil 11167 ReadStructBeginError: 11168 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 11169 ReadFieldBeginError: 11170 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 11171 ReadFieldError: 11172 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceErrorMethodArgs[fieldId]), err) 11173 SkipFieldError: 11174 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 11175 11176 ReadFieldEndError: 11177 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 11178 ReadStructEndError: 11179 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 11180 } 11181 11182 func (p *ExampleServiceErrorMethodArgs) ReadField1(iprot thrift.TProtocol) error { 11183 p.Req = NewExampleError() 11184 if err := p.Req.Read(iprot); err != nil { 11185 return err 11186 } 11187 return nil 11188 } 11189 11190 func (p *ExampleServiceErrorMethodArgs) Write(oprot thrift.TProtocol) (err error) { 11191 var fieldId int16 11192 if err = oprot.WriteStructBegin("ErrorMethod_args"); err != nil { 11193 goto WriteStructBeginError 11194 } 11195 if p != nil { 11196 if err = p.writeField1(oprot); err != nil { 11197 fieldId = 1 11198 goto WriteFieldError 11199 } 11200 11201 } 11202 if err = oprot.WriteFieldStop(); err != nil { 11203 goto WriteFieldStopError 11204 } 11205 if err = oprot.WriteStructEnd(); err != nil { 11206 goto WriteStructEndError 11207 } 11208 return nil 11209 WriteStructBeginError: 11210 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 11211 WriteFieldError: 11212 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 11213 WriteFieldStopError: 11214 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 11215 WriteStructEndError: 11216 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 11217 } 11218 11219 func (p *ExampleServiceErrorMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 11220 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 11221 goto WriteFieldBeginError 11222 } 11223 if err := p.Req.Write(oprot); err != nil { 11224 return err 11225 } 11226 if err = oprot.WriteFieldEnd(); err != nil { 11227 goto WriteFieldEndError 11228 } 11229 return nil 11230 WriteFieldBeginError: 11231 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 11232 WriteFieldEndError: 11233 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 11234 } 11235 11236 func (p *ExampleServiceErrorMethodArgs) String() string { 11237 if p == nil { 11238 return "<nil>" 11239 } 11240 return fmt.Sprintf("ExampleServiceErrorMethodArgs(%+v)", *p) 11241 } 11242 11243 func (p *ExampleServiceErrorMethodArgs) DeepEqual(ano *ExampleServiceErrorMethodArgs) bool { 11244 if p == ano { 11245 return true 11246 } else if p == nil || ano == nil { 11247 return false 11248 } 11249 if !p.Field1DeepEqual(ano.Req) { 11250 return false 11251 } 11252 return true 11253 } 11254 11255 func (p *ExampleServiceErrorMethodArgs) Field1DeepEqual(src *ExampleError) bool { 11256 11257 if !p.Req.DeepEqual(src) { 11258 return false 11259 } 11260 return true 11261 } 11262 11263 type ExampleServiceErrorMethodResult struct { 11264 Success *ExampleErrorResp `thrift:"success,0" json:"success,omitempty"` 11265 } 11266 11267 func NewExampleServiceErrorMethodResult() *ExampleServiceErrorMethodResult { 11268 return &ExampleServiceErrorMethodResult{} 11269 } 11270 11271 var ExampleServiceErrorMethodResult_Success_DEFAULT *ExampleErrorResp 11272 11273 func (p *ExampleServiceErrorMethodResult) GetSuccess() (v *ExampleErrorResp) { 11274 if !p.IsSetSuccess() { 11275 return ExampleServiceErrorMethodResult_Success_DEFAULT 11276 } 11277 return p.Success 11278 } 11279 func (p *ExampleServiceErrorMethodResult) SetSuccess(x interface{}) { 11280 p.Success = x.(*ExampleErrorResp) 11281 } 11282 11283 var fieldIDToName_ExampleServiceErrorMethodResult = map[int16]string{ 11284 0: "success", 11285 } 11286 11287 func (p *ExampleServiceErrorMethodResult) IsSetSuccess() bool { 11288 return p.Success != nil 11289 } 11290 11291 func (p *ExampleServiceErrorMethodResult) Read(iprot thrift.TProtocol) (err error) { 11292 11293 var fieldTypeId thrift.TType 11294 var fieldId int16 11295 11296 if _, err = iprot.ReadStructBegin(); err != nil { 11297 goto ReadStructBeginError 11298 } 11299 11300 for { 11301 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 11302 if err != nil { 11303 goto ReadFieldBeginError 11304 } 11305 if fieldTypeId == thrift.STOP { 11306 break 11307 } 11308 11309 switch fieldId { 11310 case 0: 11311 if fieldTypeId == thrift.STRUCT { 11312 if err = p.ReadField0(iprot); err != nil { 11313 goto ReadFieldError 11314 } 11315 } else { 11316 if err = iprot.Skip(fieldTypeId); err != nil { 11317 goto SkipFieldError 11318 } 11319 } 11320 default: 11321 if err = iprot.Skip(fieldTypeId); err != nil { 11322 goto SkipFieldError 11323 } 11324 } 11325 11326 if err = iprot.ReadFieldEnd(); err != nil { 11327 goto ReadFieldEndError 11328 } 11329 } 11330 if err = iprot.ReadStructEnd(); err != nil { 11331 goto ReadStructEndError 11332 } 11333 11334 return nil 11335 ReadStructBeginError: 11336 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 11337 ReadFieldBeginError: 11338 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 11339 ReadFieldError: 11340 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceErrorMethodResult[fieldId]), err) 11341 SkipFieldError: 11342 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 11343 11344 ReadFieldEndError: 11345 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 11346 ReadStructEndError: 11347 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 11348 } 11349 11350 func (p *ExampleServiceErrorMethodResult) ReadField0(iprot thrift.TProtocol) error { 11351 p.Success = NewExampleErrorResp() 11352 if err := p.Success.Read(iprot); err != nil { 11353 return err 11354 } 11355 return nil 11356 } 11357 11358 func (p *ExampleServiceErrorMethodResult) Write(oprot thrift.TProtocol) (err error) { 11359 var fieldId int16 11360 if err = oprot.WriteStructBegin("ErrorMethod_result"); err != nil { 11361 goto WriteStructBeginError 11362 } 11363 if p != nil { 11364 if err = p.writeField0(oprot); err != nil { 11365 fieldId = 0 11366 goto WriteFieldError 11367 } 11368 11369 } 11370 if err = oprot.WriteFieldStop(); err != nil { 11371 goto WriteFieldStopError 11372 } 11373 if err = oprot.WriteStructEnd(); err != nil { 11374 goto WriteStructEndError 11375 } 11376 return nil 11377 WriteStructBeginError: 11378 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 11379 WriteFieldError: 11380 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 11381 WriteFieldStopError: 11382 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 11383 WriteStructEndError: 11384 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 11385 } 11386 11387 func (p *ExampleServiceErrorMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 11388 if p.IsSetSuccess() { 11389 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 11390 goto WriteFieldBeginError 11391 } 11392 if err := p.Success.Write(oprot); err != nil { 11393 return err 11394 } 11395 if err = oprot.WriteFieldEnd(); err != nil { 11396 goto WriteFieldEndError 11397 } 11398 } 11399 return nil 11400 WriteFieldBeginError: 11401 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 11402 WriteFieldEndError: 11403 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 11404 } 11405 11406 func (p *ExampleServiceErrorMethodResult) String() string { 11407 if p == nil { 11408 return "<nil>" 11409 } 11410 return fmt.Sprintf("ExampleServiceErrorMethodResult(%+v)", *p) 11411 } 11412 11413 func (p *ExampleServiceErrorMethodResult) DeepEqual(ano *ExampleServiceErrorMethodResult) bool { 11414 if p == ano { 11415 return true 11416 } else if p == nil || ano == nil { 11417 return false 11418 } 11419 if !p.Field0DeepEqual(ano.Success) { 11420 return false 11421 } 11422 return true 11423 } 11424 11425 func (p *ExampleServiceErrorMethodResult) Field0DeepEqual(src *ExampleErrorResp) bool { 11426 11427 if !p.Success.DeepEqual(src) { 11428 return false 11429 } 11430 return true 11431 } 11432 11433 type ExampleServiceInt2FloatMethodArgs struct { 11434 Req *ExampleInt2Float `thrift:"req,1" json:"req"` 11435 } 11436 11437 func NewExampleServiceInt2FloatMethodArgs() *ExampleServiceInt2FloatMethodArgs { 11438 return &ExampleServiceInt2FloatMethodArgs{} 11439 } 11440 11441 var ExampleServiceInt2FloatMethodArgs_Req_DEFAULT *ExampleInt2Float 11442 11443 func (p *ExampleServiceInt2FloatMethodArgs) GetReq() (v *ExampleInt2Float) { 11444 if !p.IsSetReq() { 11445 return ExampleServiceInt2FloatMethodArgs_Req_DEFAULT 11446 } 11447 return p.Req 11448 } 11449 func (p *ExampleServiceInt2FloatMethodArgs) SetReq(val *ExampleInt2Float) { 11450 p.Req = val 11451 } 11452 11453 var fieldIDToName_ExampleServiceInt2FloatMethodArgs = map[int16]string{ 11454 1: "req", 11455 } 11456 11457 func (p *ExampleServiceInt2FloatMethodArgs) IsSetReq() bool { 11458 return p.Req != nil 11459 } 11460 11461 func (p *ExampleServiceInt2FloatMethodArgs) Read(iprot thrift.TProtocol) (err error) { 11462 11463 var fieldTypeId thrift.TType 11464 var fieldId int16 11465 11466 if _, err = iprot.ReadStructBegin(); err != nil { 11467 goto ReadStructBeginError 11468 } 11469 11470 for { 11471 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 11472 if err != nil { 11473 goto ReadFieldBeginError 11474 } 11475 if fieldTypeId == thrift.STOP { 11476 break 11477 } 11478 11479 switch fieldId { 11480 case 1: 11481 if fieldTypeId == thrift.STRUCT { 11482 if err = p.ReadField1(iprot); err != nil { 11483 goto ReadFieldError 11484 } 11485 } else { 11486 if err = iprot.Skip(fieldTypeId); err != nil { 11487 goto SkipFieldError 11488 } 11489 } 11490 default: 11491 if err = iprot.Skip(fieldTypeId); err != nil { 11492 goto SkipFieldError 11493 } 11494 } 11495 11496 if err = iprot.ReadFieldEnd(); err != nil { 11497 goto ReadFieldEndError 11498 } 11499 } 11500 if err = iprot.ReadStructEnd(); err != nil { 11501 goto ReadStructEndError 11502 } 11503 11504 return nil 11505 ReadStructBeginError: 11506 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 11507 ReadFieldBeginError: 11508 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 11509 ReadFieldError: 11510 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceInt2FloatMethodArgs[fieldId]), err) 11511 SkipFieldError: 11512 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 11513 11514 ReadFieldEndError: 11515 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 11516 ReadStructEndError: 11517 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 11518 } 11519 11520 func (p *ExampleServiceInt2FloatMethodArgs) ReadField1(iprot thrift.TProtocol) error { 11521 p.Req = NewExampleInt2Float() 11522 if err := p.Req.Read(iprot); err != nil { 11523 return err 11524 } 11525 return nil 11526 } 11527 11528 func (p *ExampleServiceInt2FloatMethodArgs) Write(oprot thrift.TProtocol) (err error) { 11529 var fieldId int16 11530 if err = oprot.WriteStructBegin("Int2FloatMethod_args"); err != nil { 11531 goto WriteStructBeginError 11532 } 11533 if p != nil { 11534 if err = p.writeField1(oprot); err != nil { 11535 fieldId = 1 11536 goto WriteFieldError 11537 } 11538 11539 } 11540 if err = oprot.WriteFieldStop(); err != nil { 11541 goto WriteFieldStopError 11542 } 11543 if err = oprot.WriteStructEnd(); err != nil { 11544 goto WriteStructEndError 11545 } 11546 return nil 11547 WriteStructBeginError: 11548 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 11549 WriteFieldError: 11550 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 11551 WriteFieldStopError: 11552 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 11553 WriteStructEndError: 11554 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 11555 } 11556 11557 func (p *ExampleServiceInt2FloatMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 11558 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 11559 goto WriteFieldBeginError 11560 } 11561 if err := p.Req.Write(oprot); err != nil { 11562 return err 11563 } 11564 if err = oprot.WriteFieldEnd(); err != nil { 11565 goto WriteFieldEndError 11566 } 11567 return nil 11568 WriteFieldBeginError: 11569 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 11570 WriteFieldEndError: 11571 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 11572 } 11573 11574 func (p *ExampleServiceInt2FloatMethodArgs) String() string { 11575 if p == nil { 11576 return "<nil>" 11577 } 11578 return fmt.Sprintf("ExampleServiceInt2FloatMethodArgs(%+v)", *p) 11579 } 11580 11581 func (p *ExampleServiceInt2FloatMethodArgs) DeepEqual(ano *ExampleServiceInt2FloatMethodArgs) bool { 11582 if p == ano { 11583 return true 11584 } else if p == nil || ano == nil { 11585 return false 11586 } 11587 if !p.Field1DeepEqual(ano.Req) { 11588 return false 11589 } 11590 return true 11591 } 11592 11593 func (p *ExampleServiceInt2FloatMethodArgs) Field1DeepEqual(src *ExampleInt2Float) bool { 11594 11595 if !p.Req.DeepEqual(src) { 11596 return false 11597 } 11598 return true 11599 } 11600 11601 type ExampleServiceInt2FloatMethodResult struct { 11602 Success *ExampleInt2Float `thrift:"success,0" json:"success,omitempty"` 11603 } 11604 11605 func NewExampleServiceInt2FloatMethodResult() *ExampleServiceInt2FloatMethodResult { 11606 return &ExampleServiceInt2FloatMethodResult{} 11607 } 11608 11609 var ExampleServiceInt2FloatMethodResult_Success_DEFAULT *ExampleInt2Float 11610 11611 func (p *ExampleServiceInt2FloatMethodResult) GetSuccess() (v *ExampleInt2Float) { 11612 if !p.IsSetSuccess() { 11613 return ExampleServiceInt2FloatMethodResult_Success_DEFAULT 11614 } 11615 return p.Success 11616 } 11617 func (p *ExampleServiceInt2FloatMethodResult) SetSuccess(x interface{}) { 11618 p.Success = x.(*ExampleInt2Float) 11619 } 11620 11621 var fieldIDToName_ExampleServiceInt2FloatMethodResult = map[int16]string{ 11622 0: "success", 11623 } 11624 11625 func (p *ExampleServiceInt2FloatMethodResult) IsSetSuccess() bool { 11626 return p.Success != nil 11627 } 11628 11629 func (p *ExampleServiceInt2FloatMethodResult) Read(iprot thrift.TProtocol) (err error) { 11630 11631 var fieldTypeId thrift.TType 11632 var fieldId int16 11633 11634 if _, err = iprot.ReadStructBegin(); err != nil { 11635 goto ReadStructBeginError 11636 } 11637 11638 for { 11639 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 11640 if err != nil { 11641 goto ReadFieldBeginError 11642 } 11643 if fieldTypeId == thrift.STOP { 11644 break 11645 } 11646 11647 switch fieldId { 11648 case 0: 11649 if fieldTypeId == thrift.STRUCT { 11650 if err = p.ReadField0(iprot); err != nil { 11651 goto ReadFieldError 11652 } 11653 } else { 11654 if err = iprot.Skip(fieldTypeId); err != nil { 11655 goto SkipFieldError 11656 } 11657 } 11658 default: 11659 if err = iprot.Skip(fieldTypeId); err != nil { 11660 goto SkipFieldError 11661 } 11662 } 11663 11664 if err = iprot.ReadFieldEnd(); err != nil { 11665 goto ReadFieldEndError 11666 } 11667 } 11668 if err = iprot.ReadStructEnd(); err != nil { 11669 goto ReadStructEndError 11670 } 11671 11672 return nil 11673 ReadStructBeginError: 11674 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 11675 ReadFieldBeginError: 11676 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 11677 ReadFieldError: 11678 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceInt2FloatMethodResult[fieldId]), err) 11679 SkipFieldError: 11680 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 11681 11682 ReadFieldEndError: 11683 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 11684 ReadStructEndError: 11685 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 11686 } 11687 11688 func (p *ExampleServiceInt2FloatMethodResult) ReadField0(iprot thrift.TProtocol) error { 11689 p.Success = NewExampleInt2Float() 11690 if err := p.Success.Read(iprot); err != nil { 11691 return err 11692 } 11693 return nil 11694 } 11695 11696 func (p *ExampleServiceInt2FloatMethodResult) Write(oprot thrift.TProtocol) (err error) { 11697 var fieldId int16 11698 if err = oprot.WriteStructBegin("Int2FloatMethod_result"); err != nil { 11699 goto WriteStructBeginError 11700 } 11701 if p != nil { 11702 if err = p.writeField0(oprot); err != nil { 11703 fieldId = 0 11704 goto WriteFieldError 11705 } 11706 11707 } 11708 if err = oprot.WriteFieldStop(); err != nil { 11709 goto WriteFieldStopError 11710 } 11711 if err = oprot.WriteStructEnd(); err != nil { 11712 goto WriteStructEndError 11713 } 11714 return nil 11715 WriteStructBeginError: 11716 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 11717 WriteFieldError: 11718 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 11719 WriteFieldStopError: 11720 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 11721 WriteStructEndError: 11722 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 11723 } 11724 11725 func (p *ExampleServiceInt2FloatMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 11726 if p.IsSetSuccess() { 11727 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 11728 goto WriteFieldBeginError 11729 } 11730 if err := p.Success.Write(oprot); err != nil { 11731 return err 11732 } 11733 if err = oprot.WriteFieldEnd(); err != nil { 11734 goto WriteFieldEndError 11735 } 11736 } 11737 return nil 11738 WriteFieldBeginError: 11739 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 11740 WriteFieldEndError: 11741 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 11742 } 11743 11744 func (p *ExampleServiceInt2FloatMethodResult) String() string { 11745 if p == nil { 11746 return "<nil>" 11747 } 11748 return fmt.Sprintf("ExampleServiceInt2FloatMethodResult(%+v)", *p) 11749 } 11750 11751 func (p *ExampleServiceInt2FloatMethodResult) DeepEqual(ano *ExampleServiceInt2FloatMethodResult) bool { 11752 if p == ano { 11753 return true 11754 } else if p == nil || ano == nil { 11755 return false 11756 } 11757 if !p.Field0DeepEqual(ano.Success) { 11758 return false 11759 } 11760 return true 11761 } 11762 11763 func (p *ExampleServiceInt2FloatMethodResult) Field0DeepEqual(src *ExampleInt2Float) bool { 11764 11765 if !p.Success.DeepEqual(src) { 11766 return false 11767 } 11768 return true 11769 } 11770 11771 type ExampleServiceJSONStringMethodArgs struct { 11772 Req *ExampleJSONString `thrift:"req,1" json:"req"` 11773 } 11774 11775 func NewExampleServiceJSONStringMethodArgs() *ExampleServiceJSONStringMethodArgs { 11776 return &ExampleServiceJSONStringMethodArgs{} 11777 } 11778 11779 var ExampleServiceJSONStringMethodArgs_Req_DEFAULT *ExampleJSONString 11780 11781 func (p *ExampleServiceJSONStringMethodArgs) GetReq() (v *ExampleJSONString) { 11782 if !p.IsSetReq() { 11783 return ExampleServiceJSONStringMethodArgs_Req_DEFAULT 11784 } 11785 return p.Req 11786 } 11787 func (p *ExampleServiceJSONStringMethodArgs) SetReq(val *ExampleJSONString) { 11788 p.Req = val 11789 } 11790 11791 var fieldIDToName_ExampleServiceJSONStringMethodArgs = map[int16]string{ 11792 1: "req", 11793 } 11794 11795 func (p *ExampleServiceJSONStringMethodArgs) IsSetReq() bool { 11796 return p.Req != nil 11797 } 11798 11799 func (p *ExampleServiceJSONStringMethodArgs) Read(iprot thrift.TProtocol) (err error) { 11800 11801 var fieldTypeId thrift.TType 11802 var fieldId int16 11803 11804 if _, err = iprot.ReadStructBegin(); err != nil { 11805 goto ReadStructBeginError 11806 } 11807 11808 for { 11809 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 11810 if err != nil { 11811 goto ReadFieldBeginError 11812 } 11813 if fieldTypeId == thrift.STOP { 11814 break 11815 } 11816 11817 switch fieldId { 11818 case 1: 11819 if fieldTypeId == thrift.STRUCT { 11820 if err = p.ReadField1(iprot); err != nil { 11821 goto ReadFieldError 11822 } 11823 } else { 11824 if err = iprot.Skip(fieldTypeId); err != nil { 11825 goto SkipFieldError 11826 } 11827 } 11828 default: 11829 if err = iprot.Skip(fieldTypeId); err != nil { 11830 goto SkipFieldError 11831 } 11832 } 11833 11834 if err = iprot.ReadFieldEnd(); err != nil { 11835 goto ReadFieldEndError 11836 } 11837 } 11838 if err = iprot.ReadStructEnd(); err != nil { 11839 goto ReadStructEndError 11840 } 11841 11842 return nil 11843 ReadStructBeginError: 11844 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 11845 ReadFieldBeginError: 11846 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 11847 ReadFieldError: 11848 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceJSONStringMethodArgs[fieldId]), err) 11849 SkipFieldError: 11850 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 11851 11852 ReadFieldEndError: 11853 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 11854 ReadStructEndError: 11855 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 11856 } 11857 11858 func (p *ExampleServiceJSONStringMethodArgs) ReadField1(iprot thrift.TProtocol) error { 11859 p.Req = NewExampleJSONString() 11860 if err := p.Req.Read(iprot); err != nil { 11861 return err 11862 } 11863 return nil 11864 } 11865 11866 func (p *ExampleServiceJSONStringMethodArgs) Write(oprot thrift.TProtocol) (err error) { 11867 var fieldId int16 11868 if err = oprot.WriteStructBegin("JSONStringMethod_args"); err != nil { 11869 goto WriteStructBeginError 11870 } 11871 if p != nil { 11872 if err = p.writeField1(oprot); err != nil { 11873 fieldId = 1 11874 goto WriteFieldError 11875 } 11876 11877 } 11878 if err = oprot.WriteFieldStop(); err != nil { 11879 goto WriteFieldStopError 11880 } 11881 if err = oprot.WriteStructEnd(); err != nil { 11882 goto WriteStructEndError 11883 } 11884 return nil 11885 WriteStructBeginError: 11886 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 11887 WriteFieldError: 11888 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 11889 WriteFieldStopError: 11890 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 11891 WriteStructEndError: 11892 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 11893 } 11894 11895 func (p *ExampleServiceJSONStringMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 11896 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 11897 goto WriteFieldBeginError 11898 } 11899 if err := p.Req.Write(oprot); err != nil { 11900 return err 11901 } 11902 if err = oprot.WriteFieldEnd(); err != nil { 11903 goto WriteFieldEndError 11904 } 11905 return nil 11906 WriteFieldBeginError: 11907 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 11908 WriteFieldEndError: 11909 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 11910 } 11911 11912 func (p *ExampleServiceJSONStringMethodArgs) String() string { 11913 if p == nil { 11914 return "<nil>" 11915 } 11916 return fmt.Sprintf("ExampleServiceJSONStringMethodArgs(%+v)", *p) 11917 } 11918 11919 func (p *ExampleServiceJSONStringMethodArgs) DeepEqual(ano *ExampleServiceJSONStringMethodArgs) bool { 11920 if p == ano { 11921 return true 11922 } else if p == nil || ano == nil { 11923 return false 11924 } 11925 if !p.Field1DeepEqual(ano.Req) { 11926 return false 11927 } 11928 return true 11929 } 11930 11931 func (p *ExampleServiceJSONStringMethodArgs) Field1DeepEqual(src *ExampleJSONString) bool { 11932 11933 if !p.Req.DeepEqual(src) { 11934 return false 11935 } 11936 return true 11937 } 11938 11939 type ExampleServiceJSONStringMethodResult struct { 11940 Success *ExampleJSONString `thrift:"success,0" json:"success,omitempty"` 11941 } 11942 11943 func NewExampleServiceJSONStringMethodResult() *ExampleServiceJSONStringMethodResult { 11944 return &ExampleServiceJSONStringMethodResult{} 11945 } 11946 11947 var ExampleServiceJSONStringMethodResult_Success_DEFAULT *ExampleJSONString 11948 11949 func (p *ExampleServiceJSONStringMethodResult) GetSuccess() (v *ExampleJSONString) { 11950 if !p.IsSetSuccess() { 11951 return ExampleServiceJSONStringMethodResult_Success_DEFAULT 11952 } 11953 return p.Success 11954 } 11955 func (p *ExampleServiceJSONStringMethodResult) SetSuccess(x interface{}) { 11956 p.Success = x.(*ExampleJSONString) 11957 } 11958 11959 var fieldIDToName_ExampleServiceJSONStringMethodResult = map[int16]string{ 11960 0: "success", 11961 } 11962 11963 func (p *ExampleServiceJSONStringMethodResult) IsSetSuccess() bool { 11964 return p.Success != nil 11965 } 11966 11967 func (p *ExampleServiceJSONStringMethodResult) Read(iprot thrift.TProtocol) (err error) { 11968 11969 var fieldTypeId thrift.TType 11970 var fieldId int16 11971 11972 if _, err = iprot.ReadStructBegin(); err != nil { 11973 goto ReadStructBeginError 11974 } 11975 11976 for { 11977 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 11978 if err != nil { 11979 goto ReadFieldBeginError 11980 } 11981 if fieldTypeId == thrift.STOP { 11982 break 11983 } 11984 11985 switch fieldId { 11986 case 0: 11987 if fieldTypeId == thrift.STRUCT { 11988 if err = p.ReadField0(iprot); err != nil { 11989 goto ReadFieldError 11990 } 11991 } else { 11992 if err = iprot.Skip(fieldTypeId); err != nil { 11993 goto SkipFieldError 11994 } 11995 } 11996 default: 11997 if err = iprot.Skip(fieldTypeId); err != nil { 11998 goto SkipFieldError 11999 } 12000 } 12001 12002 if err = iprot.ReadFieldEnd(); err != nil { 12003 goto ReadFieldEndError 12004 } 12005 } 12006 if err = iprot.ReadStructEnd(); err != nil { 12007 goto ReadStructEndError 12008 } 12009 12010 return nil 12011 ReadStructBeginError: 12012 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 12013 ReadFieldBeginError: 12014 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 12015 ReadFieldError: 12016 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceJSONStringMethodResult[fieldId]), err) 12017 SkipFieldError: 12018 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 12019 12020 ReadFieldEndError: 12021 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 12022 ReadStructEndError: 12023 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 12024 } 12025 12026 func (p *ExampleServiceJSONStringMethodResult) ReadField0(iprot thrift.TProtocol) error { 12027 p.Success = NewExampleJSONString() 12028 if err := p.Success.Read(iprot); err != nil { 12029 return err 12030 } 12031 return nil 12032 } 12033 12034 func (p *ExampleServiceJSONStringMethodResult) Write(oprot thrift.TProtocol) (err error) { 12035 var fieldId int16 12036 if err = oprot.WriteStructBegin("JSONStringMethod_result"); err != nil { 12037 goto WriteStructBeginError 12038 } 12039 if p != nil { 12040 if err = p.writeField0(oprot); err != nil { 12041 fieldId = 0 12042 goto WriteFieldError 12043 } 12044 12045 } 12046 if err = oprot.WriteFieldStop(); err != nil { 12047 goto WriteFieldStopError 12048 } 12049 if err = oprot.WriteStructEnd(); err != nil { 12050 goto WriteStructEndError 12051 } 12052 return nil 12053 WriteStructBeginError: 12054 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 12055 WriteFieldError: 12056 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 12057 WriteFieldStopError: 12058 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 12059 WriteStructEndError: 12060 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 12061 } 12062 12063 func (p *ExampleServiceJSONStringMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 12064 if p.IsSetSuccess() { 12065 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 12066 goto WriteFieldBeginError 12067 } 12068 if err := p.Success.Write(oprot); err != nil { 12069 return err 12070 } 12071 if err = oprot.WriteFieldEnd(); err != nil { 12072 goto WriteFieldEndError 12073 } 12074 } 12075 return nil 12076 WriteFieldBeginError: 12077 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 12078 WriteFieldEndError: 12079 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 12080 } 12081 12082 func (p *ExampleServiceJSONStringMethodResult) String() string { 12083 if p == nil { 12084 return "<nil>" 12085 } 12086 return fmt.Sprintf("ExampleServiceJSONStringMethodResult(%+v)", *p) 12087 } 12088 12089 func (p *ExampleServiceJSONStringMethodResult) DeepEqual(ano *ExampleServiceJSONStringMethodResult) bool { 12090 if p == ano { 12091 return true 12092 } else if p == nil || ano == nil { 12093 return false 12094 } 12095 if !p.Field0DeepEqual(ano.Success) { 12096 return false 12097 } 12098 return true 12099 } 12100 12101 func (p *ExampleServiceJSONStringMethodResult) Field0DeepEqual(src *ExampleJSONString) bool { 12102 12103 if !p.Success.DeepEqual(src) { 12104 return false 12105 } 12106 return true 12107 } 12108 12109 type ExampleServicePartialMethodArgs struct { 12110 Req *ExamplePartial2 `thrift:"req,1" json:"req"` 12111 } 12112 12113 func NewExampleServicePartialMethodArgs() *ExampleServicePartialMethodArgs { 12114 return &ExampleServicePartialMethodArgs{} 12115 } 12116 12117 var ExampleServicePartialMethodArgs_Req_DEFAULT *ExamplePartial2 12118 12119 func (p *ExampleServicePartialMethodArgs) GetReq() (v *ExamplePartial2) { 12120 if !p.IsSetReq() { 12121 return ExampleServicePartialMethodArgs_Req_DEFAULT 12122 } 12123 return p.Req 12124 } 12125 func (p *ExampleServicePartialMethodArgs) SetReq(val *ExamplePartial2) { 12126 p.Req = val 12127 } 12128 12129 var fieldIDToName_ExampleServicePartialMethodArgs = map[int16]string{ 12130 1: "req", 12131 } 12132 12133 func (p *ExampleServicePartialMethodArgs) IsSetReq() bool { 12134 return p.Req != nil 12135 } 12136 12137 func (p *ExampleServicePartialMethodArgs) Read(iprot thrift.TProtocol) (err error) { 12138 12139 var fieldTypeId thrift.TType 12140 var fieldId int16 12141 12142 if _, err = iprot.ReadStructBegin(); err != nil { 12143 goto ReadStructBeginError 12144 } 12145 12146 for { 12147 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 12148 if err != nil { 12149 goto ReadFieldBeginError 12150 } 12151 if fieldTypeId == thrift.STOP { 12152 break 12153 } 12154 12155 switch fieldId { 12156 case 1: 12157 if fieldTypeId == thrift.STRUCT { 12158 if err = p.ReadField1(iprot); err != nil { 12159 goto ReadFieldError 12160 } 12161 } else { 12162 if err = iprot.Skip(fieldTypeId); err != nil { 12163 goto SkipFieldError 12164 } 12165 } 12166 default: 12167 if err = iprot.Skip(fieldTypeId); err != nil { 12168 goto SkipFieldError 12169 } 12170 } 12171 12172 if err = iprot.ReadFieldEnd(); err != nil { 12173 goto ReadFieldEndError 12174 } 12175 } 12176 if err = iprot.ReadStructEnd(); err != nil { 12177 goto ReadStructEndError 12178 } 12179 12180 return nil 12181 ReadStructBeginError: 12182 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 12183 ReadFieldBeginError: 12184 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 12185 ReadFieldError: 12186 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServicePartialMethodArgs[fieldId]), err) 12187 SkipFieldError: 12188 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 12189 12190 ReadFieldEndError: 12191 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 12192 ReadStructEndError: 12193 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 12194 } 12195 12196 func (p *ExampleServicePartialMethodArgs) ReadField1(iprot thrift.TProtocol) error { 12197 p.Req = NewExamplePartial2() 12198 if err := p.Req.Read(iprot); err != nil { 12199 return err 12200 } 12201 return nil 12202 } 12203 12204 func (p *ExampleServicePartialMethodArgs) Write(oprot thrift.TProtocol) (err error) { 12205 var fieldId int16 12206 if err = oprot.WriteStructBegin("PartialMethod_args"); err != nil { 12207 goto WriteStructBeginError 12208 } 12209 if p != nil { 12210 if err = p.writeField1(oprot); err != nil { 12211 fieldId = 1 12212 goto WriteFieldError 12213 } 12214 12215 } 12216 if err = oprot.WriteFieldStop(); err != nil { 12217 goto WriteFieldStopError 12218 } 12219 if err = oprot.WriteStructEnd(); err != nil { 12220 goto WriteStructEndError 12221 } 12222 return nil 12223 WriteStructBeginError: 12224 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 12225 WriteFieldError: 12226 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 12227 WriteFieldStopError: 12228 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 12229 WriteStructEndError: 12230 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 12231 } 12232 12233 func (p *ExampleServicePartialMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 12234 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 12235 goto WriteFieldBeginError 12236 } 12237 if err := p.Req.Write(oprot); err != nil { 12238 return err 12239 } 12240 if err = oprot.WriteFieldEnd(); err != nil { 12241 goto WriteFieldEndError 12242 } 12243 return nil 12244 WriteFieldBeginError: 12245 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 12246 WriteFieldEndError: 12247 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 12248 } 12249 12250 func (p *ExampleServicePartialMethodArgs) String() string { 12251 if p == nil { 12252 return "<nil>" 12253 } 12254 return fmt.Sprintf("ExampleServicePartialMethodArgs(%+v)", *p) 12255 } 12256 12257 func (p *ExampleServicePartialMethodArgs) DeepEqual(ano *ExampleServicePartialMethodArgs) bool { 12258 if p == ano { 12259 return true 12260 } else if p == nil || ano == nil { 12261 return false 12262 } 12263 if !p.Field1DeepEqual(ano.Req) { 12264 return false 12265 } 12266 return true 12267 } 12268 12269 func (p *ExampleServicePartialMethodArgs) Field1DeepEqual(src *ExamplePartial2) bool { 12270 12271 if !p.Req.DeepEqual(src) { 12272 return false 12273 } 12274 return true 12275 } 12276 12277 type ExampleServicePartialMethodResult struct { 12278 Success *ExamplePartial `thrift:"success,0" json:"success,omitempty"` 12279 } 12280 12281 func NewExampleServicePartialMethodResult() *ExampleServicePartialMethodResult { 12282 return &ExampleServicePartialMethodResult{} 12283 } 12284 12285 var ExampleServicePartialMethodResult_Success_DEFAULT *ExamplePartial 12286 12287 func (p *ExampleServicePartialMethodResult) GetSuccess() (v *ExamplePartial) { 12288 if !p.IsSetSuccess() { 12289 return ExampleServicePartialMethodResult_Success_DEFAULT 12290 } 12291 return p.Success 12292 } 12293 func (p *ExampleServicePartialMethodResult) SetSuccess(x interface{}) { 12294 p.Success = x.(*ExamplePartial) 12295 } 12296 12297 var fieldIDToName_ExampleServicePartialMethodResult = map[int16]string{ 12298 0: "success", 12299 } 12300 12301 func (p *ExampleServicePartialMethodResult) IsSetSuccess() bool { 12302 return p.Success != nil 12303 } 12304 12305 func (p *ExampleServicePartialMethodResult) Read(iprot thrift.TProtocol) (err error) { 12306 12307 var fieldTypeId thrift.TType 12308 var fieldId int16 12309 12310 if _, err = iprot.ReadStructBegin(); err != nil { 12311 goto ReadStructBeginError 12312 } 12313 12314 for { 12315 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 12316 if err != nil { 12317 goto ReadFieldBeginError 12318 } 12319 if fieldTypeId == thrift.STOP { 12320 break 12321 } 12322 12323 switch fieldId { 12324 case 0: 12325 if fieldTypeId == thrift.STRUCT { 12326 if err = p.ReadField0(iprot); err != nil { 12327 goto ReadFieldError 12328 } 12329 } else { 12330 if err = iprot.Skip(fieldTypeId); err != nil { 12331 goto SkipFieldError 12332 } 12333 } 12334 default: 12335 if err = iprot.Skip(fieldTypeId); err != nil { 12336 goto SkipFieldError 12337 } 12338 } 12339 12340 if err = iprot.ReadFieldEnd(); err != nil { 12341 goto ReadFieldEndError 12342 } 12343 } 12344 if err = iprot.ReadStructEnd(); err != nil { 12345 goto ReadStructEndError 12346 } 12347 12348 return nil 12349 ReadStructBeginError: 12350 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 12351 ReadFieldBeginError: 12352 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 12353 ReadFieldError: 12354 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServicePartialMethodResult[fieldId]), err) 12355 SkipFieldError: 12356 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 12357 12358 ReadFieldEndError: 12359 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 12360 ReadStructEndError: 12361 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 12362 } 12363 12364 func (p *ExampleServicePartialMethodResult) ReadField0(iprot thrift.TProtocol) error { 12365 p.Success = NewExamplePartial() 12366 if err := p.Success.Read(iprot); err != nil { 12367 return err 12368 } 12369 return nil 12370 } 12371 12372 func (p *ExampleServicePartialMethodResult) Write(oprot thrift.TProtocol) (err error) { 12373 var fieldId int16 12374 if err = oprot.WriteStructBegin("PartialMethod_result"); err != nil { 12375 goto WriteStructBeginError 12376 } 12377 if p != nil { 12378 if err = p.writeField0(oprot); err != nil { 12379 fieldId = 0 12380 goto WriteFieldError 12381 } 12382 12383 } 12384 if err = oprot.WriteFieldStop(); err != nil { 12385 goto WriteFieldStopError 12386 } 12387 if err = oprot.WriteStructEnd(); err != nil { 12388 goto WriteStructEndError 12389 } 12390 return nil 12391 WriteStructBeginError: 12392 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 12393 WriteFieldError: 12394 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 12395 WriteFieldStopError: 12396 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 12397 WriteStructEndError: 12398 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 12399 } 12400 12401 func (p *ExampleServicePartialMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 12402 if p.IsSetSuccess() { 12403 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 12404 goto WriteFieldBeginError 12405 } 12406 if err := p.Success.Write(oprot); err != nil { 12407 return err 12408 } 12409 if err = oprot.WriteFieldEnd(); err != nil { 12410 goto WriteFieldEndError 12411 } 12412 } 12413 return nil 12414 WriteFieldBeginError: 12415 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 12416 WriteFieldEndError: 12417 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 12418 } 12419 12420 func (p *ExampleServicePartialMethodResult) String() string { 12421 if p == nil { 12422 return "<nil>" 12423 } 12424 return fmt.Sprintf("ExampleServicePartialMethodResult(%+v)", *p) 12425 } 12426 12427 func (p *ExampleServicePartialMethodResult) DeepEqual(ano *ExampleServicePartialMethodResult) bool { 12428 if p == ano { 12429 return true 12430 } else if p == nil || ano == nil { 12431 return false 12432 } 12433 if !p.Field0DeepEqual(ano.Success) { 12434 return false 12435 } 12436 return true 12437 } 12438 12439 func (p *ExampleServicePartialMethodResult) Field0DeepEqual(src *ExamplePartial) bool { 12440 12441 if !p.Success.DeepEqual(src) { 12442 return false 12443 } 12444 return true 12445 } 12446 12447 type ExampleServiceFallbackMethodArgs struct { 12448 Req *ExampleFallback `thrift:"req,1" json:"req"` 12449 } 12450 12451 func NewExampleServiceFallbackMethodArgs() *ExampleServiceFallbackMethodArgs { 12452 return &ExampleServiceFallbackMethodArgs{} 12453 } 12454 12455 var ExampleServiceFallbackMethodArgs_Req_DEFAULT *ExampleFallback 12456 12457 func (p *ExampleServiceFallbackMethodArgs) GetReq() (v *ExampleFallback) { 12458 if !p.IsSetReq() { 12459 return ExampleServiceFallbackMethodArgs_Req_DEFAULT 12460 } 12461 return p.Req 12462 } 12463 func (p *ExampleServiceFallbackMethodArgs) SetReq(val *ExampleFallback) { 12464 p.Req = val 12465 } 12466 12467 var fieldIDToName_ExampleServiceFallbackMethodArgs = map[int16]string{ 12468 1: "req", 12469 } 12470 12471 func (p *ExampleServiceFallbackMethodArgs) IsSetReq() bool { 12472 return p.Req != nil 12473 } 12474 12475 func (p *ExampleServiceFallbackMethodArgs) Read(iprot thrift.TProtocol) (err error) { 12476 12477 var fieldTypeId thrift.TType 12478 var fieldId int16 12479 12480 if _, err = iprot.ReadStructBegin(); err != nil { 12481 goto ReadStructBeginError 12482 } 12483 12484 for { 12485 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 12486 if err != nil { 12487 goto ReadFieldBeginError 12488 } 12489 if fieldTypeId == thrift.STOP { 12490 break 12491 } 12492 12493 switch fieldId { 12494 case 1: 12495 if fieldTypeId == thrift.STRUCT { 12496 if err = p.ReadField1(iprot); err != nil { 12497 goto ReadFieldError 12498 } 12499 } else { 12500 if err = iprot.Skip(fieldTypeId); err != nil { 12501 goto SkipFieldError 12502 } 12503 } 12504 default: 12505 if err = iprot.Skip(fieldTypeId); err != nil { 12506 goto SkipFieldError 12507 } 12508 } 12509 12510 if err = iprot.ReadFieldEnd(); err != nil { 12511 goto ReadFieldEndError 12512 } 12513 } 12514 if err = iprot.ReadStructEnd(); err != nil { 12515 goto ReadStructEndError 12516 } 12517 12518 return nil 12519 ReadStructBeginError: 12520 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 12521 ReadFieldBeginError: 12522 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 12523 ReadFieldError: 12524 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceFallbackMethodArgs[fieldId]), err) 12525 SkipFieldError: 12526 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 12527 12528 ReadFieldEndError: 12529 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 12530 ReadStructEndError: 12531 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 12532 } 12533 12534 func (p *ExampleServiceFallbackMethodArgs) ReadField1(iprot thrift.TProtocol) error { 12535 p.Req = NewExampleFallback() 12536 if err := p.Req.Read(iprot); err != nil { 12537 return err 12538 } 12539 return nil 12540 } 12541 12542 func (p *ExampleServiceFallbackMethodArgs) Write(oprot thrift.TProtocol) (err error) { 12543 var fieldId int16 12544 if err = oprot.WriteStructBegin("FallbackMethod_args"); err != nil { 12545 goto WriteStructBeginError 12546 } 12547 if p != nil { 12548 if err = p.writeField1(oprot); err != nil { 12549 fieldId = 1 12550 goto WriteFieldError 12551 } 12552 12553 } 12554 if err = oprot.WriteFieldStop(); err != nil { 12555 goto WriteFieldStopError 12556 } 12557 if err = oprot.WriteStructEnd(); err != nil { 12558 goto WriteStructEndError 12559 } 12560 return nil 12561 WriteStructBeginError: 12562 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 12563 WriteFieldError: 12564 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 12565 WriteFieldStopError: 12566 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 12567 WriteStructEndError: 12568 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 12569 } 12570 12571 func (p *ExampleServiceFallbackMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 12572 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 12573 goto WriteFieldBeginError 12574 } 12575 if err := p.Req.Write(oprot); err != nil { 12576 return err 12577 } 12578 if err = oprot.WriteFieldEnd(); err != nil { 12579 goto WriteFieldEndError 12580 } 12581 return nil 12582 WriteFieldBeginError: 12583 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 12584 WriteFieldEndError: 12585 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 12586 } 12587 12588 func (p *ExampleServiceFallbackMethodArgs) String() string { 12589 if p == nil { 12590 return "<nil>" 12591 } 12592 return fmt.Sprintf("ExampleServiceFallbackMethodArgs(%+v)", *p) 12593 } 12594 12595 func (p *ExampleServiceFallbackMethodArgs) DeepEqual(ano *ExampleServiceFallbackMethodArgs) bool { 12596 if p == ano { 12597 return true 12598 } else if p == nil || ano == nil { 12599 return false 12600 } 12601 if !p.Field1DeepEqual(ano.Req) { 12602 return false 12603 } 12604 return true 12605 } 12606 12607 func (p *ExampleServiceFallbackMethodArgs) Field1DeepEqual(src *ExampleFallback) bool { 12608 12609 if !p.Req.DeepEqual(src) { 12610 return false 12611 } 12612 return true 12613 } 12614 12615 type ExampleServiceFallbackMethodResult struct { 12616 Success *ExampleFallback `thrift:"success,0" json:"success,omitempty"` 12617 } 12618 12619 func NewExampleServiceFallbackMethodResult() *ExampleServiceFallbackMethodResult { 12620 return &ExampleServiceFallbackMethodResult{} 12621 } 12622 12623 var ExampleServiceFallbackMethodResult_Success_DEFAULT *ExampleFallback 12624 12625 func (p *ExampleServiceFallbackMethodResult) GetSuccess() (v *ExampleFallback) { 12626 if !p.IsSetSuccess() { 12627 return ExampleServiceFallbackMethodResult_Success_DEFAULT 12628 } 12629 return p.Success 12630 } 12631 func (p *ExampleServiceFallbackMethodResult) SetSuccess(x interface{}) { 12632 p.Success = x.(*ExampleFallback) 12633 } 12634 12635 var fieldIDToName_ExampleServiceFallbackMethodResult = map[int16]string{ 12636 0: "success", 12637 } 12638 12639 func (p *ExampleServiceFallbackMethodResult) IsSetSuccess() bool { 12640 return p.Success != nil 12641 } 12642 12643 func (p *ExampleServiceFallbackMethodResult) Read(iprot thrift.TProtocol) (err error) { 12644 12645 var fieldTypeId thrift.TType 12646 var fieldId int16 12647 12648 if _, err = iprot.ReadStructBegin(); err != nil { 12649 goto ReadStructBeginError 12650 } 12651 12652 for { 12653 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 12654 if err != nil { 12655 goto ReadFieldBeginError 12656 } 12657 if fieldTypeId == thrift.STOP { 12658 break 12659 } 12660 12661 switch fieldId { 12662 case 0: 12663 if fieldTypeId == thrift.STRUCT { 12664 if err = p.ReadField0(iprot); err != nil { 12665 goto ReadFieldError 12666 } 12667 } else { 12668 if err = iprot.Skip(fieldTypeId); err != nil { 12669 goto SkipFieldError 12670 } 12671 } 12672 default: 12673 if err = iprot.Skip(fieldTypeId); err != nil { 12674 goto SkipFieldError 12675 } 12676 } 12677 12678 if err = iprot.ReadFieldEnd(); err != nil { 12679 goto ReadFieldEndError 12680 } 12681 } 12682 if err = iprot.ReadStructEnd(); err != nil { 12683 goto ReadStructEndError 12684 } 12685 12686 return nil 12687 ReadStructBeginError: 12688 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 12689 ReadFieldBeginError: 12690 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 12691 ReadFieldError: 12692 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceFallbackMethodResult[fieldId]), err) 12693 SkipFieldError: 12694 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 12695 12696 ReadFieldEndError: 12697 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 12698 ReadStructEndError: 12699 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 12700 } 12701 12702 func (p *ExampleServiceFallbackMethodResult) ReadField0(iprot thrift.TProtocol) error { 12703 p.Success = NewExampleFallback() 12704 if err := p.Success.Read(iprot); err != nil { 12705 return err 12706 } 12707 return nil 12708 } 12709 12710 func (p *ExampleServiceFallbackMethodResult) Write(oprot thrift.TProtocol) (err error) { 12711 var fieldId int16 12712 if err = oprot.WriteStructBegin("FallbackMethod_result"); err != nil { 12713 goto WriteStructBeginError 12714 } 12715 if p != nil { 12716 if err = p.writeField0(oprot); err != nil { 12717 fieldId = 0 12718 goto WriteFieldError 12719 } 12720 12721 } 12722 if err = oprot.WriteFieldStop(); err != nil { 12723 goto WriteFieldStopError 12724 } 12725 if err = oprot.WriteStructEnd(); err != nil { 12726 goto WriteStructEndError 12727 } 12728 return nil 12729 WriteStructBeginError: 12730 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 12731 WriteFieldError: 12732 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 12733 WriteFieldStopError: 12734 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 12735 WriteStructEndError: 12736 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 12737 } 12738 12739 func (p *ExampleServiceFallbackMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 12740 if p.IsSetSuccess() { 12741 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 12742 goto WriteFieldBeginError 12743 } 12744 if err := p.Success.Write(oprot); err != nil { 12745 return err 12746 } 12747 if err = oprot.WriteFieldEnd(); err != nil { 12748 goto WriteFieldEndError 12749 } 12750 } 12751 return nil 12752 WriteFieldBeginError: 12753 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 12754 WriteFieldEndError: 12755 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 12756 } 12757 12758 func (p *ExampleServiceFallbackMethodResult) String() string { 12759 if p == nil { 12760 return "<nil>" 12761 } 12762 return fmt.Sprintf("ExampleServiceFallbackMethodResult(%+v)", *p) 12763 } 12764 12765 func (p *ExampleServiceFallbackMethodResult) DeepEqual(ano *ExampleServiceFallbackMethodResult) bool { 12766 if p == ano { 12767 return true 12768 } else if p == nil || ano == nil { 12769 return false 12770 } 12771 if !p.Field0DeepEqual(ano.Success) { 12772 return false 12773 } 12774 return true 12775 } 12776 12777 func (p *ExampleServiceFallbackMethodResult) Field0DeepEqual(src *ExampleFallback) bool { 12778 12779 if !p.Success.DeepEqual(src) { 12780 return false 12781 } 12782 return true 12783 } 12784 12785 type ExampleServiceApiBodyMethodArgs struct { 12786 Req *ExampleApiBody `thrift:"req,1" json:"req"` 12787 } 12788 12789 func NewExampleServiceApiBodyMethodArgs() *ExampleServiceApiBodyMethodArgs { 12790 return &ExampleServiceApiBodyMethodArgs{} 12791 } 12792 12793 var ExampleServiceApiBodyMethodArgs_Req_DEFAULT *ExampleApiBody 12794 12795 func (p *ExampleServiceApiBodyMethodArgs) GetReq() (v *ExampleApiBody) { 12796 if !p.IsSetReq() { 12797 return ExampleServiceApiBodyMethodArgs_Req_DEFAULT 12798 } 12799 return p.Req 12800 } 12801 func (p *ExampleServiceApiBodyMethodArgs) SetReq(val *ExampleApiBody) { 12802 p.Req = val 12803 } 12804 12805 var fieldIDToName_ExampleServiceApiBodyMethodArgs = map[int16]string{ 12806 1: "req", 12807 } 12808 12809 func (p *ExampleServiceApiBodyMethodArgs) IsSetReq() bool { 12810 return p.Req != nil 12811 } 12812 12813 func (p *ExampleServiceApiBodyMethodArgs) Read(iprot thrift.TProtocol) (err error) { 12814 12815 var fieldTypeId thrift.TType 12816 var fieldId int16 12817 12818 if _, err = iprot.ReadStructBegin(); err != nil { 12819 goto ReadStructBeginError 12820 } 12821 12822 for { 12823 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 12824 if err != nil { 12825 goto ReadFieldBeginError 12826 } 12827 if fieldTypeId == thrift.STOP { 12828 break 12829 } 12830 12831 switch fieldId { 12832 case 1: 12833 if fieldTypeId == thrift.STRUCT { 12834 if err = p.ReadField1(iprot); err != nil { 12835 goto ReadFieldError 12836 } 12837 } else { 12838 if err = iprot.Skip(fieldTypeId); err != nil { 12839 goto SkipFieldError 12840 } 12841 } 12842 default: 12843 if err = iprot.Skip(fieldTypeId); err != nil { 12844 goto SkipFieldError 12845 } 12846 } 12847 12848 if err = iprot.ReadFieldEnd(); err != nil { 12849 goto ReadFieldEndError 12850 } 12851 } 12852 if err = iprot.ReadStructEnd(); err != nil { 12853 goto ReadStructEndError 12854 } 12855 12856 return nil 12857 ReadStructBeginError: 12858 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 12859 ReadFieldBeginError: 12860 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 12861 ReadFieldError: 12862 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceApiBodyMethodArgs[fieldId]), err) 12863 SkipFieldError: 12864 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 12865 12866 ReadFieldEndError: 12867 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 12868 ReadStructEndError: 12869 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 12870 } 12871 12872 func (p *ExampleServiceApiBodyMethodArgs) ReadField1(iprot thrift.TProtocol) error { 12873 p.Req = NewExampleApiBody() 12874 if err := p.Req.Read(iprot); err != nil { 12875 return err 12876 } 12877 return nil 12878 } 12879 12880 func (p *ExampleServiceApiBodyMethodArgs) Write(oprot thrift.TProtocol) (err error) { 12881 var fieldId int16 12882 if err = oprot.WriteStructBegin("ApiBodyMethod_args"); err != nil { 12883 goto WriteStructBeginError 12884 } 12885 if p != nil { 12886 if err = p.writeField1(oprot); err != nil { 12887 fieldId = 1 12888 goto WriteFieldError 12889 } 12890 12891 } 12892 if err = oprot.WriteFieldStop(); err != nil { 12893 goto WriteFieldStopError 12894 } 12895 if err = oprot.WriteStructEnd(); err != nil { 12896 goto WriteStructEndError 12897 } 12898 return nil 12899 WriteStructBeginError: 12900 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 12901 WriteFieldError: 12902 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 12903 WriteFieldStopError: 12904 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 12905 WriteStructEndError: 12906 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 12907 } 12908 12909 func (p *ExampleServiceApiBodyMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 12910 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 12911 goto WriteFieldBeginError 12912 } 12913 if err := p.Req.Write(oprot); err != nil { 12914 return err 12915 } 12916 if err = oprot.WriteFieldEnd(); err != nil { 12917 goto WriteFieldEndError 12918 } 12919 return nil 12920 WriteFieldBeginError: 12921 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 12922 WriteFieldEndError: 12923 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 12924 } 12925 12926 func (p *ExampleServiceApiBodyMethodArgs) String() string { 12927 if p == nil { 12928 return "<nil>" 12929 } 12930 return fmt.Sprintf("ExampleServiceApiBodyMethodArgs(%+v)", *p) 12931 } 12932 12933 func (p *ExampleServiceApiBodyMethodArgs) DeepEqual(ano *ExampleServiceApiBodyMethodArgs) bool { 12934 if p == ano { 12935 return true 12936 } else if p == nil || ano == nil { 12937 return false 12938 } 12939 if !p.Field1DeepEqual(ano.Req) { 12940 return false 12941 } 12942 return true 12943 } 12944 12945 func (p *ExampleServiceApiBodyMethodArgs) Field1DeepEqual(src *ExampleApiBody) bool { 12946 12947 if !p.Req.DeepEqual(src) { 12948 return false 12949 } 12950 return true 12951 } 12952 12953 type ExampleServiceApiBodyMethodResult struct { 12954 Success *ExampleApiBody `thrift:"success,0" json:"success,omitempty"` 12955 } 12956 12957 func NewExampleServiceApiBodyMethodResult() *ExampleServiceApiBodyMethodResult { 12958 return &ExampleServiceApiBodyMethodResult{} 12959 } 12960 12961 var ExampleServiceApiBodyMethodResult_Success_DEFAULT *ExampleApiBody 12962 12963 func (p *ExampleServiceApiBodyMethodResult) GetSuccess() (v *ExampleApiBody) { 12964 if !p.IsSetSuccess() { 12965 return ExampleServiceApiBodyMethodResult_Success_DEFAULT 12966 } 12967 return p.Success 12968 } 12969 func (p *ExampleServiceApiBodyMethodResult) SetSuccess(x interface{}) { 12970 p.Success = x.(*ExampleApiBody) 12971 } 12972 12973 var fieldIDToName_ExampleServiceApiBodyMethodResult = map[int16]string{ 12974 0: "success", 12975 } 12976 12977 func (p *ExampleServiceApiBodyMethodResult) IsSetSuccess() bool { 12978 return p.Success != nil 12979 } 12980 12981 func (p *ExampleServiceApiBodyMethodResult) Read(iprot thrift.TProtocol) (err error) { 12982 12983 var fieldTypeId thrift.TType 12984 var fieldId int16 12985 12986 if _, err = iprot.ReadStructBegin(); err != nil { 12987 goto ReadStructBeginError 12988 } 12989 12990 for { 12991 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 12992 if err != nil { 12993 goto ReadFieldBeginError 12994 } 12995 if fieldTypeId == thrift.STOP { 12996 break 12997 } 12998 12999 switch fieldId { 13000 case 0: 13001 if fieldTypeId == thrift.STRUCT { 13002 if err = p.ReadField0(iprot); err != nil { 13003 goto ReadFieldError 13004 } 13005 } else { 13006 if err = iprot.Skip(fieldTypeId); err != nil { 13007 goto SkipFieldError 13008 } 13009 } 13010 default: 13011 if err = iprot.Skip(fieldTypeId); err != nil { 13012 goto SkipFieldError 13013 } 13014 } 13015 13016 if err = iprot.ReadFieldEnd(); err != nil { 13017 goto ReadFieldEndError 13018 } 13019 } 13020 if err = iprot.ReadStructEnd(); err != nil { 13021 goto ReadStructEndError 13022 } 13023 13024 return nil 13025 ReadStructBeginError: 13026 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 13027 ReadFieldBeginError: 13028 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 13029 ReadFieldError: 13030 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceApiBodyMethodResult[fieldId]), err) 13031 SkipFieldError: 13032 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 13033 13034 ReadFieldEndError: 13035 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 13036 ReadStructEndError: 13037 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 13038 } 13039 13040 func (p *ExampleServiceApiBodyMethodResult) ReadField0(iprot thrift.TProtocol) error { 13041 p.Success = NewExampleApiBody() 13042 if err := p.Success.Read(iprot); err != nil { 13043 return err 13044 } 13045 return nil 13046 } 13047 13048 func (p *ExampleServiceApiBodyMethodResult) Write(oprot thrift.TProtocol) (err error) { 13049 var fieldId int16 13050 if err = oprot.WriteStructBegin("ApiBodyMethod_result"); err != nil { 13051 goto WriteStructBeginError 13052 } 13053 if p != nil { 13054 if err = p.writeField0(oprot); err != nil { 13055 fieldId = 0 13056 goto WriteFieldError 13057 } 13058 13059 } 13060 if err = oprot.WriteFieldStop(); err != nil { 13061 goto WriteFieldStopError 13062 } 13063 if err = oprot.WriteStructEnd(); err != nil { 13064 goto WriteStructEndError 13065 } 13066 return nil 13067 WriteStructBeginError: 13068 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 13069 WriteFieldError: 13070 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 13071 WriteFieldStopError: 13072 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 13073 WriteStructEndError: 13074 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 13075 } 13076 13077 func (p *ExampleServiceApiBodyMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 13078 if p.IsSetSuccess() { 13079 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 13080 goto WriteFieldBeginError 13081 } 13082 if err := p.Success.Write(oprot); err != nil { 13083 return err 13084 } 13085 if err = oprot.WriteFieldEnd(); err != nil { 13086 goto WriteFieldEndError 13087 } 13088 } 13089 return nil 13090 WriteFieldBeginError: 13091 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 13092 WriteFieldEndError: 13093 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 13094 } 13095 13096 func (p *ExampleServiceApiBodyMethodResult) String() string { 13097 if p == nil { 13098 return "<nil>" 13099 } 13100 return fmt.Sprintf("ExampleServiceApiBodyMethodResult(%+v)", *p) 13101 } 13102 13103 func (p *ExampleServiceApiBodyMethodResult) DeepEqual(ano *ExampleServiceApiBodyMethodResult) bool { 13104 if p == ano { 13105 return true 13106 } else if p == nil || ano == nil { 13107 return false 13108 } 13109 if !p.Field0DeepEqual(ano.Success) { 13110 return false 13111 } 13112 return true 13113 } 13114 13115 func (p *ExampleServiceApiBodyMethodResult) Field0DeepEqual(src *ExampleApiBody) bool { 13116 13117 if !p.Success.DeepEqual(src) { 13118 return false 13119 } 13120 return true 13121 } 13122 13123 type ExampleServicePostFormMethodArgs struct { 13124 Req *ExamplePostForm `thrift:"req,1" json:"req"` 13125 } 13126 13127 func NewExampleServicePostFormMethodArgs() *ExampleServicePostFormMethodArgs { 13128 return &ExampleServicePostFormMethodArgs{} 13129 } 13130 13131 var ExampleServicePostFormMethodArgs_Req_DEFAULT *ExamplePostForm 13132 13133 func (p *ExampleServicePostFormMethodArgs) GetReq() (v *ExamplePostForm) { 13134 if !p.IsSetReq() { 13135 return ExampleServicePostFormMethodArgs_Req_DEFAULT 13136 } 13137 return p.Req 13138 } 13139 func (p *ExampleServicePostFormMethodArgs) SetReq(val *ExamplePostForm) { 13140 p.Req = val 13141 } 13142 13143 var fieldIDToName_ExampleServicePostFormMethodArgs = map[int16]string{ 13144 1: "req", 13145 } 13146 13147 func (p *ExampleServicePostFormMethodArgs) IsSetReq() bool { 13148 return p.Req != nil 13149 } 13150 13151 func (p *ExampleServicePostFormMethodArgs) Read(iprot thrift.TProtocol) (err error) { 13152 13153 var fieldTypeId thrift.TType 13154 var fieldId int16 13155 13156 if _, err = iprot.ReadStructBegin(); err != nil { 13157 goto ReadStructBeginError 13158 } 13159 13160 for { 13161 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 13162 if err != nil { 13163 goto ReadFieldBeginError 13164 } 13165 if fieldTypeId == thrift.STOP { 13166 break 13167 } 13168 13169 switch fieldId { 13170 case 1: 13171 if fieldTypeId == thrift.STRUCT { 13172 if err = p.ReadField1(iprot); err != nil { 13173 goto ReadFieldError 13174 } 13175 } else { 13176 if err = iprot.Skip(fieldTypeId); err != nil { 13177 goto SkipFieldError 13178 } 13179 } 13180 default: 13181 if err = iprot.Skip(fieldTypeId); err != nil { 13182 goto SkipFieldError 13183 } 13184 } 13185 13186 if err = iprot.ReadFieldEnd(); err != nil { 13187 goto ReadFieldEndError 13188 } 13189 } 13190 if err = iprot.ReadStructEnd(); err != nil { 13191 goto ReadStructEndError 13192 } 13193 13194 return nil 13195 ReadStructBeginError: 13196 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 13197 ReadFieldBeginError: 13198 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 13199 ReadFieldError: 13200 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServicePostFormMethodArgs[fieldId]), err) 13201 SkipFieldError: 13202 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 13203 13204 ReadFieldEndError: 13205 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 13206 ReadStructEndError: 13207 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 13208 } 13209 13210 func (p *ExampleServicePostFormMethodArgs) ReadField1(iprot thrift.TProtocol) error { 13211 p.Req = NewExamplePostForm() 13212 if err := p.Req.Read(iprot); err != nil { 13213 return err 13214 } 13215 return nil 13216 } 13217 13218 func (p *ExampleServicePostFormMethodArgs) Write(oprot thrift.TProtocol) (err error) { 13219 var fieldId int16 13220 if err = oprot.WriteStructBegin("PostFormMethod_args"); err != nil { 13221 goto WriteStructBeginError 13222 } 13223 if p != nil { 13224 if err = p.writeField1(oprot); err != nil { 13225 fieldId = 1 13226 goto WriteFieldError 13227 } 13228 13229 } 13230 if err = oprot.WriteFieldStop(); err != nil { 13231 goto WriteFieldStopError 13232 } 13233 if err = oprot.WriteStructEnd(); err != nil { 13234 goto WriteStructEndError 13235 } 13236 return nil 13237 WriteStructBeginError: 13238 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 13239 WriteFieldError: 13240 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 13241 WriteFieldStopError: 13242 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 13243 WriteStructEndError: 13244 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 13245 } 13246 13247 func (p *ExampleServicePostFormMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 13248 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 13249 goto WriteFieldBeginError 13250 } 13251 if err := p.Req.Write(oprot); err != nil { 13252 return err 13253 } 13254 if err = oprot.WriteFieldEnd(); err != nil { 13255 goto WriteFieldEndError 13256 } 13257 return nil 13258 WriteFieldBeginError: 13259 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 13260 WriteFieldEndError: 13261 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 13262 } 13263 13264 func (p *ExampleServicePostFormMethodArgs) String() string { 13265 if p == nil { 13266 return "<nil>" 13267 } 13268 return fmt.Sprintf("ExampleServicePostFormMethodArgs(%+v)", *p) 13269 } 13270 13271 func (p *ExampleServicePostFormMethodArgs) DeepEqual(ano *ExampleServicePostFormMethodArgs) bool { 13272 if p == ano { 13273 return true 13274 } else if p == nil || ano == nil { 13275 return false 13276 } 13277 if !p.Field1DeepEqual(ano.Req) { 13278 return false 13279 } 13280 return true 13281 } 13282 13283 func (p *ExampleServicePostFormMethodArgs) Field1DeepEqual(src *ExamplePostForm) bool { 13284 13285 if !p.Req.DeepEqual(src) { 13286 return false 13287 } 13288 return true 13289 } 13290 13291 type ExampleServicePostFormMethodResult struct { 13292 Success *ExamplePostForm `thrift:"success,0" json:"success,omitempty"` 13293 } 13294 13295 func NewExampleServicePostFormMethodResult() *ExampleServicePostFormMethodResult { 13296 return &ExampleServicePostFormMethodResult{} 13297 } 13298 13299 var ExampleServicePostFormMethodResult_Success_DEFAULT *ExamplePostForm 13300 13301 func (p *ExampleServicePostFormMethodResult) GetSuccess() (v *ExamplePostForm) { 13302 if !p.IsSetSuccess() { 13303 return ExampleServicePostFormMethodResult_Success_DEFAULT 13304 } 13305 return p.Success 13306 } 13307 func (p *ExampleServicePostFormMethodResult) SetSuccess(x interface{}) { 13308 p.Success = x.(*ExamplePostForm) 13309 } 13310 13311 var fieldIDToName_ExampleServicePostFormMethodResult = map[int16]string{ 13312 0: "success", 13313 } 13314 13315 func (p *ExampleServicePostFormMethodResult) IsSetSuccess() bool { 13316 return p.Success != nil 13317 } 13318 13319 func (p *ExampleServicePostFormMethodResult) Read(iprot thrift.TProtocol) (err error) { 13320 13321 var fieldTypeId thrift.TType 13322 var fieldId int16 13323 13324 if _, err = iprot.ReadStructBegin(); err != nil { 13325 goto ReadStructBeginError 13326 } 13327 13328 for { 13329 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 13330 if err != nil { 13331 goto ReadFieldBeginError 13332 } 13333 if fieldTypeId == thrift.STOP { 13334 break 13335 } 13336 13337 switch fieldId { 13338 case 0: 13339 if fieldTypeId == thrift.STRUCT { 13340 if err = p.ReadField0(iprot); err != nil { 13341 goto ReadFieldError 13342 } 13343 } else { 13344 if err = iprot.Skip(fieldTypeId); err != nil { 13345 goto SkipFieldError 13346 } 13347 } 13348 default: 13349 if err = iprot.Skip(fieldTypeId); err != nil { 13350 goto SkipFieldError 13351 } 13352 } 13353 13354 if err = iprot.ReadFieldEnd(); err != nil { 13355 goto ReadFieldEndError 13356 } 13357 } 13358 if err = iprot.ReadStructEnd(); err != nil { 13359 goto ReadStructEndError 13360 } 13361 13362 return nil 13363 ReadStructBeginError: 13364 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 13365 ReadFieldBeginError: 13366 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 13367 ReadFieldError: 13368 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServicePostFormMethodResult[fieldId]), err) 13369 SkipFieldError: 13370 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 13371 13372 ReadFieldEndError: 13373 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 13374 ReadStructEndError: 13375 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 13376 } 13377 13378 func (p *ExampleServicePostFormMethodResult) ReadField0(iprot thrift.TProtocol) error { 13379 p.Success = NewExamplePostForm() 13380 if err := p.Success.Read(iprot); err != nil { 13381 return err 13382 } 13383 return nil 13384 } 13385 13386 func (p *ExampleServicePostFormMethodResult) Write(oprot thrift.TProtocol) (err error) { 13387 var fieldId int16 13388 if err = oprot.WriteStructBegin("PostFormMethod_result"); err != nil { 13389 goto WriteStructBeginError 13390 } 13391 if p != nil { 13392 if err = p.writeField0(oprot); err != nil { 13393 fieldId = 0 13394 goto WriteFieldError 13395 } 13396 13397 } 13398 if err = oprot.WriteFieldStop(); err != nil { 13399 goto WriteFieldStopError 13400 } 13401 if err = oprot.WriteStructEnd(); err != nil { 13402 goto WriteStructEndError 13403 } 13404 return nil 13405 WriteStructBeginError: 13406 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 13407 WriteFieldError: 13408 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 13409 WriteFieldStopError: 13410 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 13411 WriteStructEndError: 13412 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 13413 } 13414 13415 func (p *ExampleServicePostFormMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 13416 if p.IsSetSuccess() { 13417 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 13418 goto WriteFieldBeginError 13419 } 13420 if err := p.Success.Write(oprot); err != nil { 13421 return err 13422 } 13423 if err = oprot.WriteFieldEnd(); err != nil { 13424 goto WriteFieldEndError 13425 } 13426 } 13427 return nil 13428 WriteFieldBeginError: 13429 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 13430 WriteFieldEndError: 13431 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 13432 } 13433 13434 func (p *ExampleServicePostFormMethodResult) String() string { 13435 if p == nil { 13436 return "<nil>" 13437 } 13438 return fmt.Sprintf("ExampleServicePostFormMethodResult(%+v)", *p) 13439 } 13440 13441 func (p *ExampleServicePostFormMethodResult) DeepEqual(ano *ExampleServicePostFormMethodResult) bool { 13442 if p == ano { 13443 return true 13444 } else if p == nil || ano == nil { 13445 return false 13446 } 13447 if !p.Field0DeepEqual(ano.Success) { 13448 return false 13449 } 13450 return true 13451 } 13452 13453 func (p *ExampleServicePostFormMethodResult) Field0DeepEqual(src *ExamplePostForm) bool { 13454 13455 if !p.Success.DeepEqual(src) { 13456 return false 13457 } 13458 return true 13459 } 13460 13461 type ExampleServiceDynamicStructMethodArgs struct { 13462 Req *ExampleDynamicStruct `thrift:"req,1" json:"req"` 13463 } 13464 13465 func NewExampleServiceDynamicStructMethodArgs() *ExampleServiceDynamicStructMethodArgs { 13466 return &ExampleServiceDynamicStructMethodArgs{} 13467 } 13468 13469 var ExampleServiceDynamicStructMethodArgs_Req_DEFAULT *ExampleDynamicStruct 13470 13471 func (p *ExampleServiceDynamicStructMethodArgs) GetReq() (v *ExampleDynamicStruct) { 13472 if !p.IsSetReq() { 13473 return ExampleServiceDynamicStructMethodArgs_Req_DEFAULT 13474 } 13475 return p.Req 13476 } 13477 func (p *ExampleServiceDynamicStructMethodArgs) SetReq(val *ExampleDynamicStruct) { 13478 p.Req = val 13479 } 13480 13481 var fieldIDToName_ExampleServiceDynamicStructMethodArgs = map[int16]string{ 13482 1: "req", 13483 } 13484 13485 func (p *ExampleServiceDynamicStructMethodArgs) IsSetReq() bool { 13486 return p.Req != nil 13487 } 13488 13489 func (p *ExampleServiceDynamicStructMethodArgs) Read(iprot thrift.TProtocol) (err error) { 13490 13491 var fieldTypeId thrift.TType 13492 var fieldId int16 13493 13494 if _, err = iprot.ReadStructBegin(); err != nil { 13495 goto ReadStructBeginError 13496 } 13497 13498 for { 13499 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 13500 if err != nil { 13501 goto ReadFieldBeginError 13502 } 13503 if fieldTypeId == thrift.STOP { 13504 break 13505 } 13506 13507 switch fieldId { 13508 case 1: 13509 if fieldTypeId == thrift.STRUCT { 13510 if err = p.ReadField1(iprot); err != nil { 13511 goto ReadFieldError 13512 } 13513 } else { 13514 if err = iprot.Skip(fieldTypeId); err != nil { 13515 goto SkipFieldError 13516 } 13517 } 13518 default: 13519 if err = iprot.Skip(fieldTypeId); err != nil { 13520 goto SkipFieldError 13521 } 13522 } 13523 13524 if err = iprot.ReadFieldEnd(); err != nil { 13525 goto ReadFieldEndError 13526 } 13527 } 13528 if err = iprot.ReadStructEnd(); err != nil { 13529 goto ReadStructEndError 13530 } 13531 13532 return nil 13533 ReadStructBeginError: 13534 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 13535 ReadFieldBeginError: 13536 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 13537 ReadFieldError: 13538 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceDynamicStructMethodArgs[fieldId]), err) 13539 SkipFieldError: 13540 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 13541 13542 ReadFieldEndError: 13543 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 13544 ReadStructEndError: 13545 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 13546 } 13547 13548 func (p *ExampleServiceDynamicStructMethodArgs) ReadField1(iprot thrift.TProtocol) error { 13549 p.Req = NewExampleDynamicStruct() 13550 if err := p.Req.Read(iprot); err != nil { 13551 return err 13552 } 13553 return nil 13554 } 13555 13556 func (p *ExampleServiceDynamicStructMethodArgs) Write(oprot thrift.TProtocol) (err error) { 13557 var fieldId int16 13558 if err = oprot.WriteStructBegin("DynamicStructMethod_args"); err != nil { 13559 goto WriteStructBeginError 13560 } 13561 if p != nil { 13562 if err = p.writeField1(oprot); err != nil { 13563 fieldId = 1 13564 goto WriteFieldError 13565 } 13566 13567 } 13568 if err = oprot.WriteFieldStop(); err != nil { 13569 goto WriteFieldStopError 13570 } 13571 if err = oprot.WriteStructEnd(); err != nil { 13572 goto WriteStructEndError 13573 } 13574 return nil 13575 WriteStructBeginError: 13576 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 13577 WriteFieldError: 13578 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 13579 WriteFieldStopError: 13580 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 13581 WriteStructEndError: 13582 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 13583 } 13584 13585 func (p *ExampleServiceDynamicStructMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 13586 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 13587 goto WriteFieldBeginError 13588 } 13589 if err := p.Req.Write(oprot); err != nil { 13590 return err 13591 } 13592 if err = oprot.WriteFieldEnd(); err != nil { 13593 goto WriteFieldEndError 13594 } 13595 return nil 13596 WriteFieldBeginError: 13597 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 13598 WriteFieldEndError: 13599 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 13600 } 13601 13602 func (p *ExampleServiceDynamicStructMethodArgs) String() string { 13603 if p == nil { 13604 return "<nil>" 13605 } 13606 return fmt.Sprintf("ExampleServiceDynamicStructMethodArgs(%+v)", *p) 13607 } 13608 13609 func (p *ExampleServiceDynamicStructMethodArgs) DeepEqual(ano *ExampleServiceDynamicStructMethodArgs) bool { 13610 if p == ano { 13611 return true 13612 } else if p == nil || ano == nil { 13613 return false 13614 } 13615 if !p.Field1DeepEqual(ano.Req) { 13616 return false 13617 } 13618 return true 13619 } 13620 13621 func (p *ExampleServiceDynamicStructMethodArgs) Field1DeepEqual(src *ExampleDynamicStruct) bool { 13622 13623 if !p.Req.DeepEqual(src) { 13624 return false 13625 } 13626 return true 13627 } 13628 13629 type ExampleServiceDynamicStructMethodResult struct { 13630 Success *ExampleDynamicStruct `thrift:"success,0" json:"success,omitempty"` 13631 } 13632 13633 func NewExampleServiceDynamicStructMethodResult() *ExampleServiceDynamicStructMethodResult { 13634 return &ExampleServiceDynamicStructMethodResult{} 13635 } 13636 13637 var ExampleServiceDynamicStructMethodResult_Success_DEFAULT *ExampleDynamicStruct 13638 13639 func (p *ExampleServiceDynamicStructMethodResult) GetSuccess() (v *ExampleDynamicStruct) { 13640 if !p.IsSetSuccess() { 13641 return ExampleServiceDynamicStructMethodResult_Success_DEFAULT 13642 } 13643 return p.Success 13644 } 13645 func (p *ExampleServiceDynamicStructMethodResult) SetSuccess(x interface{}) { 13646 p.Success = x.(*ExampleDynamicStruct) 13647 } 13648 13649 var fieldIDToName_ExampleServiceDynamicStructMethodResult = map[int16]string{ 13650 0: "success", 13651 } 13652 13653 func (p *ExampleServiceDynamicStructMethodResult) IsSetSuccess() bool { 13654 return p.Success != nil 13655 } 13656 13657 func (p *ExampleServiceDynamicStructMethodResult) Read(iprot thrift.TProtocol) (err error) { 13658 13659 var fieldTypeId thrift.TType 13660 var fieldId int16 13661 13662 if _, err = iprot.ReadStructBegin(); err != nil { 13663 goto ReadStructBeginError 13664 } 13665 13666 for { 13667 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 13668 if err != nil { 13669 goto ReadFieldBeginError 13670 } 13671 if fieldTypeId == thrift.STOP { 13672 break 13673 } 13674 13675 switch fieldId { 13676 case 0: 13677 if fieldTypeId == thrift.STRUCT { 13678 if err = p.ReadField0(iprot); err != nil { 13679 goto ReadFieldError 13680 } 13681 } else { 13682 if err = iprot.Skip(fieldTypeId); err != nil { 13683 goto SkipFieldError 13684 } 13685 } 13686 default: 13687 if err = iprot.Skip(fieldTypeId); err != nil { 13688 goto SkipFieldError 13689 } 13690 } 13691 13692 if err = iprot.ReadFieldEnd(); err != nil { 13693 goto ReadFieldEndError 13694 } 13695 } 13696 if err = iprot.ReadStructEnd(); err != nil { 13697 goto ReadStructEndError 13698 } 13699 13700 return nil 13701 ReadStructBeginError: 13702 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 13703 ReadFieldBeginError: 13704 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 13705 ReadFieldError: 13706 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceDynamicStructMethodResult[fieldId]), err) 13707 SkipFieldError: 13708 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 13709 13710 ReadFieldEndError: 13711 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 13712 ReadStructEndError: 13713 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 13714 } 13715 13716 func (p *ExampleServiceDynamicStructMethodResult) ReadField0(iprot thrift.TProtocol) error { 13717 p.Success = NewExampleDynamicStruct() 13718 if err := p.Success.Read(iprot); err != nil { 13719 return err 13720 } 13721 return nil 13722 } 13723 13724 func (p *ExampleServiceDynamicStructMethodResult) Write(oprot thrift.TProtocol) (err error) { 13725 var fieldId int16 13726 if err = oprot.WriteStructBegin("DynamicStructMethod_result"); err != nil { 13727 goto WriteStructBeginError 13728 } 13729 if p != nil { 13730 if err = p.writeField0(oprot); err != nil { 13731 fieldId = 0 13732 goto WriteFieldError 13733 } 13734 13735 } 13736 if err = oprot.WriteFieldStop(); err != nil { 13737 goto WriteFieldStopError 13738 } 13739 if err = oprot.WriteStructEnd(); err != nil { 13740 goto WriteStructEndError 13741 } 13742 return nil 13743 WriteStructBeginError: 13744 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 13745 WriteFieldError: 13746 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 13747 WriteFieldStopError: 13748 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 13749 WriteStructEndError: 13750 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 13751 } 13752 13753 func (p *ExampleServiceDynamicStructMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 13754 if p.IsSetSuccess() { 13755 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 13756 goto WriteFieldBeginError 13757 } 13758 if err := p.Success.Write(oprot); err != nil { 13759 return err 13760 } 13761 if err = oprot.WriteFieldEnd(); err != nil { 13762 goto WriteFieldEndError 13763 } 13764 } 13765 return nil 13766 WriteFieldBeginError: 13767 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 13768 WriteFieldEndError: 13769 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 13770 } 13771 13772 func (p *ExampleServiceDynamicStructMethodResult) String() string { 13773 if p == nil { 13774 return "<nil>" 13775 } 13776 return fmt.Sprintf("ExampleServiceDynamicStructMethodResult(%+v)", *p) 13777 } 13778 13779 func (p *ExampleServiceDynamicStructMethodResult) DeepEqual(ano *ExampleServiceDynamicStructMethodResult) bool { 13780 if p == ano { 13781 return true 13782 } else if p == nil || ano == nil { 13783 return false 13784 } 13785 if !p.Field0DeepEqual(ano.Success) { 13786 return false 13787 } 13788 return true 13789 } 13790 13791 func (p *ExampleServiceDynamicStructMethodResult) Field0DeepEqual(src *ExampleDynamicStruct) bool { 13792 13793 if !p.Success.DeepEqual(src) { 13794 return false 13795 } 13796 return true 13797 } 13798 13799 type ExampleServiceBase64BinaryMethodArgs struct { 13800 Req *ExampleBase64Binary `thrift:"req,1" json:"req"` 13801 } 13802 13803 func NewExampleServiceBase64BinaryMethodArgs() *ExampleServiceBase64BinaryMethodArgs { 13804 return &ExampleServiceBase64BinaryMethodArgs{} 13805 } 13806 13807 var ExampleServiceBase64BinaryMethodArgs_Req_DEFAULT *ExampleBase64Binary 13808 13809 func (p *ExampleServiceBase64BinaryMethodArgs) GetReq() (v *ExampleBase64Binary) { 13810 if !p.IsSetReq() { 13811 return ExampleServiceBase64BinaryMethodArgs_Req_DEFAULT 13812 } 13813 return p.Req 13814 } 13815 func (p *ExampleServiceBase64BinaryMethodArgs) SetReq(val *ExampleBase64Binary) { 13816 p.Req = val 13817 } 13818 13819 var fieldIDToName_ExampleServiceBase64BinaryMethodArgs = map[int16]string{ 13820 1: "req", 13821 } 13822 13823 func (p *ExampleServiceBase64BinaryMethodArgs) IsSetReq() bool { 13824 return p.Req != nil 13825 } 13826 13827 func (p *ExampleServiceBase64BinaryMethodArgs) Read(iprot thrift.TProtocol) (err error) { 13828 13829 var fieldTypeId thrift.TType 13830 var fieldId int16 13831 13832 if _, err = iprot.ReadStructBegin(); err != nil { 13833 goto ReadStructBeginError 13834 } 13835 13836 for { 13837 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 13838 if err != nil { 13839 goto ReadFieldBeginError 13840 } 13841 if fieldTypeId == thrift.STOP { 13842 break 13843 } 13844 13845 switch fieldId { 13846 case 1: 13847 if fieldTypeId == thrift.STRUCT { 13848 if err = p.ReadField1(iprot); err != nil { 13849 goto ReadFieldError 13850 } 13851 } else { 13852 if err = iprot.Skip(fieldTypeId); err != nil { 13853 goto SkipFieldError 13854 } 13855 } 13856 default: 13857 if err = iprot.Skip(fieldTypeId); err != nil { 13858 goto SkipFieldError 13859 } 13860 } 13861 13862 if err = iprot.ReadFieldEnd(); err != nil { 13863 goto ReadFieldEndError 13864 } 13865 } 13866 if err = iprot.ReadStructEnd(); err != nil { 13867 goto ReadStructEndError 13868 } 13869 13870 return nil 13871 ReadStructBeginError: 13872 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 13873 ReadFieldBeginError: 13874 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 13875 ReadFieldError: 13876 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceBase64BinaryMethodArgs[fieldId]), err) 13877 SkipFieldError: 13878 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 13879 13880 ReadFieldEndError: 13881 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 13882 ReadStructEndError: 13883 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 13884 } 13885 13886 func (p *ExampleServiceBase64BinaryMethodArgs) ReadField1(iprot thrift.TProtocol) error { 13887 p.Req = NewExampleBase64Binary() 13888 if err := p.Req.Read(iprot); err != nil { 13889 return err 13890 } 13891 return nil 13892 } 13893 13894 func (p *ExampleServiceBase64BinaryMethodArgs) Write(oprot thrift.TProtocol) (err error) { 13895 var fieldId int16 13896 if err = oprot.WriteStructBegin("Base64BinaryMethod_args"); err != nil { 13897 goto WriteStructBeginError 13898 } 13899 if p != nil { 13900 if err = p.writeField1(oprot); err != nil { 13901 fieldId = 1 13902 goto WriteFieldError 13903 } 13904 13905 } 13906 if err = oprot.WriteFieldStop(); err != nil { 13907 goto WriteFieldStopError 13908 } 13909 if err = oprot.WriteStructEnd(); err != nil { 13910 goto WriteStructEndError 13911 } 13912 return nil 13913 WriteStructBeginError: 13914 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 13915 WriteFieldError: 13916 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 13917 WriteFieldStopError: 13918 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 13919 WriteStructEndError: 13920 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 13921 } 13922 13923 func (p *ExampleServiceBase64BinaryMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 13924 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 13925 goto WriteFieldBeginError 13926 } 13927 if err := p.Req.Write(oprot); err != nil { 13928 return err 13929 } 13930 if err = oprot.WriteFieldEnd(); err != nil { 13931 goto WriteFieldEndError 13932 } 13933 return nil 13934 WriteFieldBeginError: 13935 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 13936 WriteFieldEndError: 13937 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 13938 } 13939 13940 func (p *ExampleServiceBase64BinaryMethodArgs) String() string { 13941 if p == nil { 13942 return "<nil>" 13943 } 13944 return fmt.Sprintf("ExampleServiceBase64BinaryMethodArgs(%+v)", *p) 13945 } 13946 13947 func (p *ExampleServiceBase64BinaryMethodArgs) DeepEqual(ano *ExampleServiceBase64BinaryMethodArgs) bool { 13948 if p == ano { 13949 return true 13950 } else if p == nil || ano == nil { 13951 return false 13952 } 13953 if !p.Field1DeepEqual(ano.Req) { 13954 return false 13955 } 13956 return true 13957 } 13958 13959 func (p *ExampleServiceBase64BinaryMethodArgs) Field1DeepEqual(src *ExampleBase64Binary) bool { 13960 13961 if !p.Req.DeepEqual(src) { 13962 return false 13963 } 13964 return true 13965 } 13966 13967 type ExampleServiceBase64BinaryMethodResult struct { 13968 Success *ExampleBase64Binary `thrift:"success,0" json:"success,omitempty"` 13969 } 13970 13971 func NewExampleServiceBase64BinaryMethodResult() *ExampleServiceBase64BinaryMethodResult { 13972 return &ExampleServiceBase64BinaryMethodResult{} 13973 } 13974 13975 var ExampleServiceBase64BinaryMethodResult_Success_DEFAULT *ExampleBase64Binary 13976 13977 func (p *ExampleServiceBase64BinaryMethodResult) GetSuccess() (v *ExampleBase64Binary) { 13978 if !p.IsSetSuccess() { 13979 return ExampleServiceBase64BinaryMethodResult_Success_DEFAULT 13980 } 13981 return p.Success 13982 } 13983 func (p *ExampleServiceBase64BinaryMethodResult) SetSuccess(x interface{}) { 13984 p.Success = x.(*ExampleBase64Binary) 13985 } 13986 13987 var fieldIDToName_ExampleServiceBase64BinaryMethodResult = map[int16]string{ 13988 0: "success", 13989 } 13990 13991 func (p *ExampleServiceBase64BinaryMethodResult) IsSetSuccess() bool { 13992 return p.Success != nil 13993 } 13994 13995 func (p *ExampleServiceBase64BinaryMethodResult) Read(iprot thrift.TProtocol) (err error) { 13996 13997 var fieldTypeId thrift.TType 13998 var fieldId int16 13999 14000 if _, err = iprot.ReadStructBegin(); err != nil { 14001 goto ReadStructBeginError 14002 } 14003 14004 for { 14005 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 14006 if err != nil { 14007 goto ReadFieldBeginError 14008 } 14009 if fieldTypeId == thrift.STOP { 14010 break 14011 } 14012 14013 switch fieldId { 14014 case 0: 14015 if fieldTypeId == thrift.STRUCT { 14016 if err = p.ReadField0(iprot); err != nil { 14017 goto ReadFieldError 14018 } 14019 } else { 14020 if err = iprot.Skip(fieldTypeId); err != nil { 14021 goto SkipFieldError 14022 } 14023 } 14024 default: 14025 if err = iprot.Skip(fieldTypeId); err != nil { 14026 goto SkipFieldError 14027 } 14028 } 14029 14030 if err = iprot.ReadFieldEnd(); err != nil { 14031 goto ReadFieldEndError 14032 } 14033 } 14034 if err = iprot.ReadStructEnd(); err != nil { 14035 goto ReadStructEndError 14036 } 14037 14038 return nil 14039 ReadStructBeginError: 14040 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 14041 ReadFieldBeginError: 14042 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 14043 ReadFieldError: 14044 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceBase64BinaryMethodResult[fieldId]), err) 14045 SkipFieldError: 14046 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 14047 14048 ReadFieldEndError: 14049 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 14050 ReadStructEndError: 14051 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 14052 } 14053 14054 func (p *ExampleServiceBase64BinaryMethodResult) ReadField0(iprot thrift.TProtocol) error { 14055 p.Success = NewExampleBase64Binary() 14056 if err := p.Success.Read(iprot); err != nil { 14057 return err 14058 } 14059 return nil 14060 } 14061 14062 func (p *ExampleServiceBase64BinaryMethodResult) Write(oprot thrift.TProtocol) (err error) { 14063 var fieldId int16 14064 if err = oprot.WriteStructBegin("Base64BinaryMethod_result"); err != nil { 14065 goto WriteStructBeginError 14066 } 14067 if p != nil { 14068 if err = p.writeField0(oprot); err != nil { 14069 fieldId = 0 14070 goto WriteFieldError 14071 } 14072 14073 } 14074 if err = oprot.WriteFieldStop(); err != nil { 14075 goto WriteFieldStopError 14076 } 14077 if err = oprot.WriteStructEnd(); err != nil { 14078 goto WriteStructEndError 14079 } 14080 return nil 14081 WriteStructBeginError: 14082 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 14083 WriteFieldError: 14084 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 14085 WriteFieldStopError: 14086 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 14087 WriteStructEndError: 14088 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 14089 } 14090 14091 func (p *ExampleServiceBase64BinaryMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 14092 if p.IsSetSuccess() { 14093 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 14094 goto WriteFieldBeginError 14095 } 14096 if err := p.Success.Write(oprot); err != nil { 14097 return err 14098 } 14099 if err = oprot.WriteFieldEnd(); err != nil { 14100 goto WriteFieldEndError 14101 } 14102 } 14103 return nil 14104 WriteFieldBeginError: 14105 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 14106 WriteFieldEndError: 14107 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 14108 } 14109 14110 func (p *ExampleServiceBase64BinaryMethodResult) String() string { 14111 if p == nil { 14112 return "<nil>" 14113 } 14114 return fmt.Sprintf("ExampleServiceBase64BinaryMethodResult(%+v)", *p) 14115 } 14116 14117 func (p *ExampleServiceBase64BinaryMethodResult) DeepEqual(ano *ExampleServiceBase64BinaryMethodResult) bool { 14118 if p == ano { 14119 return true 14120 } else if p == nil || ano == nil { 14121 return false 14122 } 14123 if !p.Field0DeepEqual(ano.Success) { 14124 return false 14125 } 14126 return true 14127 } 14128 14129 func (p *ExampleServiceBase64BinaryMethodResult) Field0DeepEqual(src *ExampleBase64Binary) bool { 14130 14131 if !p.Success.DeepEqual(src) { 14132 return false 14133 } 14134 return true 14135 } 14136 14137 type ExampleServiceDefaultValueMethodArgs struct { 14138 Req *ExampleDefaultValue `thrift:"req,1" json:"req"` 14139 } 14140 14141 func NewExampleServiceDefaultValueMethodArgs() *ExampleServiceDefaultValueMethodArgs { 14142 return &ExampleServiceDefaultValueMethodArgs{} 14143 } 14144 14145 var ExampleServiceDefaultValueMethodArgs_Req_DEFAULT *ExampleDefaultValue 14146 14147 func (p *ExampleServiceDefaultValueMethodArgs) GetReq() (v *ExampleDefaultValue) { 14148 if !p.IsSetReq() { 14149 return ExampleServiceDefaultValueMethodArgs_Req_DEFAULT 14150 } 14151 return p.Req 14152 } 14153 func (p *ExampleServiceDefaultValueMethodArgs) SetReq(val *ExampleDefaultValue) { 14154 p.Req = val 14155 } 14156 14157 var fieldIDToName_ExampleServiceDefaultValueMethodArgs = map[int16]string{ 14158 1: "req", 14159 } 14160 14161 func (p *ExampleServiceDefaultValueMethodArgs) IsSetReq() bool { 14162 return p.Req != nil 14163 } 14164 14165 func (p *ExampleServiceDefaultValueMethodArgs) Read(iprot thrift.TProtocol) (err error) { 14166 14167 var fieldTypeId thrift.TType 14168 var fieldId int16 14169 14170 if _, err = iprot.ReadStructBegin(); err != nil { 14171 goto ReadStructBeginError 14172 } 14173 14174 for { 14175 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 14176 if err != nil { 14177 goto ReadFieldBeginError 14178 } 14179 if fieldTypeId == thrift.STOP { 14180 break 14181 } 14182 14183 switch fieldId { 14184 case 1: 14185 if fieldTypeId == thrift.STRUCT { 14186 if err = p.ReadField1(iprot); err != nil { 14187 goto ReadFieldError 14188 } 14189 } else { 14190 if err = iprot.Skip(fieldTypeId); err != nil { 14191 goto SkipFieldError 14192 } 14193 } 14194 default: 14195 if err = iprot.Skip(fieldTypeId); err != nil { 14196 goto SkipFieldError 14197 } 14198 } 14199 14200 if err = iprot.ReadFieldEnd(); err != nil { 14201 goto ReadFieldEndError 14202 } 14203 } 14204 if err = iprot.ReadStructEnd(); err != nil { 14205 goto ReadStructEndError 14206 } 14207 14208 return nil 14209 ReadStructBeginError: 14210 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 14211 ReadFieldBeginError: 14212 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 14213 ReadFieldError: 14214 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceDefaultValueMethodArgs[fieldId]), err) 14215 SkipFieldError: 14216 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 14217 14218 ReadFieldEndError: 14219 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 14220 ReadStructEndError: 14221 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 14222 } 14223 14224 func (p *ExampleServiceDefaultValueMethodArgs) ReadField1(iprot thrift.TProtocol) error { 14225 p.Req = NewExampleDefaultValue() 14226 if err := p.Req.Read(iprot); err != nil { 14227 return err 14228 } 14229 return nil 14230 } 14231 14232 func (p *ExampleServiceDefaultValueMethodArgs) Write(oprot thrift.TProtocol) (err error) { 14233 var fieldId int16 14234 if err = oprot.WriteStructBegin("DefaultValueMethod_args"); err != nil { 14235 goto WriteStructBeginError 14236 } 14237 if p != nil { 14238 if err = p.writeField1(oprot); err != nil { 14239 fieldId = 1 14240 goto WriteFieldError 14241 } 14242 14243 } 14244 if err = oprot.WriteFieldStop(); err != nil { 14245 goto WriteFieldStopError 14246 } 14247 if err = oprot.WriteStructEnd(); err != nil { 14248 goto WriteStructEndError 14249 } 14250 return nil 14251 WriteStructBeginError: 14252 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 14253 WriteFieldError: 14254 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 14255 WriteFieldStopError: 14256 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 14257 WriteStructEndError: 14258 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 14259 } 14260 14261 func (p *ExampleServiceDefaultValueMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 14262 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 14263 goto WriteFieldBeginError 14264 } 14265 if err := p.Req.Write(oprot); err != nil { 14266 return err 14267 } 14268 if err = oprot.WriteFieldEnd(); err != nil { 14269 goto WriteFieldEndError 14270 } 14271 return nil 14272 WriteFieldBeginError: 14273 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 14274 WriteFieldEndError: 14275 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 14276 } 14277 14278 func (p *ExampleServiceDefaultValueMethodArgs) String() string { 14279 if p == nil { 14280 return "<nil>" 14281 } 14282 return fmt.Sprintf("ExampleServiceDefaultValueMethodArgs(%+v)", *p) 14283 } 14284 14285 func (p *ExampleServiceDefaultValueMethodArgs) DeepEqual(ano *ExampleServiceDefaultValueMethodArgs) bool { 14286 if p == ano { 14287 return true 14288 } else if p == nil || ano == nil { 14289 return false 14290 } 14291 if !p.Field1DeepEqual(ano.Req) { 14292 return false 14293 } 14294 return true 14295 } 14296 14297 func (p *ExampleServiceDefaultValueMethodArgs) Field1DeepEqual(src *ExampleDefaultValue) bool { 14298 14299 if !p.Req.DeepEqual(src) { 14300 return false 14301 } 14302 return true 14303 } 14304 14305 type ExampleServiceDefaultValueMethodResult struct { 14306 Success *ExampleDefaultValue `thrift:"success,0" json:"success,omitempty"` 14307 } 14308 14309 func NewExampleServiceDefaultValueMethodResult() *ExampleServiceDefaultValueMethodResult { 14310 return &ExampleServiceDefaultValueMethodResult{} 14311 } 14312 14313 var ExampleServiceDefaultValueMethodResult_Success_DEFAULT *ExampleDefaultValue 14314 14315 func (p *ExampleServiceDefaultValueMethodResult) GetSuccess() (v *ExampleDefaultValue) { 14316 if !p.IsSetSuccess() { 14317 return ExampleServiceDefaultValueMethodResult_Success_DEFAULT 14318 } 14319 return p.Success 14320 } 14321 func (p *ExampleServiceDefaultValueMethodResult) SetSuccess(x interface{}) { 14322 p.Success = x.(*ExampleDefaultValue) 14323 } 14324 14325 var fieldIDToName_ExampleServiceDefaultValueMethodResult = map[int16]string{ 14326 0: "success", 14327 } 14328 14329 func (p *ExampleServiceDefaultValueMethodResult) IsSetSuccess() bool { 14330 return p.Success != nil 14331 } 14332 14333 func (p *ExampleServiceDefaultValueMethodResult) Read(iprot thrift.TProtocol) (err error) { 14334 14335 var fieldTypeId thrift.TType 14336 var fieldId int16 14337 14338 if _, err = iprot.ReadStructBegin(); err != nil { 14339 goto ReadStructBeginError 14340 } 14341 14342 for { 14343 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 14344 if err != nil { 14345 goto ReadFieldBeginError 14346 } 14347 if fieldTypeId == thrift.STOP { 14348 break 14349 } 14350 14351 switch fieldId { 14352 case 0: 14353 if fieldTypeId == thrift.STRUCT { 14354 if err = p.ReadField0(iprot); err != nil { 14355 goto ReadFieldError 14356 } 14357 } else { 14358 if err = iprot.Skip(fieldTypeId); err != nil { 14359 goto SkipFieldError 14360 } 14361 } 14362 default: 14363 if err = iprot.Skip(fieldTypeId); err != nil { 14364 goto SkipFieldError 14365 } 14366 } 14367 14368 if err = iprot.ReadFieldEnd(); err != nil { 14369 goto ReadFieldEndError 14370 } 14371 } 14372 if err = iprot.ReadStructEnd(); err != nil { 14373 goto ReadStructEndError 14374 } 14375 14376 return nil 14377 ReadStructBeginError: 14378 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 14379 ReadFieldBeginError: 14380 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 14381 ReadFieldError: 14382 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceDefaultValueMethodResult[fieldId]), err) 14383 SkipFieldError: 14384 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 14385 14386 ReadFieldEndError: 14387 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 14388 ReadStructEndError: 14389 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 14390 } 14391 14392 func (p *ExampleServiceDefaultValueMethodResult) ReadField0(iprot thrift.TProtocol) error { 14393 p.Success = NewExampleDefaultValue() 14394 if err := p.Success.Read(iprot); err != nil { 14395 return err 14396 } 14397 return nil 14398 } 14399 14400 func (p *ExampleServiceDefaultValueMethodResult) Write(oprot thrift.TProtocol) (err error) { 14401 var fieldId int16 14402 if err = oprot.WriteStructBegin("DefaultValueMethod_result"); err != nil { 14403 goto WriteStructBeginError 14404 } 14405 if p != nil { 14406 if err = p.writeField0(oprot); err != nil { 14407 fieldId = 0 14408 goto WriteFieldError 14409 } 14410 14411 } 14412 if err = oprot.WriteFieldStop(); err != nil { 14413 goto WriteFieldStopError 14414 } 14415 if err = oprot.WriteStructEnd(); err != nil { 14416 goto WriteStructEndError 14417 } 14418 return nil 14419 WriteStructBeginError: 14420 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 14421 WriteFieldError: 14422 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 14423 WriteFieldStopError: 14424 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 14425 WriteStructEndError: 14426 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 14427 } 14428 14429 func (p *ExampleServiceDefaultValueMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 14430 if p.IsSetSuccess() { 14431 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 14432 goto WriteFieldBeginError 14433 } 14434 if err := p.Success.Write(oprot); err != nil { 14435 return err 14436 } 14437 if err = oprot.WriteFieldEnd(); err != nil { 14438 goto WriteFieldEndError 14439 } 14440 } 14441 return nil 14442 WriteFieldBeginError: 14443 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 14444 WriteFieldEndError: 14445 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 14446 } 14447 14448 func (p *ExampleServiceDefaultValueMethodResult) String() string { 14449 if p == nil { 14450 return "<nil>" 14451 } 14452 return fmt.Sprintf("ExampleServiceDefaultValueMethodResult(%+v)", *p) 14453 } 14454 14455 func (p *ExampleServiceDefaultValueMethodResult) DeepEqual(ano *ExampleServiceDefaultValueMethodResult) bool { 14456 if p == ano { 14457 return true 14458 } else if p == nil || ano == nil { 14459 return false 14460 } 14461 if !p.Field0DeepEqual(ano.Success) { 14462 return false 14463 } 14464 return true 14465 } 14466 14467 func (p *ExampleServiceDefaultValueMethodResult) Field0DeepEqual(src *ExampleDefaultValue) bool { 14468 14469 if !p.Success.DeepEqual(src) { 14470 return false 14471 } 14472 return true 14473 } 14474 14475 type ExampleServiceOptionalDefaultValueMethodArgs struct { 14476 Req *ExampleOptionalDefaultValue `thrift:"req,1" json:"req"` 14477 } 14478 14479 func NewExampleServiceOptionalDefaultValueMethodArgs() *ExampleServiceOptionalDefaultValueMethodArgs { 14480 return &ExampleServiceOptionalDefaultValueMethodArgs{} 14481 } 14482 14483 var ExampleServiceOptionalDefaultValueMethodArgs_Req_DEFAULT *ExampleOptionalDefaultValue 14484 14485 func (p *ExampleServiceOptionalDefaultValueMethodArgs) GetReq() (v *ExampleOptionalDefaultValue) { 14486 if !p.IsSetReq() { 14487 return ExampleServiceOptionalDefaultValueMethodArgs_Req_DEFAULT 14488 } 14489 return p.Req 14490 } 14491 func (p *ExampleServiceOptionalDefaultValueMethodArgs) SetReq(val *ExampleOptionalDefaultValue) { 14492 p.Req = val 14493 } 14494 14495 var fieldIDToName_ExampleServiceOptionalDefaultValueMethodArgs = map[int16]string{ 14496 1: "req", 14497 } 14498 14499 func (p *ExampleServiceOptionalDefaultValueMethodArgs) IsSetReq() bool { 14500 return p.Req != nil 14501 } 14502 14503 func (p *ExampleServiceOptionalDefaultValueMethodArgs) Read(iprot thrift.TProtocol) (err error) { 14504 14505 var fieldTypeId thrift.TType 14506 var fieldId int16 14507 14508 if _, err = iprot.ReadStructBegin(); err != nil { 14509 goto ReadStructBeginError 14510 } 14511 14512 for { 14513 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 14514 if err != nil { 14515 goto ReadFieldBeginError 14516 } 14517 if fieldTypeId == thrift.STOP { 14518 break 14519 } 14520 14521 switch fieldId { 14522 case 1: 14523 if fieldTypeId == thrift.STRUCT { 14524 if err = p.ReadField1(iprot); err != nil { 14525 goto ReadFieldError 14526 } 14527 } else { 14528 if err = iprot.Skip(fieldTypeId); err != nil { 14529 goto SkipFieldError 14530 } 14531 } 14532 default: 14533 if err = iprot.Skip(fieldTypeId); err != nil { 14534 goto SkipFieldError 14535 } 14536 } 14537 14538 if err = iprot.ReadFieldEnd(); err != nil { 14539 goto ReadFieldEndError 14540 } 14541 } 14542 if err = iprot.ReadStructEnd(); err != nil { 14543 goto ReadStructEndError 14544 } 14545 14546 return nil 14547 ReadStructBeginError: 14548 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 14549 ReadFieldBeginError: 14550 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 14551 ReadFieldError: 14552 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceOptionalDefaultValueMethodArgs[fieldId]), err) 14553 SkipFieldError: 14554 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 14555 14556 ReadFieldEndError: 14557 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 14558 ReadStructEndError: 14559 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 14560 } 14561 14562 func (p *ExampleServiceOptionalDefaultValueMethodArgs) ReadField1(iprot thrift.TProtocol) error { 14563 p.Req = NewExampleOptionalDefaultValue() 14564 if err := p.Req.Read(iprot); err != nil { 14565 return err 14566 } 14567 return nil 14568 } 14569 14570 func (p *ExampleServiceOptionalDefaultValueMethodArgs) Write(oprot thrift.TProtocol) (err error) { 14571 var fieldId int16 14572 if err = oprot.WriteStructBegin("OptionalDefaultValueMethod_args"); err != nil { 14573 goto WriteStructBeginError 14574 } 14575 if p != nil { 14576 if err = p.writeField1(oprot); err != nil { 14577 fieldId = 1 14578 goto WriteFieldError 14579 } 14580 14581 } 14582 if err = oprot.WriteFieldStop(); err != nil { 14583 goto WriteFieldStopError 14584 } 14585 if err = oprot.WriteStructEnd(); err != nil { 14586 goto WriteStructEndError 14587 } 14588 return nil 14589 WriteStructBeginError: 14590 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 14591 WriteFieldError: 14592 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 14593 WriteFieldStopError: 14594 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 14595 WriteStructEndError: 14596 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 14597 } 14598 14599 func (p *ExampleServiceOptionalDefaultValueMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 14600 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 14601 goto WriteFieldBeginError 14602 } 14603 if err := p.Req.Write(oprot); err != nil { 14604 return err 14605 } 14606 if err = oprot.WriteFieldEnd(); err != nil { 14607 goto WriteFieldEndError 14608 } 14609 return nil 14610 WriteFieldBeginError: 14611 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 14612 WriteFieldEndError: 14613 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 14614 } 14615 14616 func (p *ExampleServiceOptionalDefaultValueMethodArgs) String() string { 14617 if p == nil { 14618 return "<nil>" 14619 } 14620 return fmt.Sprintf("ExampleServiceOptionalDefaultValueMethodArgs(%+v)", *p) 14621 } 14622 14623 func (p *ExampleServiceOptionalDefaultValueMethodArgs) DeepEqual(ano *ExampleServiceOptionalDefaultValueMethodArgs) bool { 14624 if p == ano { 14625 return true 14626 } else if p == nil || ano == nil { 14627 return false 14628 } 14629 if !p.Field1DeepEqual(ano.Req) { 14630 return false 14631 } 14632 return true 14633 } 14634 14635 func (p *ExampleServiceOptionalDefaultValueMethodArgs) Field1DeepEqual(src *ExampleOptionalDefaultValue) bool { 14636 14637 if !p.Req.DeepEqual(src) { 14638 return false 14639 } 14640 return true 14641 } 14642 14643 type ExampleServiceOptionalDefaultValueMethodResult struct { 14644 Success *ExampleOptionalDefaultValue `thrift:"success,0" json:"success,omitempty"` 14645 } 14646 14647 func NewExampleServiceOptionalDefaultValueMethodResult() *ExampleServiceOptionalDefaultValueMethodResult { 14648 return &ExampleServiceOptionalDefaultValueMethodResult{} 14649 } 14650 14651 var ExampleServiceOptionalDefaultValueMethodResult_Success_DEFAULT *ExampleOptionalDefaultValue 14652 14653 func (p *ExampleServiceOptionalDefaultValueMethodResult) GetSuccess() (v *ExampleOptionalDefaultValue) { 14654 if !p.IsSetSuccess() { 14655 return ExampleServiceOptionalDefaultValueMethodResult_Success_DEFAULT 14656 } 14657 return p.Success 14658 } 14659 func (p *ExampleServiceOptionalDefaultValueMethodResult) SetSuccess(x interface{}) { 14660 p.Success = x.(*ExampleOptionalDefaultValue) 14661 } 14662 14663 var fieldIDToName_ExampleServiceOptionalDefaultValueMethodResult = map[int16]string{ 14664 0: "success", 14665 } 14666 14667 func (p *ExampleServiceOptionalDefaultValueMethodResult) IsSetSuccess() bool { 14668 return p.Success != nil 14669 } 14670 14671 func (p *ExampleServiceOptionalDefaultValueMethodResult) Read(iprot thrift.TProtocol) (err error) { 14672 14673 var fieldTypeId thrift.TType 14674 var fieldId int16 14675 14676 if _, err = iprot.ReadStructBegin(); err != nil { 14677 goto ReadStructBeginError 14678 } 14679 14680 for { 14681 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 14682 if err != nil { 14683 goto ReadFieldBeginError 14684 } 14685 if fieldTypeId == thrift.STOP { 14686 break 14687 } 14688 14689 switch fieldId { 14690 case 0: 14691 if fieldTypeId == thrift.STRUCT { 14692 if err = p.ReadField0(iprot); err != nil { 14693 goto ReadFieldError 14694 } 14695 } else { 14696 if err = iprot.Skip(fieldTypeId); err != nil { 14697 goto SkipFieldError 14698 } 14699 } 14700 default: 14701 if err = iprot.Skip(fieldTypeId); err != nil { 14702 goto SkipFieldError 14703 } 14704 } 14705 14706 if err = iprot.ReadFieldEnd(); err != nil { 14707 goto ReadFieldEndError 14708 } 14709 } 14710 if err = iprot.ReadStructEnd(); err != nil { 14711 goto ReadStructEndError 14712 } 14713 14714 return nil 14715 ReadStructBeginError: 14716 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 14717 ReadFieldBeginError: 14718 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 14719 ReadFieldError: 14720 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceOptionalDefaultValueMethodResult[fieldId]), err) 14721 SkipFieldError: 14722 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 14723 14724 ReadFieldEndError: 14725 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 14726 ReadStructEndError: 14727 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 14728 } 14729 14730 func (p *ExampleServiceOptionalDefaultValueMethodResult) ReadField0(iprot thrift.TProtocol) error { 14731 p.Success = NewExampleOptionalDefaultValue() 14732 if err := p.Success.Read(iprot); err != nil { 14733 return err 14734 } 14735 return nil 14736 } 14737 14738 func (p *ExampleServiceOptionalDefaultValueMethodResult) Write(oprot thrift.TProtocol) (err error) { 14739 var fieldId int16 14740 if err = oprot.WriteStructBegin("OptionalDefaultValueMethod_result"); err != nil { 14741 goto WriteStructBeginError 14742 } 14743 if p != nil { 14744 if err = p.writeField0(oprot); err != nil { 14745 fieldId = 0 14746 goto WriteFieldError 14747 } 14748 14749 } 14750 if err = oprot.WriteFieldStop(); err != nil { 14751 goto WriteFieldStopError 14752 } 14753 if err = oprot.WriteStructEnd(); err != nil { 14754 goto WriteStructEndError 14755 } 14756 return nil 14757 WriteStructBeginError: 14758 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 14759 WriteFieldError: 14760 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 14761 WriteFieldStopError: 14762 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 14763 WriteStructEndError: 14764 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 14765 } 14766 14767 func (p *ExampleServiceOptionalDefaultValueMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 14768 if p.IsSetSuccess() { 14769 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 14770 goto WriteFieldBeginError 14771 } 14772 if err := p.Success.Write(oprot); err != nil { 14773 return err 14774 } 14775 if err = oprot.WriteFieldEnd(); err != nil { 14776 goto WriteFieldEndError 14777 } 14778 } 14779 return nil 14780 WriteFieldBeginError: 14781 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 14782 WriteFieldEndError: 14783 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 14784 } 14785 14786 func (p *ExampleServiceOptionalDefaultValueMethodResult) String() string { 14787 if p == nil { 14788 return "<nil>" 14789 } 14790 return fmt.Sprintf("ExampleServiceOptionalDefaultValueMethodResult(%+v)", *p) 14791 } 14792 14793 func (p *ExampleServiceOptionalDefaultValueMethodResult) DeepEqual(ano *ExampleServiceOptionalDefaultValueMethodResult) bool { 14794 if p == ano { 14795 return true 14796 } else if p == nil || ano == nil { 14797 return false 14798 } 14799 if !p.Field0DeepEqual(ano.Success) { 14800 return false 14801 } 14802 return true 14803 } 14804 14805 func (p *ExampleServiceOptionalDefaultValueMethodResult) Field0DeepEqual(src *ExampleOptionalDefaultValue) bool { 14806 14807 if !p.Success.DeepEqual(src) { 14808 return false 14809 } 14810 return true 14811 } 14812 14813 type ExampleServiceNoBodyStructMethodArgs struct { 14814 Req *ExampleNoBodyStruct `thrift:"req,1" json:"req"` 14815 } 14816 14817 func NewExampleServiceNoBodyStructMethodArgs() *ExampleServiceNoBodyStructMethodArgs { 14818 return &ExampleServiceNoBodyStructMethodArgs{} 14819 } 14820 14821 var ExampleServiceNoBodyStructMethodArgs_Req_DEFAULT *ExampleNoBodyStruct 14822 14823 func (p *ExampleServiceNoBodyStructMethodArgs) GetReq() (v *ExampleNoBodyStruct) { 14824 if !p.IsSetReq() { 14825 return ExampleServiceNoBodyStructMethodArgs_Req_DEFAULT 14826 } 14827 return p.Req 14828 } 14829 func (p *ExampleServiceNoBodyStructMethodArgs) SetReq(val *ExampleNoBodyStruct) { 14830 p.Req = val 14831 } 14832 14833 var fieldIDToName_ExampleServiceNoBodyStructMethodArgs = map[int16]string{ 14834 1: "req", 14835 } 14836 14837 func (p *ExampleServiceNoBodyStructMethodArgs) IsSetReq() bool { 14838 return p.Req != nil 14839 } 14840 14841 func (p *ExampleServiceNoBodyStructMethodArgs) Read(iprot thrift.TProtocol) (err error) { 14842 14843 var fieldTypeId thrift.TType 14844 var fieldId int16 14845 14846 if _, err = iprot.ReadStructBegin(); err != nil { 14847 goto ReadStructBeginError 14848 } 14849 14850 for { 14851 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 14852 if err != nil { 14853 goto ReadFieldBeginError 14854 } 14855 if fieldTypeId == thrift.STOP { 14856 break 14857 } 14858 14859 switch fieldId { 14860 case 1: 14861 if fieldTypeId == thrift.STRUCT { 14862 if err = p.ReadField1(iprot); err != nil { 14863 goto ReadFieldError 14864 } 14865 } else { 14866 if err = iprot.Skip(fieldTypeId); err != nil { 14867 goto SkipFieldError 14868 } 14869 } 14870 default: 14871 if err = iprot.Skip(fieldTypeId); err != nil { 14872 goto SkipFieldError 14873 } 14874 } 14875 14876 if err = iprot.ReadFieldEnd(); err != nil { 14877 goto ReadFieldEndError 14878 } 14879 } 14880 if err = iprot.ReadStructEnd(); err != nil { 14881 goto ReadStructEndError 14882 } 14883 14884 return nil 14885 ReadStructBeginError: 14886 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 14887 ReadFieldBeginError: 14888 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 14889 ReadFieldError: 14890 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceNoBodyStructMethodArgs[fieldId]), err) 14891 SkipFieldError: 14892 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 14893 14894 ReadFieldEndError: 14895 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 14896 ReadStructEndError: 14897 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 14898 } 14899 14900 func (p *ExampleServiceNoBodyStructMethodArgs) ReadField1(iprot thrift.TProtocol) error { 14901 p.Req = NewExampleNoBodyStruct() 14902 if err := p.Req.Read(iprot); err != nil { 14903 return err 14904 } 14905 return nil 14906 } 14907 14908 func (p *ExampleServiceNoBodyStructMethodArgs) Write(oprot thrift.TProtocol) (err error) { 14909 var fieldId int16 14910 if err = oprot.WriteStructBegin("NoBodyStructMethod_args"); err != nil { 14911 goto WriteStructBeginError 14912 } 14913 if p != nil { 14914 if err = p.writeField1(oprot); err != nil { 14915 fieldId = 1 14916 goto WriteFieldError 14917 } 14918 14919 } 14920 if err = oprot.WriteFieldStop(); err != nil { 14921 goto WriteFieldStopError 14922 } 14923 if err = oprot.WriteStructEnd(); err != nil { 14924 goto WriteStructEndError 14925 } 14926 return nil 14927 WriteStructBeginError: 14928 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 14929 WriteFieldError: 14930 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 14931 WriteFieldStopError: 14932 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 14933 WriteStructEndError: 14934 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 14935 } 14936 14937 func (p *ExampleServiceNoBodyStructMethodArgs) writeField1(oprot thrift.TProtocol) (err error) { 14938 if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { 14939 goto WriteFieldBeginError 14940 } 14941 if err := p.Req.Write(oprot); err != nil { 14942 return err 14943 } 14944 if err = oprot.WriteFieldEnd(); err != nil { 14945 goto WriteFieldEndError 14946 } 14947 return nil 14948 WriteFieldBeginError: 14949 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 14950 WriteFieldEndError: 14951 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 14952 } 14953 14954 func (p *ExampleServiceNoBodyStructMethodArgs) String() string { 14955 if p == nil { 14956 return "<nil>" 14957 } 14958 return fmt.Sprintf("ExampleServiceNoBodyStructMethodArgs(%+v)", *p) 14959 } 14960 14961 func (p *ExampleServiceNoBodyStructMethodArgs) DeepEqual(ano *ExampleServiceNoBodyStructMethodArgs) bool { 14962 if p == ano { 14963 return true 14964 } else if p == nil || ano == nil { 14965 return false 14966 } 14967 if !p.Field1DeepEqual(ano.Req) { 14968 return false 14969 } 14970 return true 14971 } 14972 14973 func (p *ExampleServiceNoBodyStructMethodArgs) Field1DeepEqual(src *ExampleNoBodyStruct) bool { 14974 14975 if !p.Req.DeepEqual(src) { 14976 return false 14977 } 14978 return true 14979 } 14980 14981 type ExampleServiceNoBodyStructMethodResult struct { 14982 Success *ExampleNoBodyStruct `thrift:"success,0" json:"success,omitempty"` 14983 } 14984 14985 func NewExampleServiceNoBodyStructMethodResult() *ExampleServiceNoBodyStructMethodResult { 14986 return &ExampleServiceNoBodyStructMethodResult{} 14987 } 14988 14989 var ExampleServiceNoBodyStructMethodResult_Success_DEFAULT *ExampleNoBodyStruct 14990 14991 func (p *ExampleServiceNoBodyStructMethodResult) GetSuccess() (v *ExampleNoBodyStruct) { 14992 if !p.IsSetSuccess() { 14993 return ExampleServiceNoBodyStructMethodResult_Success_DEFAULT 14994 } 14995 return p.Success 14996 } 14997 func (p *ExampleServiceNoBodyStructMethodResult) SetSuccess(x interface{}) { 14998 p.Success = x.(*ExampleNoBodyStruct) 14999 } 15000 15001 var fieldIDToName_ExampleServiceNoBodyStructMethodResult = map[int16]string{ 15002 0: "success", 15003 } 15004 15005 func (p *ExampleServiceNoBodyStructMethodResult) IsSetSuccess() bool { 15006 return p.Success != nil 15007 } 15008 15009 func (p *ExampleServiceNoBodyStructMethodResult) Read(iprot thrift.TProtocol) (err error) { 15010 15011 var fieldTypeId thrift.TType 15012 var fieldId int16 15013 15014 if _, err = iprot.ReadStructBegin(); err != nil { 15015 goto ReadStructBeginError 15016 } 15017 15018 for { 15019 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 15020 if err != nil { 15021 goto ReadFieldBeginError 15022 } 15023 if fieldTypeId == thrift.STOP { 15024 break 15025 } 15026 15027 switch fieldId { 15028 case 0: 15029 if fieldTypeId == thrift.STRUCT { 15030 if err = p.ReadField0(iprot); err != nil { 15031 goto ReadFieldError 15032 } 15033 } else { 15034 if err = iprot.Skip(fieldTypeId); err != nil { 15035 goto SkipFieldError 15036 } 15037 } 15038 default: 15039 if err = iprot.Skip(fieldTypeId); err != nil { 15040 goto SkipFieldError 15041 } 15042 } 15043 15044 if err = iprot.ReadFieldEnd(); err != nil { 15045 goto ReadFieldEndError 15046 } 15047 } 15048 if err = iprot.ReadStructEnd(); err != nil { 15049 goto ReadStructEndError 15050 } 15051 15052 return nil 15053 ReadStructBeginError: 15054 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 15055 ReadFieldBeginError: 15056 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 15057 ReadFieldError: 15058 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceNoBodyStructMethodResult[fieldId]), err) 15059 SkipFieldError: 15060 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 15061 15062 ReadFieldEndError: 15063 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 15064 ReadStructEndError: 15065 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 15066 } 15067 15068 func (p *ExampleServiceNoBodyStructMethodResult) ReadField0(iprot thrift.TProtocol) error { 15069 p.Success = NewExampleNoBodyStruct() 15070 if err := p.Success.Read(iprot); err != nil { 15071 return err 15072 } 15073 return nil 15074 } 15075 15076 func (p *ExampleServiceNoBodyStructMethodResult) Write(oprot thrift.TProtocol) (err error) { 15077 var fieldId int16 15078 if err = oprot.WriteStructBegin("NoBodyStructMethod_result"); err != nil { 15079 goto WriteStructBeginError 15080 } 15081 if p != nil { 15082 if err = p.writeField0(oprot); err != nil { 15083 fieldId = 0 15084 goto WriteFieldError 15085 } 15086 15087 } 15088 if err = oprot.WriteFieldStop(); err != nil { 15089 goto WriteFieldStopError 15090 } 15091 if err = oprot.WriteStructEnd(); err != nil { 15092 goto WriteStructEndError 15093 } 15094 return nil 15095 WriteStructBeginError: 15096 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 15097 WriteFieldError: 15098 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 15099 WriteFieldStopError: 15100 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 15101 WriteStructEndError: 15102 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 15103 } 15104 15105 func (p *ExampleServiceNoBodyStructMethodResult) writeField0(oprot thrift.TProtocol) (err error) { 15106 if p.IsSetSuccess() { 15107 if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { 15108 goto WriteFieldBeginError 15109 } 15110 if err := p.Success.Write(oprot); err != nil { 15111 return err 15112 } 15113 if err = oprot.WriteFieldEnd(); err != nil { 15114 goto WriteFieldEndError 15115 } 15116 } 15117 return nil 15118 WriteFieldBeginError: 15119 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 15120 WriteFieldEndError: 15121 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 15122 } 15123 15124 func (p *ExampleServiceNoBodyStructMethodResult) String() string { 15125 if p == nil { 15126 return "<nil>" 15127 } 15128 return fmt.Sprintf("ExampleServiceNoBodyStructMethodResult(%+v)", *p) 15129 } 15130 15131 func (p *ExampleServiceNoBodyStructMethodResult) DeepEqual(ano *ExampleServiceNoBodyStructMethodResult) bool { 15132 if p == ano { 15133 return true 15134 } else if p == nil || ano == nil { 15135 return false 15136 } 15137 if !p.Field0DeepEqual(ano.Success) { 15138 return false 15139 } 15140 return true 15141 } 15142 15143 func (p *ExampleServiceNoBodyStructMethodResult) Field0DeepEqual(src *ExampleNoBodyStruct) bool { 15144 15145 if !p.Success.DeepEqual(src) { 15146 return false 15147 } 15148 return true 15149 } 15150 15151 type ExampleServiceStringArgs struct { 15152 Req string `thrift:"req,1" json:"req"` 15153 } 15154 15155 func NewExampleServiceStringArgs() *ExampleServiceStringArgs { 15156 return &ExampleServiceStringArgs{} 15157 } 15158 15159 func (p *ExampleServiceStringArgs) GetReq() (v string) { 15160 return p.Req 15161 } 15162 func (p *ExampleServiceStringArgs) SetReq(val string) { 15163 p.Req = val 15164 } 15165 15166 var fieldIDToName_ExampleServiceStringArgs = map[int16]string{ 15167 1: "req", 15168 } 15169 15170 func (p *ExampleServiceStringArgs) Read(iprot thrift.TProtocol) (err error) { 15171 15172 var fieldTypeId thrift.TType 15173 var fieldId int16 15174 15175 if _, err = iprot.ReadStructBegin(); err != nil { 15176 goto ReadStructBeginError 15177 } 15178 15179 for { 15180 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 15181 if err != nil { 15182 goto ReadFieldBeginError 15183 } 15184 if fieldTypeId == thrift.STOP { 15185 break 15186 } 15187 15188 switch fieldId { 15189 case 1: 15190 if fieldTypeId == thrift.STRING { 15191 if err = p.ReadField1(iprot); err != nil { 15192 goto ReadFieldError 15193 } 15194 } else { 15195 if err = iprot.Skip(fieldTypeId); err != nil { 15196 goto SkipFieldError 15197 } 15198 } 15199 default: 15200 if err = iprot.Skip(fieldTypeId); err != nil { 15201 goto SkipFieldError 15202 } 15203 } 15204 15205 if err = iprot.ReadFieldEnd(); err != nil { 15206 goto ReadFieldEndError 15207 } 15208 } 15209 if err = iprot.ReadStructEnd(); err != nil { 15210 goto ReadStructEndError 15211 } 15212 15213 return nil 15214 ReadStructBeginError: 15215 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 15216 ReadFieldBeginError: 15217 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 15218 ReadFieldError: 15219 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceStringArgs[fieldId]), err) 15220 SkipFieldError: 15221 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 15222 15223 ReadFieldEndError: 15224 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 15225 ReadStructEndError: 15226 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 15227 } 15228 15229 func (p *ExampleServiceStringArgs) ReadField1(iprot thrift.TProtocol) error { 15230 if v, err := iprot.ReadString(); err != nil { 15231 return err 15232 } else { 15233 p.Req = v 15234 } 15235 return nil 15236 } 15237 15238 func (p *ExampleServiceStringArgs) Write(oprot thrift.TProtocol) (err error) { 15239 var fieldId int16 15240 if err = oprot.WriteStructBegin("String_args"); err != nil { 15241 goto WriteStructBeginError 15242 } 15243 if p != nil { 15244 if err = p.writeField1(oprot); err != nil { 15245 fieldId = 1 15246 goto WriteFieldError 15247 } 15248 15249 } 15250 if err = oprot.WriteFieldStop(); err != nil { 15251 goto WriteFieldStopError 15252 } 15253 if err = oprot.WriteStructEnd(); err != nil { 15254 goto WriteStructEndError 15255 } 15256 return nil 15257 WriteStructBeginError: 15258 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 15259 WriteFieldError: 15260 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 15261 WriteFieldStopError: 15262 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 15263 WriteStructEndError: 15264 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 15265 } 15266 15267 func (p *ExampleServiceStringArgs) writeField1(oprot thrift.TProtocol) (err error) { 15268 if err = oprot.WriteFieldBegin("req", thrift.STRING, 1); err != nil { 15269 goto WriteFieldBeginError 15270 } 15271 if err := oprot.WriteString(p.Req); err != nil { 15272 return err 15273 } 15274 if err = oprot.WriteFieldEnd(); err != nil { 15275 goto WriteFieldEndError 15276 } 15277 return nil 15278 WriteFieldBeginError: 15279 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 15280 WriteFieldEndError: 15281 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 15282 } 15283 15284 func (p *ExampleServiceStringArgs) String() string { 15285 if p == nil { 15286 return "<nil>" 15287 } 15288 return fmt.Sprintf("ExampleServiceStringArgs(%+v)", *p) 15289 } 15290 15291 func (p *ExampleServiceStringArgs) DeepEqual(ano *ExampleServiceStringArgs) bool { 15292 if p == ano { 15293 return true 15294 } else if p == nil || ano == nil { 15295 return false 15296 } 15297 if !p.Field1DeepEqual(ano.Req) { 15298 return false 15299 } 15300 return true 15301 } 15302 15303 func (p *ExampleServiceStringArgs) Field1DeepEqual(src string) bool { 15304 15305 if strings.Compare(p.Req, src) != 0 { 15306 return false 15307 } 15308 return true 15309 } 15310 15311 type ExampleServiceStringResult struct { 15312 Success *string `thrift:"success,0" json:"success,omitempty"` 15313 } 15314 15315 func NewExampleServiceStringResult() *ExampleServiceStringResult { 15316 return &ExampleServiceStringResult{} 15317 } 15318 15319 var ExampleServiceStringResult_Success_DEFAULT string 15320 15321 func (p *ExampleServiceStringResult) GetSuccess() (v string) { 15322 if !p.IsSetSuccess() { 15323 return ExampleServiceStringResult_Success_DEFAULT 15324 } 15325 return *p.Success 15326 } 15327 func (p *ExampleServiceStringResult) SetSuccess(x interface{}) { 15328 p.Success = x.(*string) 15329 } 15330 15331 var fieldIDToName_ExampleServiceStringResult = map[int16]string{ 15332 0: "success", 15333 } 15334 15335 func (p *ExampleServiceStringResult) IsSetSuccess() bool { 15336 return p.Success != nil 15337 } 15338 15339 func (p *ExampleServiceStringResult) Read(iprot thrift.TProtocol) (err error) { 15340 15341 var fieldTypeId thrift.TType 15342 var fieldId int16 15343 15344 if _, err = iprot.ReadStructBegin(); err != nil { 15345 goto ReadStructBeginError 15346 } 15347 15348 for { 15349 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 15350 if err != nil { 15351 goto ReadFieldBeginError 15352 } 15353 if fieldTypeId == thrift.STOP { 15354 break 15355 } 15356 15357 switch fieldId { 15358 case 0: 15359 if fieldTypeId == thrift.STRING { 15360 if err = p.ReadField0(iprot); err != nil { 15361 goto ReadFieldError 15362 } 15363 } else { 15364 if err = iprot.Skip(fieldTypeId); err != nil { 15365 goto SkipFieldError 15366 } 15367 } 15368 default: 15369 if err = iprot.Skip(fieldTypeId); err != nil { 15370 goto SkipFieldError 15371 } 15372 } 15373 15374 if err = iprot.ReadFieldEnd(); err != nil { 15375 goto ReadFieldEndError 15376 } 15377 } 15378 if err = iprot.ReadStructEnd(); err != nil { 15379 goto ReadStructEndError 15380 } 15381 15382 return nil 15383 ReadStructBeginError: 15384 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 15385 ReadFieldBeginError: 15386 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 15387 ReadFieldError: 15388 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceStringResult[fieldId]), err) 15389 SkipFieldError: 15390 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 15391 15392 ReadFieldEndError: 15393 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 15394 ReadStructEndError: 15395 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 15396 } 15397 15398 func (p *ExampleServiceStringResult) ReadField0(iprot thrift.TProtocol) error { 15399 if v, err := iprot.ReadString(); err != nil { 15400 return err 15401 } else { 15402 p.Success = &v 15403 } 15404 return nil 15405 } 15406 15407 func (p *ExampleServiceStringResult) Write(oprot thrift.TProtocol) (err error) { 15408 var fieldId int16 15409 if err = oprot.WriteStructBegin("String_result"); err != nil { 15410 goto WriteStructBeginError 15411 } 15412 if p != nil { 15413 if err = p.writeField0(oprot); err != nil { 15414 fieldId = 0 15415 goto WriteFieldError 15416 } 15417 15418 } 15419 if err = oprot.WriteFieldStop(); err != nil { 15420 goto WriteFieldStopError 15421 } 15422 if err = oprot.WriteStructEnd(); err != nil { 15423 goto WriteStructEndError 15424 } 15425 return nil 15426 WriteStructBeginError: 15427 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 15428 WriteFieldError: 15429 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 15430 WriteFieldStopError: 15431 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 15432 WriteStructEndError: 15433 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 15434 } 15435 15436 func (p *ExampleServiceStringResult) writeField0(oprot thrift.TProtocol) (err error) { 15437 if p.IsSetSuccess() { 15438 if err = oprot.WriteFieldBegin("success", thrift.STRING, 0); err != nil { 15439 goto WriteFieldBeginError 15440 } 15441 if err := oprot.WriteString(*p.Success); err != nil { 15442 return err 15443 } 15444 if err = oprot.WriteFieldEnd(); err != nil { 15445 goto WriteFieldEndError 15446 } 15447 } 15448 return nil 15449 WriteFieldBeginError: 15450 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 15451 WriteFieldEndError: 15452 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 15453 } 15454 15455 func (p *ExampleServiceStringResult) String() string { 15456 if p == nil { 15457 return "<nil>" 15458 } 15459 return fmt.Sprintf("ExampleServiceStringResult(%+v)", *p) 15460 } 15461 15462 func (p *ExampleServiceStringResult) DeepEqual(ano *ExampleServiceStringResult) bool { 15463 if p == ano { 15464 return true 15465 } else if p == nil || ano == nil { 15466 return false 15467 } 15468 if !p.Field0DeepEqual(ano.Success) { 15469 return false 15470 } 15471 return true 15472 } 15473 15474 func (p *ExampleServiceStringResult) Field0DeepEqual(src *string) bool { 15475 15476 if p.Success == src { 15477 return true 15478 } else if p.Success == nil || src == nil { 15479 return false 15480 } 15481 if strings.Compare(*p.Success, *src) != 0 { 15482 return false 15483 } 15484 return true 15485 } 15486 15487 type ExampleServiceI64Args struct { 15488 Req int64 `thrift:"req,1" json:"req"` 15489 } 15490 15491 func NewExampleServiceI64Args() *ExampleServiceI64Args { 15492 return &ExampleServiceI64Args{} 15493 } 15494 15495 func (p *ExampleServiceI64Args) GetReq() (v int64) { 15496 return p.Req 15497 } 15498 func (p *ExampleServiceI64Args) SetReq(val int64) { 15499 p.Req = val 15500 } 15501 15502 var fieldIDToName_ExampleServiceI64Args = map[int16]string{ 15503 1: "req", 15504 } 15505 15506 func (p *ExampleServiceI64Args) Read(iprot thrift.TProtocol) (err error) { 15507 15508 var fieldTypeId thrift.TType 15509 var fieldId int16 15510 15511 if _, err = iprot.ReadStructBegin(); err != nil { 15512 goto ReadStructBeginError 15513 } 15514 15515 for { 15516 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 15517 if err != nil { 15518 goto ReadFieldBeginError 15519 } 15520 if fieldTypeId == thrift.STOP { 15521 break 15522 } 15523 15524 switch fieldId { 15525 case 1: 15526 if fieldTypeId == thrift.I64 { 15527 if err = p.ReadField1(iprot); err != nil { 15528 goto ReadFieldError 15529 } 15530 } else { 15531 if err = iprot.Skip(fieldTypeId); err != nil { 15532 goto SkipFieldError 15533 } 15534 } 15535 default: 15536 if err = iprot.Skip(fieldTypeId); err != nil { 15537 goto SkipFieldError 15538 } 15539 } 15540 15541 if err = iprot.ReadFieldEnd(); err != nil { 15542 goto ReadFieldEndError 15543 } 15544 } 15545 if err = iprot.ReadStructEnd(); err != nil { 15546 goto ReadStructEndError 15547 } 15548 15549 return nil 15550 ReadStructBeginError: 15551 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 15552 ReadFieldBeginError: 15553 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 15554 ReadFieldError: 15555 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceI64Args[fieldId]), err) 15556 SkipFieldError: 15557 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 15558 15559 ReadFieldEndError: 15560 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 15561 ReadStructEndError: 15562 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 15563 } 15564 15565 func (p *ExampleServiceI64Args) ReadField1(iprot thrift.TProtocol) error { 15566 if v, err := iprot.ReadI64(); err != nil { 15567 return err 15568 } else { 15569 p.Req = v 15570 } 15571 return nil 15572 } 15573 15574 func (p *ExampleServiceI64Args) Write(oprot thrift.TProtocol) (err error) { 15575 var fieldId int16 15576 if err = oprot.WriteStructBegin("I64_args"); err != nil { 15577 goto WriteStructBeginError 15578 } 15579 if p != nil { 15580 if err = p.writeField1(oprot); err != nil { 15581 fieldId = 1 15582 goto WriteFieldError 15583 } 15584 15585 } 15586 if err = oprot.WriteFieldStop(); err != nil { 15587 goto WriteFieldStopError 15588 } 15589 if err = oprot.WriteStructEnd(); err != nil { 15590 goto WriteStructEndError 15591 } 15592 return nil 15593 WriteStructBeginError: 15594 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 15595 WriteFieldError: 15596 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 15597 WriteFieldStopError: 15598 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 15599 WriteStructEndError: 15600 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 15601 } 15602 15603 func (p *ExampleServiceI64Args) writeField1(oprot thrift.TProtocol) (err error) { 15604 if err = oprot.WriteFieldBegin("req", thrift.I64, 1); err != nil { 15605 goto WriteFieldBeginError 15606 } 15607 if err := oprot.WriteI64(p.Req); err != nil { 15608 return err 15609 } 15610 if err = oprot.WriteFieldEnd(); err != nil { 15611 goto WriteFieldEndError 15612 } 15613 return nil 15614 WriteFieldBeginError: 15615 return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) 15616 WriteFieldEndError: 15617 return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) 15618 } 15619 15620 func (p *ExampleServiceI64Args) String() string { 15621 if p == nil { 15622 return "<nil>" 15623 } 15624 return fmt.Sprintf("ExampleServiceI64Args(%+v)", *p) 15625 } 15626 15627 func (p *ExampleServiceI64Args) DeepEqual(ano *ExampleServiceI64Args) bool { 15628 if p == ano { 15629 return true 15630 } else if p == nil || ano == nil { 15631 return false 15632 } 15633 if !p.Field1DeepEqual(ano.Req) { 15634 return false 15635 } 15636 return true 15637 } 15638 15639 func (p *ExampleServiceI64Args) Field1DeepEqual(src int64) bool { 15640 15641 if p.Req != src { 15642 return false 15643 } 15644 return true 15645 } 15646 15647 type ExampleServiceI64Result struct { 15648 Success *int64 `thrift:"success,0" json:"success,omitempty"` 15649 } 15650 15651 func NewExampleServiceI64Result() *ExampleServiceI64Result { 15652 return &ExampleServiceI64Result{} 15653 } 15654 15655 var ExampleServiceI64Result_Success_DEFAULT int64 15656 15657 func (p *ExampleServiceI64Result) GetSuccess() (v int64) { 15658 if !p.IsSetSuccess() { 15659 return ExampleServiceI64Result_Success_DEFAULT 15660 } 15661 return *p.Success 15662 } 15663 func (p *ExampleServiceI64Result) SetSuccess(x interface{}) { 15664 p.Success = x.(*int64) 15665 } 15666 15667 var fieldIDToName_ExampleServiceI64Result = map[int16]string{ 15668 0: "success", 15669 } 15670 15671 func (p *ExampleServiceI64Result) IsSetSuccess() bool { 15672 return p.Success != nil 15673 } 15674 15675 func (p *ExampleServiceI64Result) Read(iprot thrift.TProtocol) (err error) { 15676 15677 var fieldTypeId thrift.TType 15678 var fieldId int16 15679 15680 if _, err = iprot.ReadStructBegin(); err != nil { 15681 goto ReadStructBeginError 15682 } 15683 15684 for { 15685 _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() 15686 if err != nil { 15687 goto ReadFieldBeginError 15688 } 15689 if fieldTypeId == thrift.STOP { 15690 break 15691 } 15692 15693 switch fieldId { 15694 case 0: 15695 if fieldTypeId == thrift.I64 { 15696 if err = p.ReadField0(iprot); err != nil { 15697 goto ReadFieldError 15698 } 15699 } else { 15700 if err = iprot.Skip(fieldTypeId); err != nil { 15701 goto SkipFieldError 15702 } 15703 } 15704 default: 15705 if err = iprot.Skip(fieldTypeId); err != nil { 15706 goto SkipFieldError 15707 } 15708 } 15709 15710 if err = iprot.ReadFieldEnd(); err != nil { 15711 goto ReadFieldEndError 15712 } 15713 } 15714 if err = iprot.ReadStructEnd(); err != nil { 15715 goto ReadStructEndError 15716 } 15717 15718 return nil 15719 ReadStructBeginError: 15720 return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) 15721 ReadFieldBeginError: 15722 return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) 15723 ReadFieldError: 15724 return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ExampleServiceI64Result[fieldId]), err) 15725 SkipFieldError: 15726 return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) 15727 15728 ReadFieldEndError: 15729 return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) 15730 ReadStructEndError: 15731 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) 15732 } 15733 15734 func (p *ExampleServiceI64Result) ReadField0(iprot thrift.TProtocol) error { 15735 if v, err := iprot.ReadI64(); err != nil { 15736 return err 15737 } else { 15738 p.Success = &v 15739 } 15740 return nil 15741 } 15742 15743 func (p *ExampleServiceI64Result) Write(oprot thrift.TProtocol) (err error) { 15744 var fieldId int16 15745 if err = oprot.WriteStructBegin("I64_result"); err != nil { 15746 goto WriteStructBeginError 15747 } 15748 if p != nil { 15749 if err = p.writeField0(oprot); err != nil { 15750 fieldId = 0 15751 goto WriteFieldError 15752 } 15753 15754 } 15755 if err = oprot.WriteFieldStop(); err != nil { 15756 goto WriteFieldStopError 15757 } 15758 if err = oprot.WriteStructEnd(); err != nil { 15759 goto WriteStructEndError 15760 } 15761 return nil 15762 WriteStructBeginError: 15763 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) 15764 WriteFieldError: 15765 return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) 15766 WriteFieldStopError: 15767 return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) 15768 WriteStructEndError: 15769 return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) 15770 } 15771 15772 func (p *ExampleServiceI64Result) writeField0(oprot thrift.TProtocol) (err error) { 15773 if p.IsSetSuccess() { 15774 if err = oprot.WriteFieldBegin("success", thrift.I64, 0); err != nil { 15775 goto WriteFieldBeginError 15776 } 15777 if err := oprot.WriteI64(*p.Success); err != nil { 15778 return err 15779 } 15780 if err = oprot.WriteFieldEnd(); err != nil { 15781 goto WriteFieldEndError 15782 } 15783 } 15784 return nil 15785 WriteFieldBeginError: 15786 return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) 15787 WriteFieldEndError: 15788 return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) 15789 } 15790 15791 func (p *ExampleServiceI64Result) String() string { 15792 if p == nil { 15793 return "<nil>" 15794 } 15795 return fmt.Sprintf("ExampleServiceI64Result(%+v)", *p) 15796 } 15797 15798 func (p *ExampleServiceI64Result) DeepEqual(ano *ExampleServiceI64Result) bool { 15799 if p == ano { 15800 return true 15801 } else if p == nil || ano == nil { 15802 return false 15803 } 15804 if !p.Field0DeepEqual(ano.Success) { 15805 return false 15806 } 15807 return true 15808 } 15809 15810 func (p *ExampleServiceI64Result) Field0DeepEqual(src *int64) bool { 15811 15812 if p.Success == src { 15813 return true 15814 } else if p.Success == nil || src == nil { 15815 return false 15816 } 15817 if *p.Success != *src { 15818 return false 15819 } 15820 return true 15821 }