val

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyTuple = Tuple([]byte{0, 0})
View Source
var KeylessCardType = Type{
	Enc:      Uint64Enc,
	Nullable: false,
}
View Source
var KeylessTupleDesc = TupleDesc{
	Types: []Type{{Enc: Hash128Enc, Nullable: false}},
	// contains filtered or unexported fields
}

Functions

func ModifyKeylessCardinality

func ModifyKeylessCardinality(value Tuple, delta int64) (after uint64)

func ReadKeylessCardinality

func ReadKeylessCardinality(value Tuple) uint64

Types

type ByteSize

type ByteSize uint16
const (
	MaxTupleFields            = 4096
	MaxTupleDataSize ByteSize = math.MaxUint16
)

type Encoding

type Encoding uint8
const (
	NullEnc    Encoding = 0
	Int8Enc    Encoding = 1
	Uint8Enc   Encoding = 2
	Int16Enc   Encoding = 3
	Uint16Enc  Encoding = 4
	Int32Enc   Encoding = 7
	Uint32Enc  Encoding = 8
	Int64Enc   Encoding = 9
	Uint64Enc  Encoding = 10
	Float32Enc Encoding = 11
	Float64Enc Encoding = 12

	// todo(andy): experimental encodings
	TimestampEnc Encoding = 14
	DateEnc      Encoding = 15
	DatetimeEnc  Encoding = 16
	YearEnc      Encoding = 17
	Hash128Enc   Encoding = 18
)

Constant Size Encodings

const (
	StringEnc     Encoding = 128
	ByteStringEnc Encoding = 129

	// todo(andy): experimental encodings
	DecimalEnc  Encoding = 130
	JSONEnc     Encoding = 131
	TimeEnc     Encoding = 132
	GeometryEnc Encoding = 133
)

Variable Size Encodings

type OrdinalMapping

type OrdinalMapping []int

OrdinalMapping is a mapping from one field ordering to another. It's used to construct index tuples from another index's tuples.

func (OrdinalMapping) MapOrdinal

func (om OrdinalMapping) MapOrdinal(to int) (from int)

type SlicedBuffer

type SlicedBuffer struct {
	Buf  []byte
	Offs offsets
}

func (SlicedBuffer) GetSlice

func (sb SlicedBuffer) GetSlice(i int) []byte

GetSlice returns the ith slice of |sb.Buf|.

func (SlicedBuffer) Len

func (sb SlicedBuffer) Len() int

type Triple

type Triple[V ~[]byte] []byte

func NewTriple

func NewTriple[V ~[]byte](pool pool.BuffPool, one, two, three V) (tri Triple[V])

func (Triple[V]) First

func (t Triple[V]) First() V

func (Triple[V]) Second

func (t Triple[V]) Second() V

func (Triple[V]) Third

func (t Triple[V]) Third() V

type Tuple

type Tuple []byte

func CloneTuple

func CloneTuple(pool pool.BuffPool, tup Tuple) Tuple

func HashTupleFromValue

func HashTupleFromValue(pool pool.BuffPool, value Tuple) (key Tuple)

func NewTuple

func NewTuple(pool pool.BuffPool, values ...[]byte) Tuple

func (Tuple) Count

func (tup Tuple) Count() int

func (Tuple) FieldIsNull

func (tup Tuple) FieldIsNull(i int) bool

func (Tuple) GetField

func (tup Tuple) GetField(i int) []byte

GetField returns the value for field |i|.

func (Tuple) GetManyFields

func (tup Tuple) GetManyFields(indexes []int, slices [][]byte) [][]byte

GetManyFields takes a sorted slice of ordinals |indexes| and returns the requested tuple fields. It populates field data into |slices| to avoid allocating.

type TupleBuilder

type TupleBuilder struct {
	Desc TupleDesc
	// contains filtered or unexported fields
}

func NewTupleBuilder

func NewTupleBuilder(desc TupleDesc) *TupleBuilder

func (*TupleBuilder) Build

func (tb *TupleBuilder) Build(pool pool.BuffPool) (tup Tuple)

Build materializes a Tuple from the fields written to the TupleBuilder.

func (*TupleBuilder) BuildPermissive

func (tb *TupleBuilder) BuildPermissive(pool pool.BuffPool) (tup Tuple)

BuildPermissive materializes a Tuple from the fields written to the TupleBuilder without validating nullability.

func (*TupleBuilder) PutBool

func (tb *TupleBuilder) PutBool(i int, v bool)

PutBool writes a bool to the ith field of the Tuple being built.

func (*TupleBuilder) PutByteString

func (tb *TupleBuilder) PutByteString(i int, v []byte)

PutByteString writes a []byte to the ith field of the Tuple being built.

func (*TupleBuilder) PutDecimal

func (tb *TupleBuilder) PutDecimal(i int, v string)

func (*TupleBuilder) PutFloat32

func (tb *TupleBuilder) PutFloat32(i int, v float32)

PutFloat32 writes a float32 to the ith field of the Tuple being built.

func (*TupleBuilder) PutFloat64

func (tb *TupleBuilder) PutFloat64(i int, v float64)

PutFloat64 writes a float64 to the ith field of the Tuple being built.

func (*TupleBuilder) PutGeometry

func (tb *TupleBuilder) PutGeometry(i int, v []byte)

PutGeometry writes a []byte to the ith field of the Tuple being built.

func (*TupleBuilder) PutInt16

func (tb *TupleBuilder) PutInt16(i int, v int16)

PutInt16 writes an int16 to the ith field of the Tuple being built.

func (*TupleBuilder) PutInt32

func (tb *TupleBuilder) PutInt32(i int, v int32)

PutInt32 writes an int32 to the ith field of the Tuple being built.

func (*TupleBuilder) PutInt64

func (tb *TupleBuilder) PutInt64(i int, v int64)

PutInt64 writes an int64 to the ith field of the Tuple being built.

func (*TupleBuilder) PutInt8

func (tb *TupleBuilder) PutInt8(i int, v int8)

PutInt8 writes an int8 to the ith field of the Tuple being built.

func (*TupleBuilder) PutJSON

func (tb *TupleBuilder) PutJSON(i int, v []byte)

PutJSON writes a []byte to the ith field of the Tuple being built.

func (*TupleBuilder) PutRaw

func (tb *TupleBuilder) PutRaw(i int, buf []byte)

PutRaw writes a []byte to the ith field of the Tuple being built.

func (*TupleBuilder) PutSqlTime

func (tb *TupleBuilder) PutSqlTime(i int, v string)

PutSqlTime writes a string to the ith field of the Tuple being built.

func (*TupleBuilder) PutString

func (tb *TupleBuilder) PutString(i int, v string)

PutString writes a string to the ith field of the Tuple being built.

func (*TupleBuilder) PutTimestamp

func (tb *TupleBuilder) PutTimestamp(i int, v time.Time)

func (*TupleBuilder) PutUint16

func (tb *TupleBuilder) PutUint16(i int, v uint16)

PutUint16 writes a uint16 to the ith field of the Tuple being built.

func (*TupleBuilder) PutUint32

func (tb *TupleBuilder) PutUint32(i int, v uint32)

PutUint32 writes a uint32 to the ith field of the Tuple being built.

func (*TupleBuilder) PutUint64

func (tb *TupleBuilder) PutUint64(i int, v uint64)

PutUint64 writes a uint64 to the ith field of the Tuple being built.

func (*TupleBuilder) PutUint8

func (tb *TupleBuilder) PutUint8(i int, v uint8)

PutUint8 writes a uint8 to the ith field of the Tuple being built.

func (*TupleBuilder) PutYear

func (tb *TupleBuilder) PutYear(i int, v int16)

PutYear writes an int16-encoded year to the ith field of the Tuple being built.

func (*TupleBuilder) Recycle

func (tb *TupleBuilder) Recycle()

Recycle resets the TupleBuilder so it can build a new Tuple.

type TupleComparator

type TupleComparator interface {
	// Compare compares pairs of Tuples.
	Compare(left, right Tuple, desc TupleDesc) int

	// CompareValues compares pairs of values.
	CompareValues(left, right []byte, typ Type) int
}

TupleComparator compares Tuples.

type TupleDesc

type TupleDesc struct {
	Types []Type
	// contains filtered or unexported fields
}

TupleDesc describes a Tuple set. Data structures that contain Tuples and algorithms that process Tuples use a TupleDesc's types to interpret the fields of a Tuple.

func NewTupleDescriptor

func NewTupleDescriptor(types ...Type) TupleDesc

NewTupleDescriptor makes a TupleDescriptor from |types|.

func NewTupleDescriptorWithComparator

func NewTupleDescriptorWithComparator(cmp TupleComparator, types ...Type) (td TupleDesc)

NewTupleDescriptorWithComparator returns a TupleDesc from a slice of Types.

func (TupleDesc) Comparator

func (td TupleDesc) Comparator() TupleComparator

Comparator returns the TupleDescriptor's TupleComparator.

func (TupleDesc) Compare

func (td TupleDesc) Compare(left, right Tuple) (cmp int)

Compare compares |left| and |right|.

func (TupleDesc) CompareField

func (td TupleDesc) CompareField(value []byte, i int, tup Tuple) (cmp int)

CompareField compares |value| with the ith field of |tup|.

func (TupleDesc) Count

func (td TupleDesc) Count() int

Count returns the number of fields in the TupleDesc.

func (TupleDesc) Equals

func (td TupleDesc) Equals(other TupleDesc) bool

Equals returns true if |td| and |other| have equal type slices.

func (TupleDesc) Format

func (td TupleDesc) Format(tup Tuple) string

Format prints a Tuple as a string.

func (TupleDesc) FormatValue

func (td TupleDesc) FormatValue(i int, value []byte) string

func (TupleDesc) GetBool

func (td TupleDesc) GetBool(i int, tup Tuple) (v bool, ok bool)

GetBool reads a bool from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetBytes

func (td TupleDesc) GetBytes(i int, tup Tuple) (v []byte, ok bool)

GetBytes reads a []byte from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetDecimal

func (td TupleDesc) GetDecimal(i int, tup Tuple) (v string, ok bool)

GetDecimal reads a float64 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetField

func (td TupleDesc) GetField(i int, tup Tuple) []byte

GetField returns the ith field of |tup|.

func (TupleDesc) GetFloat32

func (td TupleDesc) GetFloat32(i int, tup Tuple) (v float32, ok bool)

GetFloat32 reads a float32 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetFloat64

func (td TupleDesc) GetFloat64(i int, tup Tuple) (v float64, ok bool)

GetFloat64 reads a float64 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetGeometry

func (td TupleDesc) GetGeometry(i int, tup Tuple) (v []byte, ok bool)

GetGeometry reads a []byte from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetInt16

func (td TupleDesc) GetInt16(i int, tup Tuple) (v int16, ok bool)

GetInt16 reads an int16 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetInt32

func (td TupleDesc) GetInt32(i int, tup Tuple) (v int32, ok bool)

GetInt32 reads an int32 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetInt64

func (td TupleDesc) GetInt64(i int, tup Tuple) (v int64, ok bool)

GetInt64 reads an int64 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetInt8

func (td TupleDesc) GetInt8(i int, tup Tuple) (v int8, ok bool)

GetInt8 reads an int8 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetJSON

func (td TupleDesc) GetJSON(i int, tup Tuple) (v []byte, ok bool)

GetJSON reads a []byte from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetSqlTime

func (td TupleDesc) GetSqlTime(i int, tup Tuple) (v string, ok bool)

GetSqlTime reads a string encoded Time value from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetString

func (td TupleDesc) GetString(i int, tup Tuple) (v string, ok bool)

GetString reads a string from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetTimestamp

func (td TupleDesc) GetTimestamp(i int, tup Tuple) (v time.Time, ok bool)

GetTimestamp reads a time.Time from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetUint16

func (td TupleDesc) GetUint16(i int, tup Tuple) (v uint16, ok bool)

GetUint16 reads a uint16 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetUint32

func (td TupleDesc) GetUint32(i int, tup Tuple) (v uint32, ok bool)

GetUint32 reads a uint32 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetUint64

func (td TupleDesc) GetUint64(i int, tup Tuple) (v uint64, ok bool)

GetUint64 reads a uint64 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetUint8

func (td TupleDesc) GetUint8(i int, tup Tuple) (v uint8, ok bool)

GetUint8 reads a uint8 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) GetYear

func (td TupleDesc) GetYear(i int, tup Tuple) (v int16, ok bool)

GetYear reads an int16 from the ith field of the Tuple. If the ith field is NULL, |ok| is set to false.

func (TupleDesc) IsNull

func (td TupleDesc) IsNull(i int, tup Tuple) bool

IsNull returns true if the ith field of the Tuple is NULL.

type Type

type Type struct {
	Enc      Encoding
	Nullable bool
}

Jump to

Keyboard shortcuts

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