github.com/cloudwego/dynamicgo@v0.2.6-0.20240519101509-707f41b6b834/testdata/kitex_gen/example/example.go (about)

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