Documentation
¶
Overview ¶
Package data provides the in-memory columnar table model shared by every part of the application: file readers, the SQL engine, database backends and the UI all speak *data.Frame.
Index ¶
- func EstimatedSize(f *Frame) int64
- func FormatValue(v any) string
- func NullCount(c *Column) int
- func SearchExact(f *Frame, needle string) []int
- func SearchExactCols(f *Frame, cols []int, needle string) []int
- func SearchFuzzy(f *Frame, needle string) []int
- func Shape(f *Frame) (rows, cols int)
- type Column
- type DType
- type Frame
- func (f *Frame) AppendRow(vals []any)
- func (f *Frame) Cell(row, col int) any
- func (f *Frame) CellString(row, col int) string
- func (f *Frame) ColumnIndex(name string) int
- func (f *Frame) ColumnNames() []string
- func (f *Frame) NumCols() int
- func (f *Frame) NumRows() int
- func (f *Frame) Row(row int) []any
- func (f *Frame) Select(rows []int) *Frame
- func (f *Frame) WithCell(row, col int, val any) *Frame
- func (f *Frame) WithoutRows(rows []int) *Frame
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimatedSize ¶
EstimatedSize returns a rough in-memory footprint of the frame in bytes: strings count as len+16 (bytes plus header), time.Time values as 24, and every other cell (int64, float64, bool, null) as 16.
func SearchExact ¶
SearchExact returns the indices of rows where at least one cell's display string contains needle (case-sensitive). An empty needle matches every row.
func SearchExactCols ¶
SearchExactCols returns the indices of rows where at least one of the given column cells contains needle (case-insensitive). Use this when you want to restrict search to a known subset of columns (e.g. only the visible ones).
func SearchFuzzy ¶
SearchFuzzy returns the indices of rows whose joined display string fuzzily matches needle, in frame order. An empty needle matches every row.
Types ¶
type Column ¶
Cell values are one of: nil (null), string, int64, float64, bool, time.Time. Readers must normalize to exactly these representations.
type Frame ¶
type Frame struct {
Columns []Column
}
Frame is an immutable-by-convention table. Operations that transform a frame (filter, sort, query, cast) produce a new Frame.
func Concat ¶
Concat vertically concatenates frames. The result's columns are the union of the input column names in first-seen order; rows from frames lacking a column get null cells there. When the same column name carries different types across frames, the unified column becomes TypeString and every non-null value is rendered with FormatValue.
func InferFrame ¶
InferFrame converts string-typed columns produced by text readers to concrete types. It never mutates f; a new frame is returned (unconverted columns share their cell slices with f).
mode is one of:
"no" return f unchanged.
"fast" decide each column's type by sampling its first 128 rows, then
convert every row. Values outside the sample that fail to parse
become null: converting with null-on-failure keeps the column
homogeneous, at the cost of dropping the odd unparsable cell.
"safe" scan all rows; a column is converted only when every non-empty
cell parses as the candidate type.
types selects which candidate types are considered: any subset of "int", "float", "boolean", "date", "datetime", or ["all"] for all five. An empty list defaults to int+float.
Empty-string cells (after trimming ASCII space) count as null candidates: they never veto a conversion and become nil in converted columns. Columns containing non-string, non-nil cells are left untouched.
func (*Frame) CellString ¶
CellString renders the value at (row, col) for display.
func (*Frame) ColumnIndex ¶
ColumnIndex returns the index of the named column, or -1.
func (*Frame) ColumnNames ¶
func (*Frame) WithCell ¶
WithCell returns a copy of f with the cell at (row, col) replaced by val. The column type is preserved.
func (*Frame) WithoutRows ¶
WithoutRows returns a copy of f with the rows at the given indices removed. Indices are 0-based; out-of-range indices are ignored. Row order of the surviving rows is preserved.