row

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: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	KeylessCardinalityTagIdx = uint64(0)
	KeylessCardinalityValIdx = uint64(1)
	KeylessFirstValIdx       = uint64(2)
)

Variables

View Source
var ErrRowNotValid = errors.New("invalid row for current schema")
View Source
var ErrZeroCardinality = fmt.Errorf("read row with zero cardinality")
View Source
var TupleFmt = FieldSeparatedTupleFmt(',')

Functions

func AddToTaggedVals

func AddToTaggedVals(tv TaggedValues, t types.Tuple) error

func AreEqual

func AreEqual(row1, row2 Row, sch schema.Schema) bool

func CountCellDiffs

func CountCellDiffs(from, to types.Tuple) (uint64, error)

CountCellDiffs returns the number of fields that are different between two tuples and does not panic if tuples are different lengths.

func GetFieldByName

func GetFieldByName(colName string, r Row, sch schema.Schema) (types.Value, bool)

func GetFieldByNameWithDefault

func GetFieldByNameWithDefault(colName string, defVal types.Value, r Row, sch schema.Schema) types.Value

func GetInvalidCol

func GetInvalidCol(r Row, sch schema.Schema) (*schema.Column, error)

GetInvalidCol returns the first column in the schema that fails a constraint, or nil if none do.

func GetInvalidConstraint

func GetInvalidConstraint(r Row, sch schema.Schema) (*schema.Column, schema.ColConstraint, error)

GetInvalidConstraint returns the failed constraint for the row given (previously identified by IsValid) along with the column with that constraint. Note that if there is a problem with the row besides the constraint, the constraint return value will be nil.

func IsEmpty

func IsEmpty(r Row) (b bool)

func IsValid

func IsValid(r Row, sch schema.Schema) (bool, error)

IsValid returns whether the row given matches the types and satisfies all the constraints of the schema given.

func IterDoltTuple

func IterDoltTuple(t types.Tuple, cb func(tag uint64, val types.Value) error) error

func IterPkTuple

func IterPkTuple(tvs types.TupleValueSlice, cb func(tag uint64, val types.Value) (stop bool, err error)) error

func ReduceToIndexKeysFromTagMap

func ReduceToIndexKeysFromTagMap(nbf *types.NomsBinFormat, idx schema.Index, tagToVal map[uint64]types.Value, tf *types.TupleFactory) (types.Tuple, types.Tuple, error)

ReduceToIndexKeysFromTagMap creates a full key and a partial key from the given map of tags (first tuple being the full key). Please refer to the note in the index editor for more information regarding partial keys.

func ReduceToIndexPartialKey

func ReduceToIndexPartialKey(idx schema.Index, r Row) (types.Tuple, error)

ReduceToIndexPartialKey creates an index record from a primary storage record.

func TaggedValsEqualForSch

func TaggedValsEqualForSch(tv, other TaggedValues, sch schema.Schema) bool

func ToNoms

func ToNoms(ctx context.Context, sch schema.Schema, r Row) (key, val types.Tuple, err error)

ToNoms returns the storage-layer tuples corresponding to |r|.

Types

type Row

type Row interface {
	// Iterates over all the columns in the row. Columns that have no value set will not be visited.
	IterCols(cb func(tag uint64, val types.Value) (stop bool, err error)) (bool, error)

	// Iterates over all columns in the schema, using the value for the row. Columns that have no value set in this row
	// will still be visited, and receive a nil value.
	IterSchema(sch schema.Schema, cb func(tag uint64, val types.Value) (stop bool, err error)) (bool, error)

	// Returns the value for the column with the tag given, and a success bool. The value will be null if the row
	// doesn't contain a value for that tag.
	GetColVal(tag uint64) (types.Value, bool)

	// Format returns the types.NomsBinFormat for this row.
	Format() *types.NomsBinFormat

	// SetColVal sets a value for the column with the tag given, returning a new row with the update.
	SetColVal(tag uint64, val types.Value, sch schema.Schema) (Row, error)

	// NomsMapKey returns the noms map key for this row, using the schema provided.
	NomsMapKey(sch schema.Schema) types.LesserValuable

	// NomsMapValue returns the noms map value for this row, using the schema provided.
	NomsMapValue(sch schema.Schema) types.Valuable

	// NomsMapKeyTuple returns the noms map key tuple for this row, using the schema provided
	NomsMapKeyTuple(sch schema.Schema, tf *types.TupleFactory) (types.Tuple, error)

	// NomsMapValueTuple returns the noms map value tuple for this row, using the schema provided.
	NomsMapValueTuple(sch schema.Schema, tf *types.TupleFactory) (types.Tuple, error)

	// TaggedValues returns the row as TaggedValues.
	TaggedValues() (TaggedValues, error)

	// ReduceToIndexKeys returns full and partial index keys
	ReduceToIndexKeys(idx schema.Index, tf *types.TupleFactory) (full types.Tuple, partial types.Tuple, value types.Tuple, err error)
}

func FromNoms

func FromNoms(sch schema.Schema, nomsKey, nomsVal types.Tuple) (Row, error)

func KeylessRow

func KeylessRow(nbf *types.NomsBinFormat, vals ...types.Value) (Row, error)

func KeylessRowsFromTuples

func KeylessRowsFromTuples(key, val types.Tuple) (Row, uint64, error)

func New

func New(nbf *types.NomsBinFormat, sch schema.Schema, colVals TaggedValues) (Row, error)

type RowFormatFunc

type RowFormatFunc func(ctx context.Context, r Row, sch schema.Schema) string

func FieldSeparatedFmt

func FieldSeparatedFmt(delim rune) RowFormatFunc

type TaggedValues

type TaggedValues map[uint64]types.Value

func KeyAndTaggedValuesForRow

func KeyAndTaggedValuesForRow(r Row, sch schema.Schema) (types.Tuple, TaggedValues, error)

func ParseTaggedValues

func ParseTaggedValues(tpl types.Tuple) (TaggedValues, error)

func TaggedValuesFromTupleKeyAndValue

func TaggedValuesFromTupleKeyAndValue(key, value types.Tuple) (TaggedValues, error)

func TaggedValuesFromTupleValueSlice

func TaggedValuesFromTupleValueSlice(vals types.TupleValueSlice) (TaggedValues, error)

func (TaggedValues) Get

func (tt TaggedValues) Get(tag uint64) (types.Value, bool)

func (TaggedValues) GetWithDefault

func (tt TaggedValues) GetWithDefault(tag uint64, def types.Value) types.Value

func (TaggedValues) Iter

func (tt TaggedValues) Iter(cb func(tag uint64, val types.Value) (stop bool, err error)) (bool, error)

func (TaggedValues) NomsTupleForNonPKCols

func (tt TaggedValues) NomsTupleForNonPKCols(nbf *types.NomsBinFormat, nonPKCols *schema.ColCollection) TupleVals

func (TaggedValues) NomsTupleForPKCols

func (tt TaggedValues) NomsTupleForPKCols(nbf *types.NomsBinFormat, pkCols *schema.ColCollection) TupleVals

func (TaggedValues) Set

func (tt TaggedValues) Set(tag uint64, val types.Value) TaggedValues

func (TaggedValues) String

func (tt TaggedValues) String() string

func (TaggedValues) ToRow

func (tt TaggedValues) ToRow(ctx context.Context, nbf *types.NomsBinFormat, sch schema.Schema) (Row, error)

type TupleFormatFunc

type TupleFormatFunc func(ctx context.Context, t types.Tuple) string

func FieldSeparatedTupleFmt

func FieldSeparatedTupleFmt(delim rune) TupleFormatFunc

type TupleVals

type TupleVals struct {
	// contains filtered or unexported fields
}

func (TupleVals) Kind

func (tvs TupleVals) Kind() types.NomsKind

func (TupleVals) Less

func (tvs TupleVals) Less(nbf *types.NomsBinFormat, other types.LesserValuable) (bool, error)

func (TupleVals) Value

func (tvs TupleVals) Value(ctx context.Context) (types.Value, error)

Jump to

Keyboard shortcuts

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