test

package
v1.73.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestService_Call_Helper = struct {
	// Args accepts the parameters of Call in-order and returns
	// the arguments struct for the function.
	Args func(
		key string,
	) *TestService_Call_Args

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

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

TestService_Call_Helper provides functions that aid in handling the parameters and return values of the TestService.Call function.

View Source
var ThriftModule = &thriftreflect.ThriftModule{
	Name:     "test",
	Package:  "go.uber.org/yarpc/encoding/thrift/internal/observabilitytest/test",
	FilePath: "test.thrift",
	SHA1:     "3c501036fe37f678648dd479c821bc57aa17b7d1",
	Raw:      rawIDL,
}

ThriftModule represents the IDL file used to generate this package.

Functions

This section is empty.

Types

type ExceptionWithCode

type ExceptionWithCode struct {
	Val string `json:"val,required"`
}

func (*ExceptionWithCode) Decode added in v1.57.0

func (v *ExceptionWithCode) Decode(sr stream.Reader) error

Decode deserializes a ExceptionWithCode struct directly from its Thrift-level representation, without going through an intemediary type.

An error is returned if a ExceptionWithCode struct could not be generated from the wire representation.

func (*ExceptionWithCode) Encode added in v1.57.0

func (v *ExceptionWithCode) Encode(sw stream.Writer) error

Encode serializes a ExceptionWithCode struct directly into bytes, without going through an intermediary type.

An error is returned if a ExceptionWithCode struct could not be encoded.

func (*ExceptionWithCode) Equals

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

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

This function performs a deep comparison.

func (*ExceptionWithCode) Error

func (v *ExceptionWithCode) Error() string

func (*ExceptionWithCode) ErrorName

func (*ExceptionWithCode) ErrorName() string

ErrorName is the name of this type as defined in the Thrift file.

func (*ExceptionWithCode) FromWire

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

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

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

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

func (*ExceptionWithCode) GetVal

func (v *ExceptionWithCode) GetVal() (o string)

GetVal returns the value of Val if it is set or its zero value if it is unset.

func (*ExceptionWithCode) MarshalLogObject

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

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

func (*ExceptionWithCode) String

func (v *ExceptionWithCode) String() string

String returns a readable string representation of a ExceptionWithCode struct.

func (*ExceptionWithCode) ToWire

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

ToWire translates a ExceptionWithCode 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 (*ExceptionWithCode) YARPCErrorCode

func (e *ExceptionWithCode) YARPCErrorCode() *yarpcerrors.Code

YARPCErrorCode returns a yarpcerrors.CodeDataLoss for ExceptionWithCode.

This is derived from the rpc.code annotation on the Thrift exception.

func (*ExceptionWithCode) YARPCErrorName

func (e *ExceptionWithCode) YARPCErrorName() string

Name is the error name for ExceptionWithCode.

type ExceptionWithoutCode

type ExceptionWithoutCode struct {
	Val string `json:"val,required"`
}

func (*ExceptionWithoutCode) Decode added in v1.57.0

func (v *ExceptionWithoutCode) Decode(sr stream.Reader) error

Decode deserializes a ExceptionWithoutCode struct directly from its Thrift-level representation, without going through an intemediary type.

An error is returned if a ExceptionWithoutCode struct could not be generated from the wire representation.

func (*ExceptionWithoutCode) Encode added in v1.57.0

func (v *ExceptionWithoutCode) Encode(sw stream.Writer) error

Encode serializes a ExceptionWithoutCode struct directly into bytes, without going through an intermediary type.

An error is returned if a ExceptionWithoutCode struct could not be encoded.

func (*ExceptionWithoutCode) Equals

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

This function performs a deep comparison.

func (*ExceptionWithoutCode) Error

func (v *ExceptionWithoutCode) Error() string

func (*ExceptionWithoutCode) ErrorName

func (*ExceptionWithoutCode) ErrorName() string

ErrorName is the name of this type as defined in the Thrift file.

func (*ExceptionWithoutCode) FromWire

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

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

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

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

func (*ExceptionWithoutCode) GetVal

func (v *ExceptionWithoutCode) GetVal() (o string)

GetVal returns the value of Val if it is set or its zero value if it is unset.

func (*ExceptionWithoutCode) MarshalLogObject

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

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

func (*ExceptionWithoutCode) String

func (v *ExceptionWithoutCode) String() string

String returns a readable string representation of a ExceptionWithoutCode struct.

func (*ExceptionWithoutCode) ToWire

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

ToWire translates a ExceptionWithoutCode 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 (*ExceptionWithoutCode) YARPCErrorCode

func (e *ExceptionWithoutCode) YARPCErrorCode() *yarpcerrors.Code

YARPCErrorCode returns nil for ExceptionWithoutCode.

This is derived from the rpc.code annotation on the Thrift exception.

func (*ExceptionWithoutCode) YARPCErrorName

func (e *ExceptionWithoutCode) YARPCErrorName() string

Name is the error name for ExceptionWithoutCode.

type TestService_Call_Args

type TestService_Call_Args struct {
	Key string `json:"key,required"`
}

TestService_Call_Args represents the arguments for the TestService.Call function.

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

func (*TestService_Call_Args) Decode added in v1.57.0

func (v *TestService_Call_Args) Decode(sr stream.Reader) error

Decode deserializes a TestService_Call_Args struct directly from its Thrift-level representation, without going through an intemediary type.

An error is returned if a TestService_Call_Args struct could not be generated from the wire representation.

func (*TestService_Call_Args) Encode added in v1.57.0

func (v *TestService_Call_Args) Encode(sw stream.Writer) error

Encode serializes a TestService_Call_Args struct directly into bytes, without going through an intermediary type.

An error is returned if a TestService_Call_Args struct could not be encoded.

func (*TestService_Call_Args) EnvelopeType

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

EnvelopeType returns the kind of value inside this struct.

This will always be Call for this struct.

func (*TestService_Call_Args) Equals

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

This function performs a deep comparison.

func (*TestService_Call_Args) FromWire

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

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

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

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

func (*TestService_Call_Args) GetKey

func (v *TestService_Call_Args) GetKey() (o string)

GetKey returns the value of Key if it is set or its zero value if it is unset.

func (*TestService_Call_Args) MarshalLogObject

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

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

func (*TestService_Call_Args) MethodName

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

func (*TestService_Call_Args) String

func (v *TestService_Call_Args) String() string

String returns a readable string representation of a TestService_Call_Args struct.

func (*TestService_Call_Args) ToWire

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

ToWire translates a TestService_Call_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 TestService_Call_Result

type TestService_Call_Result struct {
	// Value returned by Call after a successful execution.
	Success  *string               `json:"success,omitempty"`
	ExCode   *ExceptionWithCode    `json:"exCode,omitempty"`
	ExNoCode *ExceptionWithoutCode `json:"exNoCode,omitempty"`
}

TestService_Call_Result represents the result of a TestService.Call function call.

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

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

func (*TestService_Call_Result) Decode added in v1.57.0

Decode deserializes a TestService_Call_Result struct directly from its Thrift-level representation, without going through an intemediary type.

An error is returned if a TestService_Call_Result struct could not be generated from the wire representation.

func (*TestService_Call_Result) Encode added in v1.57.0

Encode serializes a TestService_Call_Result struct directly into bytes, without going through an intermediary type.

An error is returned if a TestService_Call_Result struct could not be encoded.

func (*TestService_Call_Result) EnvelopeType

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

EnvelopeType returns the kind of value inside this struct.

This will always be Reply for this struct.

func (*TestService_Call_Result) Equals

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

This function performs a deep comparison.

func (*TestService_Call_Result) FromWire

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

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

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

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

func (*TestService_Call_Result) GetExCode

func (v *TestService_Call_Result) GetExCode() (o *ExceptionWithCode)

GetExCode returns the value of ExCode if it is set or its zero value if it is unset.

func (*TestService_Call_Result) GetExNoCode

func (v *TestService_Call_Result) GetExNoCode() (o *ExceptionWithoutCode)

GetExNoCode returns the value of ExNoCode if it is set or its zero value if it is unset.

func (*TestService_Call_Result) GetSuccess

func (v *TestService_Call_Result) GetSuccess() (o string)

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

func (*TestService_Call_Result) IsSetExCode

func (v *TestService_Call_Result) IsSetExCode() bool

IsSetExCode returns true if ExCode is not nil.

func (*TestService_Call_Result) IsSetExNoCode

func (v *TestService_Call_Result) IsSetExNoCode() bool

IsSetExNoCode returns true if ExNoCode is not nil.

func (*TestService_Call_Result) IsSetSuccess

func (v *TestService_Call_Result) IsSetSuccess() bool

IsSetSuccess returns true if Success is not nil.

func (*TestService_Call_Result) MarshalLogObject

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

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

func (*TestService_Call_Result) MethodName

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

func (*TestService_Call_Result) String

func (v *TestService_Call_Result) String() string

String returns a readable string representation of a TestService_Call_Result struct.

func (*TestService_Call_Result) ToWire

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

ToWire translates a TestService_Call_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
Package testservicefx provides better integration for Fx for services implementing or calling TestService.
Package testservicefx provides better integration for Fx for services implementing or calling TestService.

Jump to

Keyboard shortcuts

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