Documentation ¶
Overview ¶
Package wire provides types and constants that map directly to the wire representation of Thrift values.
Index ¶
- func EvaluateValue(v Value) error
- func ListsAreEqual(left, right ValueList) bool
- func MapsAreEqual(left, right MapItemList) bool
- func SetsAreEqual(left, right ValueList) bool
- func StructsAreEqual(left, right Struct) bool
- func ValuesAreEqual(left, right Value) bool
- type Envelope
- type EnvelopeType
- type Field
- type MapItem
- type MapItemList
- type Struct
- type Type
- type Value
- func NewValueBinary(v []byte) Value
- func NewValueBool(v bool) Value
- func NewValueDouble(v float64) Value
- func NewValueI16(v int16) Value
- func NewValueI32(v int32) Value
- func NewValueI64(v int64) Value
- func NewValueI8(v int8) Value
- func NewValueList(v ValueList) Value
- func NewValueMap(v MapItemList) Value
- func NewValueSet(v ValueList) Value
- func NewValueString(v string) Value
- func NewValueStruct(v Struct) Value
- func ValueListToSlice(l ValueList) []Value
- func (v *Value) Get() interface{}
- func (v *Value) GetBinary() []byte
- func (v *Value) GetBool() bool
- func (v *Value) GetDouble() float64
- func (v *Value) GetI16() int16
- func (v *Value) GetI32() int32
- func (v *Value) GetI64() int64
- func (v *Value) GetI8() int8
- func (v *Value) GetList() ValueList
- func (v *Value) GetMap() MapItemList
- func (v *Value) GetSet() ValueList
- func (v *Value) GetString() string
- func (v *Value) GetStruct() Struct
- func (v Value) String() string
- func (v *Value) Type() Type
- type ValueList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvaluateValue ¶
EvaluateValue ensures that the given Value is fully evaluated. Lazy lists are spinned and any errors raised by them are returned.
func ListsAreEqual ¶
ListsAreEqual checks if two lists are equal.
func MapsAreEqual ¶
func MapsAreEqual(left, right MapItemList) bool
MapsAreEqual checks if two maps are equal.
func SetsAreEqual ¶
SetsAreEqual checks if two sets are equal.
func StructsAreEqual ¶
StructsAreEqual checks if two structs are equal.
func ValuesAreEqual ¶
ValuesAreEqual checks if two values are equal.
Types ¶
type Envelope ¶
type Envelope struct { Name string Type EnvelopeType SeqID int32 Value Value }
Envelope represents an enveloped value which includes metadata about the method, the type of data in the envelope, and the value.
type EnvelopeType ¶
type EnvelopeType int8
EnvelopeType is the type of data inside of the envelope.
const ( Call EnvelopeType = 1 Reply EnvelopeType = 2 Exception EnvelopeType = 3 OneWay EnvelopeType = 4 )
List of envelope types, same as TMessageType in Apache Thrift.
func (EnvelopeType) String ¶
func (et EnvelopeType) String() string
type MapItem ¶
MapItem is a single item in a Map.
func MapItemListToSlice ¶
func MapItemListToSlice(l MapItemList) []MapItem
MapItemListToSlice builds a slice of values from the given MapItemList.
type MapItemList ¶
type MapItemList interface { // Size returns the size of this lazy list. Size() int // KeyType and ValueType specify the kind of values held in this // MapItemList. KeyType() Type ValueType() Type // ForEach calls the given function on each element of the list. // // If any call fails with an error, that error is returned and the // iteration is stopped. ForEach(f func(MapItem) error) error // Close indicates that the caller is finished reading from the lazy list. Close() }
MapItemList represents a collection of MapItem objects as an iteration through it. This helps us avoid the cost of allocating memory for all collections passing through the system.
func MapItemListFromSlice ¶
func MapItemListFromSlice(k, v Type, items []MapItem) MapItemList
MapItemListFromSlice builds a MapItemList from the given slice of Values.
type Struct ¶
type Struct struct {
Fields []Field
}
Struct provides a wire-level representation of a struct.
At this level, structs don't have names or named fields.
type Type ¶
type Type byte
Type identifies the different types supported by Thrift over the wire.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value holds the over-the-wire representation of a Thrift value.
The Type of the value determines which field in the Value is valid.
func NewValueBinary ¶
NewValueBinary constructs a new Value that contains a binary string.
func NewValueBool ¶
NewValueBool constructs a new Value that contains a boolean.
func NewValueDouble ¶
NewValueDouble constructs a new Value that contains a double.
func NewValueI16 ¶
NewValueI16 constructs a new Value that contains a 16-bit integer.
func NewValueI32 ¶
NewValueI32 constructs a new Value that contains a 32-bit integer.
func NewValueI64 ¶
NewValueI64 constructs a new Value that contains a 64-bit integer.
func NewValueI8 ¶
NewValueI8 constructs a new Value that contains a byte
func NewValueList ¶
NewValueList constructs a new Value that contains a list.
func NewValueMap ¶
func NewValueMap(v MapItemList) Value
NewValueMap constructs a new Value that contains a map.
func NewValueSet ¶
NewValueSet constructs a new Value that contains a set.
func NewValueString ¶
NewValueString constructs a new Value that contains a string.
func NewValueStruct ¶
NewValueStruct constructs a new Value that contains a struct.
func ValueListToSlice ¶
ValueListToSlice builds a slice of values from the given ValueList.
func (*Value) Get ¶
func (v *Value) Get() interface{}
Get retrieves whatever value the given Value contains.
type ValueList ¶
type ValueList interface { // Size returns the size of this lazy list. Size() int // ValueType specifies the type of values contained in this list. ValueType() Type // ForEach calls the given function on each element of the list. // // If any call fails with an error, that error is returned and the // iteration is stopped. ForEach(f func(Value) error) error // Close indicates that the caller is finished reading from the lazy list. Close() }
ValueList represents a collection of Value objects as an iteration through it. This helps us avoid the cost of allocating memory for all collections passing through the system.
func ValueListFromSlice ¶
ValueListFromSlice builds a ValueList from the given slice of Values.