kv

package
v1.27.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: MIT Imports: 5 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) 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 added in v1.8.0

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

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

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

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

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

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

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

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

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

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

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