Back to godoc.org

Package withexceptions

v0.4.4
Latest Go to latest

The highest tagged major version is .

Published: Mar 4, 2020 | License: MIT | Module: github.com/Xiot/zanzibar

Index

Variables

var WithExceptions_Func1_Helper = struct {
	// Args accepts the parameters of Func1 in-order and returns
	// the arguments struct for the function.
	Args func() *WithExceptions_Func1_Args

	// IsException returns true if the given error can be thrown
	// by Func1.
	//
	// An error can be thrown by Func1 only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for Func1
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// Func1 into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by Func1
	//
	//   value, err := Func1(args)
	//   result, err := WithExceptions_Func1_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from Func1: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*Response, error) (*WithExceptions_Func1_Result, error)

	// UnwrapResponse takes the result struct for Func1
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if Func1 threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := WithExceptions_Func1_Helper.UnwrapResponse(result)
	UnwrapResponse func(*WithExceptions_Func1_Result) (*Response, error)
}{}

WithExceptions_Func1_Helper provides functions that aid in handling the parameters and return values of the WithExceptions.Func1 function.

type ExceptionType1

type ExceptionType1 struct {
	Message1 string `json:"message1,required"`
}

func (*ExceptionType1) Equals

func (v *ExceptionType1) Equals(rhs *ExceptionType1) bool

Equals returns true if all the fields of this ExceptionType1 match the provided ExceptionType1.

This function performs a deep comparison.

func (*ExceptionType1) Error

func (v *ExceptionType1) Error() string

func (*ExceptionType1) FromWire

func (v *ExceptionType1) FromWire(w wire.Value) error

FromWire deserializes a ExceptionType1 struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.

An error is returned if we were unable to build a ExceptionType1 struct from the provided intermediate representation.

x, err := binaryProtocol.Decode(reader, wire.TStruct)
if err != nil {
  return nil, err
}

var v ExceptionType1
if err := v.FromWire(x); err != nil {
  return nil, err
}
return &v, nil

func (*ExceptionType1) GetMessage1

func (v *ExceptionType1) GetMessage1() (o string)

GetMessage1 returns the value of Message1 if it is set or its zero value if it is unset.

func (ExceptionType1) MarshalEasyJSON

func (v ExceptionType1) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ExceptionType1) MarshalJSON

func (v ExceptionType1) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ExceptionType1) MarshalLogObject

func (v *ExceptionType1) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of ExceptionType1.

func (*ExceptionType1) String

func (v *ExceptionType1) String() string

String returns a readable string representation of a ExceptionType1 struct.

func (*ExceptionType1) ToWire

func (v *ExceptionType1) ToWire() (wire.Value, error)

ToWire translates a ExceptionType1 struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.

An error is returned if the struct or any of its fields failed to validate.

x, err := v.ToWire()
if err != nil {
  return err
}

if err := binaryProtocol.Encode(x, writer); err != nil {
  return err
}

func (*ExceptionType1) UnmarshalEasyJSON

func (v *ExceptionType1) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ExceptionType1) UnmarshalJSON

func (v *ExceptionType1) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ExceptionType2

type ExceptionType2 struct {
	Message2 string `json:"message2,required"`
}

func (*ExceptionType2) Equals

func (v *ExceptionType2) Equals(rhs *ExceptionType2) bool

Equals returns true if all the fields of this ExceptionType2 match the provided ExceptionType2.

This function performs a deep comparison.

func (*ExceptionType2) Error

func (v *ExceptionType2) Error() string

func (*ExceptionType2) FromWire

func (v *ExceptionType2) FromWire(w wire.Value) error

FromWire deserializes a ExceptionType2 struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.

An error is returned if we were unable to build a ExceptionType2 struct from the provided intermediate representation.

x, err := binaryProtocol.Decode(reader, wire.TStruct)
if err != nil {
  return nil, err
}

var v ExceptionType2
if err := v.FromWire(x); err != nil {
  return nil, err
}
return &v, nil

func (*ExceptionType2) GetMessage2

func (v *ExceptionType2) GetMessage2() (o string)

GetMessage2 returns the value of Message2 if it is set or its zero value if it is unset.

func (ExceptionType2) MarshalEasyJSON

func (v ExceptionType2) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ExceptionType2) MarshalJSON

func (v ExceptionType2) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ExceptionType2) MarshalLogObject

func (v *ExceptionType2) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of ExceptionType2.

func (*ExceptionType2) String

func (v *ExceptionType2) String() string

String returns a readable string representation of a ExceptionType2 struct.

func (*ExceptionType2) ToWire

func (v *ExceptionType2) ToWire() (wire.Value, error)

ToWire translates a ExceptionType2 struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.

An error is returned if the struct or any of its fields failed to validate.

x, err := v.ToWire()
if err != nil {
  return err
}

if err := binaryProtocol.Encode(x, writer); err != nil {
  return err
}

func (*ExceptionType2) UnmarshalEasyJSON

func (v *ExceptionType2) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ExceptionType2) UnmarshalJSON

func (v *ExceptionType2) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Response

type Response struct {
}

func (*Response) Equals

func (v *Response) Equals(rhs *Response) bool

Equals returns true if all the fields of this Response match the provided Response.

This function performs a deep comparison.

func (*Response) FromWire

func (v *Response) FromWire(w wire.Value) error

FromWire deserializes a Response struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.

An error is returned if we were unable to build a Response struct from the provided intermediate representation.

x, err := binaryProtocol.Decode(reader, wire.TStruct)
if err != nil {
  return nil, err
}

var v Response
if err := v.FromWire(x); err != nil {
  return nil, err
}
return &v, nil

func (Response) MarshalEasyJSON

func (v Response) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Response) MarshalJSON

func (v Response) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Response) MarshalLogObject

func (v *Response) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Response.

func (*Response) String

func (v *Response) String() string

String returns a readable string representation of a Response struct.

func (*Response) ToWire

func (v *Response) ToWire() (wire.Value, error)

ToWire translates a Response struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.

An error is returned if the struct or any of its fields failed to validate.

x, err := v.ToWire()
if err != nil {
  return err
}

if err := binaryProtocol.Encode(x, writer); err != nil {
  return err
}

func (*Response) UnmarshalEasyJSON

func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Response) UnmarshalJSON

func (v *Response) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WithExceptions_Func1_Args

type WithExceptions_Func1_Args struct {
}

WithExceptions_Func1_Args represents the arguments for the WithExceptions.Func1 function.

The arguments for Func1 are sent and received over the wire as this struct.

func (*WithExceptions_Func1_Args) EnvelopeType

func (v *WithExceptions_Func1_Args) EnvelopeType() wire.EnvelopeType

EnvelopeType returns the kind of value inside this struct.

This will always be Call for this struct.

func (*WithExceptions_Func1_Args) Equals

func (v *WithExceptions_Func1_Args) Equals(rhs *WithExceptions_Func1_Args) bool

Equals returns true if all the fields of this WithExceptions_Func1_Args match the provided WithExceptions_Func1_Args.

This function performs a deep comparison.

func (*WithExceptions_Func1_Args) FromWire

func (v *WithExceptions_Func1_Args) FromWire(w wire.Value) error

FromWire deserializes a WithExceptions_Func1_Args struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.

An error is returned if we were unable to build a WithExceptions_Func1_Args struct from the provided intermediate representation.

x, err := binaryProtocol.Decode(reader, wire.TStruct)
if err != nil {
  return nil, err
}

var v WithExceptions_Func1_Args
if err := v.FromWire(x); err != nil {
  return nil, err
}
return &v, nil

func (WithExceptions_Func1_Args) MarshalEasyJSON

func (v WithExceptions_Func1_Args) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WithExceptions_Func1_Args) MarshalJSON

func (v WithExceptions_Func1_Args) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WithExceptions_Func1_Args) MarshalLogObject

func (v *WithExceptions_Func1_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of WithExceptions_Func1_Args.

func (*WithExceptions_Func1_Args) MethodName

func (v *WithExceptions_Func1_Args) MethodName() string

MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the arguments.

This will always be "Func1" for this struct.

func (*WithExceptions_Func1_Args) String

func (v *WithExceptions_Func1_Args) String() string

String returns a readable string representation of a WithExceptions_Func1_Args struct.

func (*WithExceptions_Func1_Args) ToWire

func (v *WithExceptions_Func1_Args) ToWire() (wire.Value, error)

ToWire translates a WithExceptions_Func1_Args struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.

An error is returned if the struct or any of its fields failed to validate.

x, err := v.ToWire()
if err != nil {
  return err
}

if err := binaryProtocol.Encode(x, writer); err != nil {
  return err
}

func (*WithExceptions_Func1_Args) UnmarshalEasyJSON

func (v *WithExceptions_Func1_Args) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WithExceptions_Func1_Args) UnmarshalJSON

func (v *WithExceptions_Func1_Args) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WithExceptions_Func1_Result

type WithExceptions_Func1_Result struct {
	// Value returned by Func1 after a successful execution.
	Success *Response       `json:"success,omitempty"`
	E1      *ExceptionType1 `json:"e1,omitempty"`
	E2      *ExceptionType2 `json:"e2,omitempty"`
}

WithExceptions_Func1_Result represents the result of a WithExceptions.Func1 function call.

The result of a Func1 execution is sent and received over the wire as this struct.

Success is set only if the function did not throw an exception.

func (*WithExceptions_Func1_Result) EnvelopeType

func (v *WithExceptions_Func1_Result) EnvelopeType() wire.EnvelopeType

EnvelopeType returns the kind of value inside this struct.

This will always be Reply for this struct.

func (*WithExceptions_Func1_Result) Equals

func (v *WithExceptions_Func1_Result) Equals(rhs *WithExceptions_Func1_Result) bool

Equals returns true if all the fields of this WithExceptions_Func1_Result match the provided WithExceptions_Func1_Result.

This function performs a deep comparison.

func (*WithExceptions_Func1_Result) FromWire

func (v *WithExceptions_Func1_Result) FromWire(w wire.Value) error

FromWire deserializes a WithExceptions_Func1_Result struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.

An error is returned if we were unable to build a WithExceptions_Func1_Result struct from the provided intermediate representation.

x, err := binaryProtocol.Decode(reader, wire.TStruct)
if err != nil {
  return nil, err
}

var v WithExceptions_Func1_Result
if err := v.FromWire(x); err != nil {
  return nil, err
}
return &v, nil

func (*WithExceptions_Func1_Result) GetE1

func (v *WithExceptions_Func1_Result) GetE1() (o *ExceptionType1)

GetE1 returns the value of E1 if it is set or its zero value if it is unset.

func (*WithExceptions_Func1_Result) GetE2

func (v *WithExceptions_Func1_Result) GetE2() (o *ExceptionType2)

GetE2 returns the value of E2 if it is set or its zero value if it is unset.

func (*WithExceptions_Func1_Result) GetSuccess

func (v *WithExceptions_Func1_Result) GetSuccess() (o *Response)

GetSuccess returns the value of Success if it is set or its zero value if it is unset.

func (*WithExceptions_Func1_Result) IsSetE1

func (v *WithExceptions_Func1_Result) IsSetE1() bool

IsSetE1 returns true if E1 is not nil.

func (*WithExceptions_Func1_Result) IsSetE2

func (v *WithExceptions_Func1_Result) IsSetE2() bool

IsSetE2 returns true if E2 is not nil.

func (*WithExceptions_Func1_Result) IsSetSuccess

func (v *WithExceptions_Func1_Result) IsSetSuccess() bool

IsSetSuccess returns true if Success is not nil.

func (WithExceptions_Func1_Result) MarshalEasyJSON

func (v WithExceptions_Func1_Result) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WithExceptions_Func1_Result) MarshalJSON

func (v WithExceptions_Func1_Result) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WithExceptions_Func1_Result) MarshalLogObject

func (v *WithExceptions_Func1_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of WithExceptions_Func1_Result.

func (*WithExceptions_Func1_Result) MethodName

func (v *WithExceptions_Func1_Result) MethodName() string

MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the result.

This will always be "Func1" for this struct.

func (*WithExceptions_Func1_Result) String

func (v *WithExceptions_Func1_Result) String() string

String returns a readable string representation of a WithExceptions_Func1_Result struct.

func (*WithExceptions_Func1_Result) ToWire

func (v *WithExceptions_Func1_Result) ToWire() (wire.Value, error)

ToWire translates a WithExceptions_Func1_Result struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.

An error is returned if the struct or any of its fields failed to validate.

x, err := v.ToWire()
if err != nil {
  return err
}

if err := binaryProtocol.Encode(x, writer); err != nil {
  return err
}

func (*WithExceptions_Func1_Result) UnmarshalEasyJSON

func (v *WithExceptions_Func1_Result) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WithExceptions_Func1_Result) UnmarshalJSON

func (v *WithExceptions_Func1_Result) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier