echo

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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.

Functions

This section is empty.

Types

type EchoRequest

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

func (*EchoRequest) Equals added in v1.8.0

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) 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 added in v1.8.0

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) 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 added in v1.8.0

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) 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 added in v1.8.0

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) 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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL