wire

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package wire implements subset of YT wire protocol used by RPC proxy.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIntegerOverflow = xerrors.New("wire: integer overflow")
	ErrFloat32Overflow = xerrors.New("wire: float32 overflow")
)

Functions

func Encode

func Encode(items []any) (NameTable, []Row, error)

func MarshalRowset

func MarshalRowset(rowset []Row) ([]byte, error)

Types

type NameTable

type NameTable []NameTableEntry

type NameTableEntry

type NameTableEntry struct {
	Name string
}

type ReflectTypeError

type ReflectTypeError struct {
	UserType reflect.Type
	WireType ValueType

	Struct string
	Field  string
}

func (*ReflectTypeError) Error

func (e *ReflectTypeError) Error() string

type Row

type Row []Value

func EncodePivotKeys

func EncodePivotKeys(keys []any) ([]Row, error)

func UnmarshalRowset

func UnmarshalRowset(b []byte) (rows []Row, err error)

UnmarshalRowset decodes rowset from YT wire format.

Returned values of type Bytes and Any point directly into the input buffer.

type TypesMismatchError

type TypesMismatchError struct {
	WireType   ValueType
	SchemaType schema.Type
}

func (*TypesMismatchError) Error

func (e *TypesMismatchError) Error() string

type UnsupportedTypeError

type UnsupportedTypeError struct {
	UserType reflect.Type
}

func (*UnsupportedTypeError) Error

func (e *UnsupportedTypeError) Error() string

type Value

type Value struct {
	ID        uint16
	Type      ValueType
	Aggregate bool
	// contains filtered or unexported fields
}

func NewAny

func NewAny(id uint16, b []byte) (v Value)

func NewBool

func NewBool(id uint16, b bool) (v Value)

func NewBytes

func NewBytes(id uint16, b []byte) (v Value)

func NewFloat64

func NewFloat64(id uint16, f float64) (v Value)

func NewInt64

func NewInt64(id uint16, i int64) (v Value)

func NewNull

func NewNull(id uint16) (v Value)

func NewUint64

func NewUint64(id uint16, i uint64) (v Value)

func (*Value) Any

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

func (*Value) Bool

func (v *Value) Bool() bool

func (*Value) Bytes

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

func (*Value) Float64

func (v *Value) Float64() float64

func (*Value) Int64

func (v *Value) Int64() int64

func (*Value) Uint64

func (v *Value) Uint64() uint64

func (*Value) Validate

func (v *Value) Validate() error

type ValueType

type ValueType uint8
const (

	// Subtract 2 from all constants, such that Null is represented by zero.
	TypeNull    ValueType = 0x02 - typeOffset
	TypeInt64   ValueType = 0x03 - typeOffset
	TypeUint64  ValueType = 0x04 - typeOffset
	TypeFloat64 ValueType = 0x05 - typeOffset
	TypeBool    ValueType = 0x06 - typeOffset
	TypeBytes   ValueType = 0x10 - typeOffset
	TypeAny     ValueType = 0x11 - typeOffset
)

func (ValueType) String

func (t ValueType) String() string

type WireDecoder

type WireDecoder struct {
	NameTable NameTable
}

func NewDecoder

func NewDecoder(table NameTable) *WireDecoder

func (*WireDecoder) UnmarshalRow

func (d *WireDecoder) UnmarshalRow(row Row, v any) error

Jump to

Keyboard shortcuts

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