Back to godoc.org

Package echo

v1.42.1
Latest Go to latest
Published: Dec 2, 2019 | License: MIT | Module: github.com/yarpc/yarpc-go

Index

Package Files

Variables

var Hello_Echo_Helper = struct {
	// Args accepts the parameters of echo in-order and returns
	// the arguments struct for the function.
	Args func(
		echo *EchoRequest,
	) *Hello_Echo_Args

	// IsException returns true if the given error can be thrown
	// by echo.
	//
	// An error can be thrown by echo 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 echo
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// echo into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by echo
	//
	//   value, err := echo(args)
	//   result, err := Hello_Echo_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from echo: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*EchoResponse, error) (*Hello_Echo_Result, error)

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

Hello_Echo_Helper provides functions that aid in handling the parameters and return values of the Hello.echo function.

var ThriftModule = &thriftreflect.ThriftModule{
	Name:     "echo",
	Package:  "go.uber.org/yarpc/internal/examples/thrift-hello/hello/echo",
	FilePath: "echo.thrift",
	SHA1:     "619e87984e33d89e2f63c235bf6b0c1003898504",
	Raw:      rawIDL,
}

ThriftModule represents the IDL file used to generate this package.

type EchoRequest

type EchoRequest struct {
	Message string `json:"message,required"`
	Count   int16  `json:"count,required"`
}

func (*EchoRequest) Equals

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

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

This function performs a deep comparison.

func (*EchoRequest) FromWire

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

FromWire deserializes a EchoRequest 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 EchoRequest struct from the provided intermediate representation.

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

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

func (*EchoRequest) GetCount

func (v *EchoRequest) GetCount() (o int16)

GetCount returns the value of Count if it is set or its zero value if it is unset.

func (*EchoRequest) GetMessage

func (v *EchoRequest) GetMessage() (o string)

GetMessage returns the value of Message if it is set or its zero value if it is unset.

func (*EchoRequest) MarshalLogObject

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

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

func (*EchoRequest) String

func (v *EchoRequest) String() string

String returns a readable string representation of a EchoRequest struct.

func (*EchoRequest) ToWire

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

ToWire translates a EchoRequest 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
}

type EchoResponse

type EchoResponse struct {
	Message string `json:"message,required"`
	Count   int16  `json:"count,required"`
}

func (*EchoResponse) Equals

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

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

This function performs a deep comparison.

func (*EchoResponse) FromWire

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

FromWire deserializes a EchoResponse 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 EchoResponse struct from the provided intermediate representation.

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

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

func (*EchoResponse) GetCount

func (v *EchoResponse) GetCount() (o int16)

GetCount returns the value of Count if it is set or its zero value if it is unset.

func (*EchoResponse) GetMessage

func (v *EchoResponse) GetMessage() (o string)

GetMessage returns the value of Message if it is set or its zero value if it is unset.

func (*EchoResponse) MarshalLogObject

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

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

func (*EchoResponse) String

func (v *EchoResponse) String() string

String returns a readable string representation of a EchoResponse struct.

func (*EchoResponse) ToWire

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

ToWire translates a EchoResponse 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
}

type Hello_Echo_Args

type Hello_Echo_Args struct {
	Echo *EchoRequest `json:"echo,omitempty"`
}

Hello_Echo_Args represents the arguments for the Hello.echo function.

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

func (*Hello_Echo_Args) EnvelopeType

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

EnvelopeType returns the kind of value inside this struct.

This will always be Call for this struct.

func (*Hello_Echo_Args) Equals

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

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

This function performs a deep comparison.

func (*Hello_Echo_Args) FromWire

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

FromWire deserializes a Hello_Echo_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 Hello_Echo_Args struct from the provided intermediate representation.

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

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

func (*Hello_Echo_Args) GetEcho

func (v *Hello_Echo_Args) GetEcho() (o *EchoRequest)

GetEcho returns the value of Echo if it is set or its zero value if it is unset.

func (*Hello_Echo_Args) IsSetEcho

func (v *Hello_Echo_Args) IsSetEcho() bool

IsSetEcho returns true if Echo is not nil.

func (*Hello_Echo_Args) MarshalLogObject

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

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

func (*Hello_Echo_Args) MethodName

func (v *Hello_Echo_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 "echo" for this struct.

func (*Hello_Echo_Args) String

func (v *Hello_Echo_Args) String() string

String returns a readable string representation of a Hello_Echo_Args struct.

func (*Hello_Echo_Args) ToWire

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

ToWire translates a Hello_Echo_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
}

type Hello_Echo_Result

type Hello_Echo_Result struct {
	// Value returned by echo after a successful execution.
	Success *EchoResponse `json:"success,omitempty"`
}

Hello_Echo_Result represents the result of a Hello.echo function call.

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

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

func (*Hello_Echo_Result) EnvelopeType

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

EnvelopeType returns the kind of value inside this struct.

This will always be Reply for this struct.

func (*Hello_Echo_Result) Equals

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

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

This function performs a deep comparison.

func (*Hello_Echo_Result) FromWire

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

FromWire deserializes a Hello_Echo_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 Hello_Echo_Result struct from the provided intermediate representation.

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

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

func (*Hello_Echo_Result) GetSuccess

func (v *Hello_Echo_Result) GetSuccess() (o *EchoResponse)

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

func (*Hello_Echo_Result) IsSetSuccess

func (v *Hello_Echo_Result) IsSetSuccess() bool

IsSetSuccess returns true if Success is not nil.

func (*Hello_Echo_Result) MarshalLogObject

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

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

func (*Hello_Echo_Result) MethodName

func (v *Hello_Echo_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 "echo" for this struct.

func (*Hello_Echo_Result) String

func (v *Hello_Echo_Result) String() string

String returns a readable string representation of a Hello_Echo_Result struct.

func (*Hello_Echo_Result) ToWire

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

ToWire translates a Hello_Echo_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
}
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

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