thriftrw: go.uber.org/thriftrw/wire Index | Files

package wire

import "go.uber.org/thriftrw/wire"

Package wire provides types and constants that map directly to the wire representation of Thrift values.

Index

Package Files

doc.go envelope.go evaluate.go lazy_list.go type.go type_string.go unsafe.go value.go value_equals.go

func EvaluateValue Uses

func EvaluateValue(v Value) error

EvaluateValue ensures that the given Value is fully evaluated. Lazy lists are spinned and any errors raised by them are returned.

func ListsAreEqual Uses

func ListsAreEqual(left, right ValueList) bool

ListsAreEqual checks if two lists are equal.

func MapsAreEqual Uses

func MapsAreEqual(left, right MapItemList) bool

MapsAreEqual checks if two maps are equal.

func SetsAreEqual Uses

func SetsAreEqual(left, right ValueList) bool

SetsAreEqual checks if two sets are equal.

func StructsAreEqual Uses

func StructsAreEqual(left, right Struct) bool

StructsAreEqual checks if two structs are equal.

func ValuesAreEqual Uses

func ValuesAreEqual(left, right Value) bool

ValuesAreEqual checks if two values are equal.

type Envelope Uses

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 Uses

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 Uses

func (et EnvelopeType) String() string

type Field Uses

type Field struct {
    ID    int16
    Value Value
}

Field is a single field inside a Struct.

func (Field) String Uses

func (f Field) String() string

type MapItem Uses

type MapItem struct {
    Key   Value
    Value Value
}

MapItem is a single item in a Map.

func MapItemListToSlice Uses

func MapItemListToSlice(l MapItemList) []MapItem

MapItemListToSlice builds a slice of values from the given MapItemList.

func (MapItem) String Uses

func (mi MapItem) String() string

type MapItemList Uses

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 Uses

func MapItemListFromSlice(k, v Type, items []MapItem) MapItemList

MapItemListFromSlice builds a MapItemList from the given slice of Values.

type Struct Uses

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.

func (Struct) String Uses

func (s Struct) String() string

type Type Uses

type Type byte

Type identifies the different types supported by Thrift over the wire.

const (
    TBool   Type = 2
    TI8     Type = 3
    TDouble Type = 4
    TI16    Type = 6
    TI32    Type = 8
    TI64    Type = 10
    TBinary Type = 11
    TStruct Type = 12
    TMap    Type = 13
    TSet    Type = 14
    TList   Type = 15
)

Type codes of the different types supported by Thrift.

func (Type) String Uses

func (i Type) String() string

type Value Uses

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 Uses

func NewValueBinary(v []byte) Value

NewValueBinary constructs a new Value that contains a binary string.

func NewValueBool Uses

func NewValueBool(v bool) Value

NewValueBool constructs a new Value that contains a boolean.

func NewValueDouble Uses

func NewValueDouble(v float64) Value

NewValueDouble constructs a new Value that contains a double.

func NewValueI16 Uses

func NewValueI16(v int16) Value

NewValueI16 constructs a new Value that contains a 16-bit integer.

func NewValueI32 Uses

func NewValueI32(v int32) Value

NewValueI32 constructs a new Value that contains a 32-bit integer.

func NewValueI64 Uses

func NewValueI64(v int64) Value

NewValueI64 constructs a new Value that contains a 64-bit integer.

func NewValueI8 Uses

func NewValueI8(v int8) Value

NewValueI8 constructs a new Value that contains a byte

func NewValueList Uses

func NewValueList(v ValueList) Value

NewValueList constructs a new Value that contains a list.

func NewValueMap Uses

func NewValueMap(v MapItemList) Value

NewValueMap constructs a new Value that contains a map.

func NewValueSet Uses

func NewValueSet(v ValueList) Value

NewValueSet constructs a new Value that contains a set.

func NewValueString Uses

func NewValueString(v string) Value

NewValueString constructs a new Value that contains a string.

func NewValueStruct Uses

func NewValueStruct(v Struct) Value

NewValueStruct constructs a new Value that contains a struct.

func ValueListToSlice Uses

func ValueListToSlice(l ValueList) []Value

ValueListToSlice builds a slice of values from the given ValueList.

func (*Value) Get Uses

func (v *Value) Get() interface{}

Get retrieves whatever value the given Value contains.

func (*Value) GetBinary Uses

func (v *Value) GetBinary() []byte

GetBinary gets the Binary value from a Value.

func (*Value) GetBool Uses

func (v *Value) GetBool() bool

GetBool gets the Bool value from a Value.

func (*Value) GetDouble Uses

func (v *Value) GetDouble() float64

GetDouble gets the Double value from a Value.

func (*Value) GetI16 Uses

func (v *Value) GetI16() int16

GetI16 gets the I16 value from a Value.

func (*Value) GetI32 Uses

func (v *Value) GetI32() int32

GetI32 gets the I32 value from a Value.

func (*Value) GetI64 Uses

func (v *Value) GetI64() int64

GetI64 gets the I64 value from a Value.

func (*Value) GetI8 Uses

func (v *Value) GetI8() int8

GetI8 gets the I8 value from a Value.

func (*Value) GetList Uses

func (v *Value) GetList() ValueList

GetList gets the List value from a Value.

func (*Value) GetMap Uses

func (v *Value) GetMap() MapItemList

GetMap gets the Map value from a Value.

func (*Value) GetSet Uses

func (v *Value) GetSet() ValueList

GetSet gets the Set value from a Value.

func (*Value) GetString Uses

func (v *Value) GetString() string

GetString gets a string value from a Value.

func (*Value) GetStruct Uses

func (v *Value) GetStruct() Struct

GetStruct gets the Struct value from a Value.

func (Value) String Uses

func (v Value) String() string

func (*Value) Type Uses

func (v *Value) Type() Type

Type retrieves the type of value inside a Value.

type ValueList Uses

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 Uses

func ValueListFromSlice(t Type, values []Value) ValueList

ValueListFromSlice builds a ValueList from the given slice of Values.

Package wire imports 8 packages (graph) and is imported by 154 packages. Updated 2020-01-05. Refresh now. Tools for package owners.