go.uber.org/yarpc@v1.72.1/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/common/common.go (about)

     1  // Code generated by thriftrw v1.29.2. DO NOT EDIT.
     2  // @generated
     3  
     4  package common
     5  
     6  import (
     7  	errors "errors"
     8  	fmt "fmt"
     9  	stream "go.uber.org/thriftrw/protocol/stream"
    10  	thriftreflect "go.uber.org/thriftrw/thriftreflect"
    11  	wire "go.uber.org/thriftrw/wire"
    12  	zapcore "go.uber.org/zap/zapcore"
    13  	strings "strings"
    14  )
    15  
    16  // ThriftModule represents the IDL file used to generate this package.
    17  var ThriftModule = &thriftreflect.ThriftModule{
    18  	Name:     "common",
    19  	Package:  "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/common",
    20  	FilePath: "common.thrift",
    21  	SHA1:     "1bd2b34a2289d2767d66eff00fa74778a14a625f",
    22  	Raw:      rawIDL,
    23  }
    24  
    25  const rawIDL = "service EmptyService {}\n\nservice ExtendEmpty extends EmptyService {\n    void hello()\n}\n\nservice BaseService {\n    bool healthy()\n}\n\nservice ExtendOnly extends BaseService {\n    // A service without any functions except inherited ones\n}\n"
    26  
    27  // BaseService_Healthy_Args represents the arguments for the BaseService.healthy function.
    28  //
    29  // The arguments for healthy are sent and received over the wire as this struct.
    30  type BaseService_Healthy_Args struct {
    31  }
    32  
    33  // ToWire translates a BaseService_Healthy_Args struct into a Thrift-level intermediate
    34  // representation. This intermediate representation may be serialized
    35  // into bytes using a ThriftRW protocol implementation.
    36  //
    37  // An error is returned if the struct or any of its fields failed to
    38  // validate.
    39  //
    40  //   x, err := v.ToWire()
    41  //   if err != nil {
    42  //     return err
    43  //   }
    44  //
    45  //   if err := binaryProtocol.Encode(x, writer); err != nil {
    46  //     return err
    47  //   }
    48  func (v *BaseService_Healthy_Args) ToWire() (wire.Value, error) {
    49  	var (
    50  		fields [0]wire.Field
    51  		i      int = 0
    52  	)
    53  
    54  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
    55  }
    56  
    57  // FromWire deserializes a BaseService_Healthy_Args struct from its Thrift-level
    58  // representation. The Thrift-level representation may be obtained
    59  // from a ThriftRW protocol implementation.
    60  //
    61  // An error is returned if we were unable to build a BaseService_Healthy_Args struct
    62  // from the provided intermediate representation.
    63  //
    64  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
    65  //   if err != nil {
    66  //     return nil, err
    67  //   }
    68  //
    69  //   var v BaseService_Healthy_Args
    70  //   if err := v.FromWire(x); err != nil {
    71  //     return nil, err
    72  //   }
    73  //   return &v, nil
    74  func (v *BaseService_Healthy_Args) FromWire(w wire.Value) error {
    75  
    76  	for _, field := range w.GetStruct().Fields {
    77  		switch field.ID {
    78  		}
    79  	}
    80  
    81  	return nil
    82  }
    83  
    84  // Encode serializes a BaseService_Healthy_Args struct directly into bytes, without going
    85  // through an intermediary type.
    86  //
    87  // An error is returned if a BaseService_Healthy_Args struct could not be encoded.
    88  func (v *BaseService_Healthy_Args) Encode(sw stream.Writer) error {
    89  	if err := sw.WriteStructBegin(); err != nil {
    90  		return err
    91  	}
    92  
    93  	return sw.WriteStructEnd()
    94  }
    95  
    96  // Decode deserializes a BaseService_Healthy_Args struct directly from its Thrift-level
    97  // representation, without going through an intemediary type.
    98  //
    99  // An error is returned if a BaseService_Healthy_Args struct could not be generated from the wire
   100  // representation.
   101  func (v *BaseService_Healthy_Args) Decode(sr stream.Reader) error {
   102  
   103  	if err := sr.ReadStructBegin(); err != nil {
   104  		return err
   105  	}
   106  
   107  	fh, ok, err := sr.ReadFieldBegin()
   108  	if err != nil {
   109  		return err
   110  	}
   111  
   112  	for ok {
   113  		switch {
   114  		default:
   115  			if err := sr.Skip(fh.Type); err != nil {
   116  				return err
   117  			}
   118  		}
   119  
   120  		if err := sr.ReadFieldEnd(); err != nil {
   121  			return err
   122  		}
   123  
   124  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
   125  			return err
   126  		}
   127  	}
   128  
   129  	if err := sr.ReadStructEnd(); err != nil {
   130  		return err
   131  	}
   132  
   133  	return nil
   134  }
   135  
   136  // String returns a readable string representation of a BaseService_Healthy_Args
   137  // struct.
   138  func (v *BaseService_Healthy_Args) String() string {
   139  	if v == nil {
   140  		return "<nil>"
   141  	}
   142  
   143  	var fields [0]string
   144  	i := 0
   145  
   146  	return fmt.Sprintf("BaseService_Healthy_Args{%v}", strings.Join(fields[:i], ", "))
   147  }
   148  
   149  // Equals returns true if all the fields of this BaseService_Healthy_Args match the
   150  // provided BaseService_Healthy_Args.
   151  //
   152  // This function performs a deep comparison.
   153  func (v *BaseService_Healthy_Args) Equals(rhs *BaseService_Healthy_Args) bool {
   154  	if v == nil {
   155  		return rhs == nil
   156  	} else if rhs == nil {
   157  		return false
   158  	}
   159  
   160  	return true
   161  }
   162  
   163  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
   164  // fast logging of BaseService_Healthy_Args.
   165  func (v *BaseService_Healthy_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
   166  	if v == nil {
   167  		return nil
   168  	}
   169  	return err
   170  }
   171  
   172  // MethodName returns the name of the Thrift function as specified in
   173  // the IDL, for which this struct represent the arguments.
   174  //
   175  // This will always be "healthy" for this struct.
   176  func (v *BaseService_Healthy_Args) MethodName() string {
   177  	return "healthy"
   178  }
   179  
   180  // EnvelopeType returns the kind of value inside this struct.
   181  //
   182  // This will always be Call for this struct.
   183  func (v *BaseService_Healthy_Args) EnvelopeType() wire.EnvelopeType {
   184  	return wire.Call
   185  }
   186  
   187  // BaseService_Healthy_Helper provides functions that aid in handling the
   188  // parameters and return values of the BaseService.healthy
   189  // function.
   190  var BaseService_Healthy_Helper = struct {
   191  	// Args accepts the parameters of healthy in-order and returns
   192  	// the arguments struct for the function.
   193  	Args func() *BaseService_Healthy_Args
   194  
   195  	// IsException returns true if the given error can be thrown
   196  	// by healthy.
   197  	//
   198  	// An error can be thrown by healthy only if the
   199  	// corresponding exception type was mentioned in the 'throws'
   200  	// section for it in the Thrift file.
   201  	IsException func(error) bool
   202  
   203  	// WrapResponse returns the result struct for healthy
   204  	// given its return value and error.
   205  	//
   206  	// This allows mapping values and errors returned by
   207  	// healthy into a serializable result struct.
   208  	// WrapResponse returns a non-nil error if the provided
   209  	// error cannot be thrown by healthy
   210  	//
   211  	//   value, err := healthy(args)
   212  	//   result, err := BaseService_Healthy_Helper.WrapResponse(value, err)
   213  	//   if err != nil {
   214  	//     return fmt.Errorf("unexpected error from healthy: %v", err)
   215  	//   }
   216  	//   serialize(result)
   217  	WrapResponse func(bool, error) (*BaseService_Healthy_Result, error)
   218  
   219  	// UnwrapResponse takes the result struct for healthy
   220  	// and returns the value or error returned by it.
   221  	//
   222  	// The error is non-nil only if healthy threw an
   223  	// exception.
   224  	//
   225  	//   result := deserialize(bytes)
   226  	//   value, err := BaseService_Healthy_Helper.UnwrapResponse(result)
   227  	UnwrapResponse func(*BaseService_Healthy_Result) (bool, error)
   228  }{}
   229  
   230  func init() {
   231  	BaseService_Healthy_Helper.Args = func() *BaseService_Healthy_Args {
   232  		return &BaseService_Healthy_Args{}
   233  	}
   234  
   235  	BaseService_Healthy_Helper.IsException = func(err error) bool {
   236  		switch err.(type) {
   237  		default:
   238  			return false
   239  		}
   240  	}
   241  
   242  	BaseService_Healthy_Helper.WrapResponse = func(success bool, err error) (*BaseService_Healthy_Result, error) {
   243  		if err == nil {
   244  			return &BaseService_Healthy_Result{Success: &success}, nil
   245  		}
   246  
   247  		return nil, err
   248  	}
   249  	BaseService_Healthy_Helper.UnwrapResponse = func(result *BaseService_Healthy_Result) (success bool, err error) {
   250  
   251  		if result.Success != nil {
   252  			success = *result.Success
   253  			return
   254  		}
   255  
   256  		err = errors.New("expected a non-void result")
   257  		return
   258  	}
   259  
   260  }
   261  
   262  // BaseService_Healthy_Result represents the result of a BaseService.healthy function call.
   263  //
   264  // The result of a healthy execution is sent and received over the wire as this struct.
   265  //
   266  // Success is set only if the function did not throw an exception.
   267  type BaseService_Healthy_Result struct {
   268  	// Value returned by healthy after a successful execution.
   269  	Success *bool `json:"success,omitempty"`
   270  }
   271  
   272  // ToWire translates a BaseService_Healthy_Result struct into a Thrift-level intermediate
   273  // representation. This intermediate representation may be serialized
   274  // into bytes using a ThriftRW protocol implementation.
   275  //
   276  // An error is returned if the struct or any of its fields failed to
   277  // validate.
   278  //
   279  //   x, err := v.ToWire()
   280  //   if err != nil {
   281  //     return err
   282  //   }
   283  //
   284  //   if err := binaryProtocol.Encode(x, writer); err != nil {
   285  //     return err
   286  //   }
   287  func (v *BaseService_Healthy_Result) ToWire() (wire.Value, error) {
   288  	var (
   289  		fields [1]wire.Field
   290  		i      int = 0
   291  		w      wire.Value
   292  		err    error
   293  	)
   294  
   295  	if v.Success != nil {
   296  		w, err = wire.NewValueBool(*(v.Success)), error(nil)
   297  		if err != nil {
   298  			return w, err
   299  		}
   300  		fields[i] = wire.Field{ID: 0, Value: w}
   301  		i++
   302  	}
   303  
   304  	if i != 1 {
   305  		return wire.Value{}, fmt.Errorf("BaseService_Healthy_Result should have exactly one field: got %v fields", i)
   306  	}
   307  
   308  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
   309  }
   310  
   311  // FromWire deserializes a BaseService_Healthy_Result struct from its Thrift-level
   312  // representation. The Thrift-level representation may be obtained
   313  // from a ThriftRW protocol implementation.
   314  //
   315  // An error is returned if we were unable to build a BaseService_Healthy_Result struct
   316  // from the provided intermediate representation.
   317  //
   318  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
   319  //   if err != nil {
   320  //     return nil, err
   321  //   }
   322  //
   323  //   var v BaseService_Healthy_Result
   324  //   if err := v.FromWire(x); err != nil {
   325  //     return nil, err
   326  //   }
   327  //   return &v, nil
   328  func (v *BaseService_Healthy_Result) FromWire(w wire.Value) error {
   329  	var err error
   330  
   331  	for _, field := range w.GetStruct().Fields {
   332  		switch field.ID {
   333  		case 0:
   334  			if field.Value.Type() == wire.TBool {
   335  				var x bool
   336  				x, err = field.Value.GetBool(), error(nil)
   337  				v.Success = &x
   338  				if err != nil {
   339  					return err
   340  				}
   341  
   342  			}
   343  		}
   344  	}
   345  
   346  	count := 0
   347  	if v.Success != nil {
   348  		count++
   349  	}
   350  	if count != 1 {
   351  		return fmt.Errorf("BaseService_Healthy_Result should have exactly one field: got %v fields", count)
   352  	}
   353  
   354  	return nil
   355  }
   356  
   357  // Encode serializes a BaseService_Healthy_Result struct directly into bytes, without going
   358  // through an intermediary type.
   359  //
   360  // An error is returned if a BaseService_Healthy_Result struct could not be encoded.
   361  func (v *BaseService_Healthy_Result) Encode(sw stream.Writer) error {
   362  	if err := sw.WriteStructBegin(); err != nil {
   363  		return err
   364  	}
   365  
   366  	if v.Success != nil {
   367  		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TBool}); err != nil {
   368  			return err
   369  		}
   370  		if err := sw.WriteBool(*(v.Success)); err != nil {
   371  			return err
   372  		}
   373  		if err := sw.WriteFieldEnd(); err != nil {
   374  			return err
   375  		}
   376  	}
   377  
   378  	count := 0
   379  	if v.Success != nil {
   380  		count++
   381  	}
   382  
   383  	if count != 1 {
   384  		return fmt.Errorf("BaseService_Healthy_Result should have exactly one field: got %v fields", count)
   385  	}
   386  
   387  	return sw.WriteStructEnd()
   388  }
   389  
   390  // Decode deserializes a BaseService_Healthy_Result struct directly from its Thrift-level
   391  // representation, without going through an intemediary type.
   392  //
   393  // An error is returned if a BaseService_Healthy_Result struct could not be generated from the wire
   394  // representation.
   395  func (v *BaseService_Healthy_Result) Decode(sr stream.Reader) error {
   396  
   397  	if err := sr.ReadStructBegin(); err != nil {
   398  		return err
   399  	}
   400  
   401  	fh, ok, err := sr.ReadFieldBegin()
   402  	if err != nil {
   403  		return err
   404  	}
   405  
   406  	for ok {
   407  		switch {
   408  		case fh.ID == 0 && fh.Type == wire.TBool:
   409  			var x bool
   410  			x, err = sr.ReadBool()
   411  			v.Success = &x
   412  			if err != nil {
   413  				return err
   414  			}
   415  
   416  		default:
   417  			if err := sr.Skip(fh.Type); err != nil {
   418  				return err
   419  			}
   420  		}
   421  
   422  		if err := sr.ReadFieldEnd(); err != nil {
   423  			return err
   424  		}
   425  
   426  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
   427  			return err
   428  		}
   429  	}
   430  
   431  	if err := sr.ReadStructEnd(); err != nil {
   432  		return err
   433  	}
   434  
   435  	count := 0
   436  	if v.Success != nil {
   437  		count++
   438  	}
   439  	if count != 1 {
   440  		return fmt.Errorf("BaseService_Healthy_Result should have exactly one field: got %v fields", count)
   441  	}
   442  
   443  	return nil
   444  }
   445  
   446  // String returns a readable string representation of a BaseService_Healthy_Result
   447  // struct.
   448  func (v *BaseService_Healthy_Result) String() string {
   449  	if v == nil {
   450  		return "<nil>"
   451  	}
   452  
   453  	var fields [1]string
   454  	i := 0
   455  	if v.Success != nil {
   456  		fields[i] = fmt.Sprintf("Success: %v", *(v.Success))
   457  		i++
   458  	}
   459  
   460  	return fmt.Sprintf("BaseService_Healthy_Result{%v}", strings.Join(fields[:i], ", "))
   461  }
   462  
   463  func _Bool_EqualsPtr(lhs, rhs *bool) bool {
   464  	if lhs != nil && rhs != nil {
   465  
   466  		x := *lhs
   467  		y := *rhs
   468  		return (x == y)
   469  	}
   470  	return lhs == nil && rhs == nil
   471  }
   472  
   473  // Equals returns true if all the fields of this BaseService_Healthy_Result match the
   474  // provided BaseService_Healthy_Result.
   475  //
   476  // This function performs a deep comparison.
   477  func (v *BaseService_Healthy_Result) Equals(rhs *BaseService_Healthy_Result) bool {
   478  	if v == nil {
   479  		return rhs == nil
   480  	} else if rhs == nil {
   481  		return false
   482  	}
   483  	if !_Bool_EqualsPtr(v.Success, rhs.Success) {
   484  		return false
   485  	}
   486  
   487  	return true
   488  }
   489  
   490  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
   491  // fast logging of BaseService_Healthy_Result.
   492  func (v *BaseService_Healthy_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
   493  	if v == nil {
   494  		return nil
   495  	}
   496  	if v.Success != nil {
   497  		enc.AddBool("success", *v.Success)
   498  	}
   499  	return err
   500  }
   501  
   502  // GetSuccess returns the value of Success if it is set or its
   503  // zero value if it is unset.
   504  func (v *BaseService_Healthy_Result) GetSuccess() (o bool) {
   505  	if v != nil && v.Success != nil {
   506  		return *v.Success
   507  	}
   508  
   509  	return
   510  }
   511  
   512  // IsSetSuccess returns true if Success is not nil.
   513  func (v *BaseService_Healthy_Result) IsSetSuccess() bool {
   514  	return v != nil && v.Success != nil
   515  }
   516  
   517  // MethodName returns the name of the Thrift function as specified in
   518  // the IDL, for which this struct represent the result.
   519  //
   520  // This will always be "healthy" for this struct.
   521  func (v *BaseService_Healthy_Result) MethodName() string {
   522  	return "healthy"
   523  }
   524  
   525  // EnvelopeType returns the kind of value inside this struct.
   526  //
   527  // This will always be Reply for this struct.
   528  func (v *BaseService_Healthy_Result) EnvelopeType() wire.EnvelopeType {
   529  	return wire.Reply
   530  }
   531  
   532  // ExtendEmpty_Hello_Args represents the arguments for the ExtendEmpty.hello function.
   533  //
   534  // The arguments for hello are sent and received over the wire as this struct.
   535  type ExtendEmpty_Hello_Args struct {
   536  }
   537  
   538  // ToWire translates a ExtendEmpty_Hello_Args struct into a Thrift-level intermediate
   539  // representation. This intermediate representation may be serialized
   540  // into bytes using a ThriftRW protocol implementation.
   541  //
   542  // An error is returned if the struct or any of its fields failed to
   543  // validate.
   544  //
   545  //   x, err := v.ToWire()
   546  //   if err != nil {
   547  //     return err
   548  //   }
   549  //
   550  //   if err := binaryProtocol.Encode(x, writer); err != nil {
   551  //     return err
   552  //   }
   553  func (v *ExtendEmpty_Hello_Args) ToWire() (wire.Value, error) {
   554  	var (
   555  		fields [0]wire.Field
   556  		i      int = 0
   557  	)
   558  
   559  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
   560  }
   561  
   562  // FromWire deserializes a ExtendEmpty_Hello_Args struct from its Thrift-level
   563  // representation. The Thrift-level representation may be obtained
   564  // from a ThriftRW protocol implementation.
   565  //
   566  // An error is returned if we were unable to build a ExtendEmpty_Hello_Args struct
   567  // from the provided intermediate representation.
   568  //
   569  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
   570  //   if err != nil {
   571  //     return nil, err
   572  //   }
   573  //
   574  //   var v ExtendEmpty_Hello_Args
   575  //   if err := v.FromWire(x); err != nil {
   576  //     return nil, err
   577  //   }
   578  //   return &v, nil
   579  func (v *ExtendEmpty_Hello_Args) FromWire(w wire.Value) error {
   580  
   581  	for _, field := range w.GetStruct().Fields {
   582  		switch field.ID {
   583  		}
   584  	}
   585  
   586  	return nil
   587  }
   588  
   589  // Encode serializes a ExtendEmpty_Hello_Args struct directly into bytes, without going
   590  // through an intermediary type.
   591  //
   592  // An error is returned if a ExtendEmpty_Hello_Args struct could not be encoded.
   593  func (v *ExtendEmpty_Hello_Args) Encode(sw stream.Writer) error {
   594  	if err := sw.WriteStructBegin(); err != nil {
   595  		return err
   596  	}
   597  
   598  	return sw.WriteStructEnd()
   599  }
   600  
   601  // Decode deserializes a ExtendEmpty_Hello_Args struct directly from its Thrift-level
   602  // representation, without going through an intemediary type.
   603  //
   604  // An error is returned if a ExtendEmpty_Hello_Args struct could not be generated from the wire
   605  // representation.
   606  func (v *ExtendEmpty_Hello_Args) Decode(sr stream.Reader) error {
   607  
   608  	if err := sr.ReadStructBegin(); err != nil {
   609  		return err
   610  	}
   611  
   612  	fh, ok, err := sr.ReadFieldBegin()
   613  	if err != nil {
   614  		return err
   615  	}
   616  
   617  	for ok {
   618  		switch {
   619  		default:
   620  			if err := sr.Skip(fh.Type); err != nil {
   621  				return err
   622  			}
   623  		}
   624  
   625  		if err := sr.ReadFieldEnd(); err != nil {
   626  			return err
   627  		}
   628  
   629  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
   630  			return err
   631  		}
   632  	}
   633  
   634  	if err := sr.ReadStructEnd(); err != nil {
   635  		return err
   636  	}
   637  
   638  	return nil
   639  }
   640  
   641  // String returns a readable string representation of a ExtendEmpty_Hello_Args
   642  // struct.
   643  func (v *ExtendEmpty_Hello_Args) String() string {
   644  	if v == nil {
   645  		return "<nil>"
   646  	}
   647  
   648  	var fields [0]string
   649  	i := 0
   650  
   651  	return fmt.Sprintf("ExtendEmpty_Hello_Args{%v}", strings.Join(fields[:i], ", "))
   652  }
   653  
   654  // Equals returns true if all the fields of this ExtendEmpty_Hello_Args match the
   655  // provided ExtendEmpty_Hello_Args.
   656  //
   657  // This function performs a deep comparison.
   658  func (v *ExtendEmpty_Hello_Args) Equals(rhs *ExtendEmpty_Hello_Args) bool {
   659  	if v == nil {
   660  		return rhs == nil
   661  	} else if rhs == nil {
   662  		return false
   663  	}
   664  
   665  	return true
   666  }
   667  
   668  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
   669  // fast logging of ExtendEmpty_Hello_Args.
   670  func (v *ExtendEmpty_Hello_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
   671  	if v == nil {
   672  		return nil
   673  	}
   674  	return err
   675  }
   676  
   677  // MethodName returns the name of the Thrift function as specified in
   678  // the IDL, for which this struct represent the arguments.
   679  //
   680  // This will always be "hello" for this struct.
   681  func (v *ExtendEmpty_Hello_Args) MethodName() string {
   682  	return "hello"
   683  }
   684  
   685  // EnvelopeType returns the kind of value inside this struct.
   686  //
   687  // This will always be Call for this struct.
   688  func (v *ExtendEmpty_Hello_Args) EnvelopeType() wire.EnvelopeType {
   689  	return wire.Call
   690  }
   691  
   692  // ExtendEmpty_Hello_Helper provides functions that aid in handling the
   693  // parameters and return values of the ExtendEmpty.hello
   694  // function.
   695  var ExtendEmpty_Hello_Helper = struct {
   696  	// Args accepts the parameters of hello in-order and returns
   697  	// the arguments struct for the function.
   698  	Args func() *ExtendEmpty_Hello_Args
   699  
   700  	// IsException returns true if the given error can be thrown
   701  	// by hello.
   702  	//
   703  	// An error can be thrown by hello only if the
   704  	// corresponding exception type was mentioned in the 'throws'
   705  	// section for it in the Thrift file.
   706  	IsException func(error) bool
   707  
   708  	// WrapResponse returns the result struct for hello
   709  	// given the error returned by it. The provided error may
   710  	// be nil if hello did not fail.
   711  	//
   712  	// This allows mapping errors returned by hello into a
   713  	// serializable result struct. WrapResponse returns a
   714  	// non-nil error if the provided error cannot be thrown by
   715  	// hello
   716  	//
   717  	//   err := hello(args)
   718  	//   result, err := ExtendEmpty_Hello_Helper.WrapResponse(err)
   719  	//   if err != nil {
   720  	//     return fmt.Errorf("unexpected error from hello: %v", err)
   721  	//   }
   722  	//   serialize(result)
   723  	WrapResponse func(error) (*ExtendEmpty_Hello_Result, error)
   724  
   725  	// UnwrapResponse takes the result struct for hello
   726  	// and returns the erorr returned by it (if any).
   727  	//
   728  	// The error is non-nil only if hello threw an
   729  	// exception.
   730  	//
   731  	//   result := deserialize(bytes)
   732  	//   err := ExtendEmpty_Hello_Helper.UnwrapResponse(result)
   733  	UnwrapResponse func(*ExtendEmpty_Hello_Result) error
   734  }{}
   735  
   736  func init() {
   737  	ExtendEmpty_Hello_Helper.Args = func() *ExtendEmpty_Hello_Args {
   738  		return &ExtendEmpty_Hello_Args{}
   739  	}
   740  
   741  	ExtendEmpty_Hello_Helper.IsException = func(err error) bool {
   742  		switch err.(type) {
   743  		default:
   744  			return false
   745  		}
   746  	}
   747  
   748  	ExtendEmpty_Hello_Helper.WrapResponse = func(err error) (*ExtendEmpty_Hello_Result, error) {
   749  		if err == nil {
   750  			return &ExtendEmpty_Hello_Result{}, nil
   751  		}
   752  
   753  		return nil, err
   754  	}
   755  	ExtendEmpty_Hello_Helper.UnwrapResponse = func(result *ExtendEmpty_Hello_Result) (err error) {
   756  		return
   757  	}
   758  
   759  }
   760  
   761  // ExtendEmpty_Hello_Result represents the result of a ExtendEmpty.hello function call.
   762  //
   763  // The result of a hello execution is sent and received over the wire as this struct.
   764  type ExtendEmpty_Hello_Result struct {
   765  }
   766  
   767  // ToWire translates a ExtendEmpty_Hello_Result struct into a Thrift-level intermediate
   768  // representation. This intermediate representation may be serialized
   769  // into bytes using a ThriftRW protocol implementation.
   770  //
   771  // An error is returned if the struct or any of its fields failed to
   772  // validate.
   773  //
   774  //   x, err := v.ToWire()
   775  //   if err != nil {
   776  //     return err
   777  //   }
   778  //
   779  //   if err := binaryProtocol.Encode(x, writer); err != nil {
   780  //     return err
   781  //   }
   782  func (v *ExtendEmpty_Hello_Result) ToWire() (wire.Value, error) {
   783  	var (
   784  		fields [0]wire.Field
   785  		i      int = 0
   786  	)
   787  
   788  	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
   789  }
   790  
   791  // FromWire deserializes a ExtendEmpty_Hello_Result struct from its Thrift-level
   792  // representation. The Thrift-level representation may be obtained
   793  // from a ThriftRW protocol implementation.
   794  //
   795  // An error is returned if we were unable to build a ExtendEmpty_Hello_Result struct
   796  // from the provided intermediate representation.
   797  //
   798  //   x, err := binaryProtocol.Decode(reader, wire.TStruct)
   799  //   if err != nil {
   800  //     return nil, err
   801  //   }
   802  //
   803  //   var v ExtendEmpty_Hello_Result
   804  //   if err := v.FromWire(x); err != nil {
   805  //     return nil, err
   806  //   }
   807  //   return &v, nil
   808  func (v *ExtendEmpty_Hello_Result) FromWire(w wire.Value) error {
   809  
   810  	for _, field := range w.GetStruct().Fields {
   811  		switch field.ID {
   812  		}
   813  	}
   814  
   815  	return nil
   816  }
   817  
   818  // Encode serializes a ExtendEmpty_Hello_Result struct directly into bytes, without going
   819  // through an intermediary type.
   820  //
   821  // An error is returned if a ExtendEmpty_Hello_Result struct could not be encoded.
   822  func (v *ExtendEmpty_Hello_Result) Encode(sw stream.Writer) error {
   823  	if err := sw.WriteStructBegin(); err != nil {
   824  		return err
   825  	}
   826  
   827  	return sw.WriteStructEnd()
   828  }
   829  
   830  // Decode deserializes a ExtendEmpty_Hello_Result struct directly from its Thrift-level
   831  // representation, without going through an intemediary type.
   832  //
   833  // An error is returned if a ExtendEmpty_Hello_Result struct could not be generated from the wire
   834  // representation.
   835  func (v *ExtendEmpty_Hello_Result) Decode(sr stream.Reader) error {
   836  
   837  	if err := sr.ReadStructBegin(); err != nil {
   838  		return err
   839  	}
   840  
   841  	fh, ok, err := sr.ReadFieldBegin()
   842  	if err != nil {
   843  		return err
   844  	}
   845  
   846  	for ok {
   847  		switch {
   848  		default:
   849  			if err := sr.Skip(fh.Type); err != nil {
   850  				return err
   851  			}
   852  		}
   853  
   854  		if err := sr.ReadFieldEnd(); err != nil {
   855  			return err
   856  		}
   857  
   858  		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
   859  			return err
   860  		}
   861  	}
   862  
   863  	if err := sr.ReadStructEnd(); err != nil {
   864  		return err
   865  	}
   866  
   867  	return nil
   868  }
   869  
   870  // String returns a readable string representation of a ExtendEmpty_Hello_Result
   871  // struct.
   872  func (v *ExtendEmpty_Hello_Result) String() string {
   873  	if v == nil {
   874  		return "<nil>"
   875  	}
   876  
   877  	var fields [0]string
   878  	i := 0
   879  
   880  	return fmt.Sprintf("ExtendEmpty_Hello_Result{%v}", strings.Join(fields[:i], ", "))
   881  }
   882  
   883  // Equals returns true if all the fields of this ExtendEmpty_Hello_Result match the
   884  // provided ExtendEmpty_Hello_Result.
   885  //
   886  // This function performs a deep comparison.
   887  func (v *ExtendEmpty_Hello_Result) Equals(rhs *ExtendEmpty_Hello_Result) bool {
   888  	if v == nil {
   889  		return rhs == nil
   890  	} else if rhs == nil {
   891  		return false
   892  	}
   893  
   894  	return true
   895  }
   896  
   897  // MarshalLogObject implements zapcore.ObjectMarshaler, enabling
   898  // fast logging of ExtendEmpty_Hello_Result.
   899  func (v *ExtendEmpty_Hello_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
   900  	if v == nil {
   901  		return nil
   902  	}
   903  	return err
   904  }
   905  
   906  // MethodName returns the name of the Thrift function as specified in
   907  // the IDL, for which this struct represent the result.
   908  //
   909  // This will always be "hello" for this struct.
   910  func (v *ExtendEmpty_Hello_Result) MethodName() string {
   911  	return "hello"
   912  }
   913  
   914  // EnvelopeType returns the kind of value inside this struct.
   915  //
   916  // This will always be Reply for this struct.
   917  func (v *ExtendEmpty_Hello_Result) EnvelopeType() wire.EnvelopeType {
   918  	return wire.Reply
   919  }