Documentation
¶
Overview ¶
Package row provides row serialization for XxSql storage engine.
Index ¶
- Constants
- func DeserializeValues(data []byte, types_ []types.TypeID) ([]types.Value, error)
- func SerializeRow(id RowID, values []types.Value) ([]byte, error)
- type Row
- type RowBuilder
- func (b *RowBuilder) Build() (*Row, error)
- func (b *RowBuilder) Set(index int, v types.Value) *RowBuilder
- func (b *RowBuilder) SetBool(index int, v bool) *RowBuilder
- func (b *RowBuilder) SetFloat(index int, v float64) *RowBuilder
- func (b *RowBuilder) SetInt(index int, v int64) *RowBuilder
- func (b *RowBuilder) SetNull(index int) *RowBuilder
- func (b *RowBuilder) SetString(index int, v string, typ types.TypeID) *RowBuilder
- type RowID
Constants ¶
const ( // RowHeaderSize is the size of the row header in bytes. // RowID (8 bytes) + ColumnCount (2 bytes) = 10 bytes RowHeaderSize = 10 // MaxRowSize is the maximum size of a row. // Limit to fit within a page with some overhead MaxRowSize = 3500 )
Variables ¶
This section is empty.
Functions ¶
func DeserializeValues ¶
DeserializeValues deserializes bytes to values (without row ID).
Types ¶
type Row ¶
type Row struct {
ID RowID
Values []types.Value
ColumnDefs []*types.ColumnInfo
}
Row represents a table row.
func DeserializeRow ¶
func DeserializeRow(data []byte, defs []*types.ColumnInfo) (*Row, error)
DeserializeRow deserializes bytes to a row. It handles the case where columns have been added after the row was created by filling missing columns with NULL values.
func NewRow ¶
func NewRow(id RowID, defs []*types.ColumnInfo) *Row
NewRow creates a new row with the given column definitions.
func (*Row) GetValueByName ¶
GetValueByName returns the value for the given column name.
type RowBuilder ¶
type RowBuilder struct {
// contains filtered or unexported fields
}
RowBuilder provides a fluent interface for building rows.
func NewRowBuilder ¶
func NewRowBuilder(id RowID, defs []*types.ColumnInfo) *RowBuilder
NewRowBuilder creates a new row builder.
func (*RowBuilder) Build ¶
func (b *RowBuilder) Build() (*Row, error)
Build returns the built row or an error.
func (*RowBuilder) Set ¶
func (b *RowBuilder) Set(index int, v types.Value) *RowBuilder
Set sets a value directly.
func (*RowBuilder) SetBool ¶
func (b *RowBuilder) SetBool(index int, v bool) *RowBuilder
SetBool sets a boolean value.
func (*RowBuilder) SetFloat ¶
func (b *RowBuilder) SetFloat(index int, v float64) *RowBuilder
SetFloat sets a float value.
func (*RowBuilder) SetInt ¶
func (b *RowBuilder) SetInt(index int, v int64) *RowBuilder
SetInt sets an integer value.
func (*RowBuilder) SetNull ¶
func (b *RowBuilder) SetNull(index int) *RowBuilder
SetNull sets a null value.
func (*RowBuilder) SetString ¶
func (b *RowBuilder) SetString(index int, v string, typ types.TypeID) *RowBuilder
SetString sets a string value.