kv

package
v0.0.0-...-23c069f Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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

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

KeyValue_GetValue_Helper provides functions that aid in handling the parameters and return values of the KeyValue.getValue function.

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

	// IsException returns true if the given error can be thrown
	// by setValue.
	//
	// An error can be thrown by setValue 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 setValue
	// given the error returned by it. The provided error may
	// be nil if setValue did not fail.
	//
	// This allows mapping errors returned by setValue into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// setValue
	//
	//   err := setValue(args)
	//   result, err := KeyValue_SetValue_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from setValue: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*KeyValue_SetValue_Result, error)

	// UnwrapResponse takes the result struct for setValue
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if setValue threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := KeyValue_SetValue_Helper.UnwrapResponse(result)
	UnwrapResponse func(*KeyValue_SetValue_Result) error
}{}

KeyValue_SetValue_Helper provides functions that aid in handling the parameters and return values of the KeyValue.setValue function.

View Source
var ThriftModule = &thriftreflect.ThriftModule{
	Name:     "kv",
	Package:  "go.uber.org/yarpc/internal/examples/thrift-keyvalue/keyvalue/kv",
	FilePath: "kv.thrift",
	SHA1:     "9e8c1c30d0b6bd7d83426a92962269aaef706295",
	Raw:      rawIDL,
}

ThriftModule represents the IDL file used to generate this package.

Functions

This section is empty.

Types

type KeyValue_GetValue_Args

type KeyValue_GetValue_Args struct {
	Key *string `json:"key,omitempty"`
}

KeyValue_GetValue_Args represents the arguments for the KeyValue.getValue function.

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

func (*KeyValue_GetValue_Args) Decode

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

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

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

func (*KeyValue_GetValue_Args) Encode

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

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

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

func (*KeyValue_GetValue_Args) EnvelopeType

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

EnvelopeType returns the kind of value inside this struct.

This will always be Call for this struct.

func (*KeyValue_GetValue_Args) Equals

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

This function performs a deep comparison.

func (*KeyValue_GetValue_Args) FromWire

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

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

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

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

func (*KeyValue_GetValue_Args) GetKey

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

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

func (*KeyValue_GetValue_Args) IsSetKey

func (v *KeyValue_GetValue_Args) IsSetKey() bool

IsSetKey returns true if Key is not nil.

func (*KeyValue_GetValue_Args) MarshalLogObject

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

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

func (*KeyValue_GetValue_Args) MethodName

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

func (*KeyValue_GetValue_Args) String

func (v *KeyValue_GetValue_Args) String() string

String returns a readable string representation of a KeyValue_GetValue_Args struct.

func (*KeyValue_GetValue_Args) ToWire

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

ToWire translates a KeyValue_GetValue_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 KeyValue_GetValue_Result

type KeyValue_GetValue_Result struct {
	// Value returned by getValue after a successful execution.
	Success      *string               `json:"success,omitempty"`
	DoesNotExist *ResourceDoesNotExist `json:"doesNotExist,omitempty"`
}

KeyValue_GetValue_Result represents the result of a KeyValue.getValue function call.

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

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

func (*KeyValue_GetValue_Result) Decode

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

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

func (*KeyValue_GetValue_Result) Encode

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

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

func (*KeyValue_GetValue_Result) EnvelopeType

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

EnvelopeType returns the kind of value inside this struct.

This will always be Reply for this struct.

func (*KeyValue_GetValue_Result) Equals

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

This function performs a deep comparison.

func (*KeyValue_GetValue_Result) FromWire

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

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

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

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

func (*KeyValue_GetValue_Result) GetDoesNotExist

func (v *KeyValue_GetValue_Result) GetDoesNotExist() (o *ResourceDoesNotExist)

GetDoesNotExist returns the value of DoesNotExist if it is set or its zero value if it is unset.

func (*KeyValue_GetValue_Result) GetSuccess

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

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

func (*KeyValue_GetValue_Result) IsSetDoesNotExist

func (v *KeyValue_GetValue_Result) IsSetDoesNotExist() bool

IsSetDoesNotExist returns true if DoesNotExist is not nil.

func (*KeyValue_GetValue_Result) IsSetSuccess

func (v *KeyValue_GetValue_Result) IsSetSuccess() bool

IsSetSuccess returns true if Success is not nil.

func (*KeyValue_GetValue_Result) MarshalLogObject

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

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

func (*KeyValue_GetValue_Result) MethodName

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

func (*KeyValue_GetValue_Result) String

func (v *KeyValue_GetValue_Result) String() string

String returns a readable string representation of a KeyValue_GetValue_Result struct.

func (*KeyValue_GetValue_Result) ToWire

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

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

type KeyValue_SetValue_Args

type KeyValue_SetValue_Args struct {
	Key   *string `json:"key,omitempty"`
	Value *string `json:"value,omitempty"`
}

KeyValue_SetValue_Args represents the arguments for the KeyValue.setValue function.

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

func (*KeyValue_SetValue_Args) Decode

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

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

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

func (*KeyValue_SetValue_Args) Encode

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

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

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

func (*KeyValue_SetValue_Args) EnvelopeType

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

EnvelopeType returns the kind of value inside this struct.

This will always be Call for this struct.

func (*KeyValue_SetValue_Args) Equals

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

This function performs a deep comparison.

func (*KeyValue_SetValue_Args) FromWire

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

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

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

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

func (*KeyValue_SetValue_Args) GetKey

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

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

func (*KeyValue_SetValue_Args) GetValue

func (v *KeyValue_SetValue_Args) GetValue() (o string)

GetValue returns the value of Value if it is set or its zero value if it is unset.

func (*KeyValue_SetValue_Args) IsSetKey

func (v *KeyValue_SetValue_Args) IsSetKey() bool

IsSetKey returns true if Key is not nil.

func (*KeyValue_SetValue_Args) IsSetValue

func (v *KeyValue_SetValue_Args) IsSetValue() bool

IsSetValue returns true if Value is not nil.

func (*KeyValue_SetValue_Args) MarshalLogObject

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

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

func (*KeyValue_SetValue_Args) MethodName

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

func (*KeyValue_SetValue_Args) String

func (v *KeyValue_SetValue_Args) String() string

String returns a readable string representation of a KeyValue_SetValue_Args struct.

func (*KeyValue_SetValue_Args) ToWire

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

ToWire translates a KeyValue_SetValue_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 KeyValue_SetValue_Result

type KeyValue_SetValue_Result struct {
}

KeyValue_SetValue_Result represents the result of a KeyValue.setValue function call.

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

func (*KeyValue_SetValue_Result) Decode

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

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

func (*KeyValue_SetValue_Result) Encode

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

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

func (*KeyValue_SetValue_Result) EnvelopeType

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

EnvelopeType returns the kind of value inside this struct.

This will always be Reply for this struct.

func (*KeyValue_SetValue_Result) Equals

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

This function performs a deep comparison.

func (*KeyValue_SetValue_Result) FromWire

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

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

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

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

func (*KeyValue_SetValue_Result) MarshalLogObject

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

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

func (*KeyValue_SetValue_Result) MethodName

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

func (*KeyValue_SetValue_Result) String

func (v *KeyValue_SetValue_Result) String() string

String returns a readable string representation of a KeyValue_SetValue_Result struct.

func (*KeyValue_SetValue_Result) ToWire

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

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

type ResourceDoesNotExist

type ResourceDoesNotExist struct {
	Key     string  `json:"key,required"`
	Message *string `json:"message,omitempty"`
}

func (*ResourceDoesNotExist) Decode

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

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

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

func (*ResourceDoesNotExist) Encode

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

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

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

func (*ResourceDoesNotExist) Equals

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

This function performs a deep comparison.

func (*ResourceDoesNotExist) Error

func (v *ResourceDoesNotExist) Error() string

func (*ResourceDoesNotExist) ErrorName

func (*ResourceDoesNotExist) ErrorName() string

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

func (*ResourceDoesNotExist) FromWire

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

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

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

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

func (*ResourceDoesNotExist) GetKey

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

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

func (*ResourceDoesNotExist) GetMessage

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

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

func (*ResourceDoesNotExist) IsSetMessage

func (v *ResourceDoesNotExist) IsSetMessage() bool

IsSetMessage returns true if Message is not nil.

func (*ResourceDoesNotExist) MarshalLogObject

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

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

func (*ResourceDoesNotExist) String

func (v *ResourceDoesNotExist) String() string

String returns a readable string representation of a ResourceDoesNotExist struct.

func (*ResourceDoesNotExist) ToWire

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

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

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

YARPCErrorCode returns nil for ResourceDoesNotExist.

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

func (*ResourceDoesNotExist) YARPCErrorName

func (e *ResourceDoesNotExist) YARPCErrorName() string

Name is the error name for ResourceDoesNotExist.

Directories

Path Synopsis
Package keyvaluefx provides better integration for Fx for services implementing or calling KeyValue.
Package keyvaluefx provides better integration for Fx for services implementing or calling KeyValue.

Jump to

Keyboard shortcuts

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