Documentation
¶
Overview ¶
Package table reads delimited tables (CSV, TSV) for the desktop app's table viewer and workspace search (spec_029_files, spec_035_search): their delimiter and encoding (Latin-1 is decoded), a profile of their columns, and pages of rows matched by a search across columns, filters on columns and a sort, streamed so a file of hundreds of megabytes isn't loaded whole.
Index ¶
Constants ¶
const ( KindNumber = "number" KindDate = "date" KindText = "text" KindEmpty = "empty" )
The kinds of column a profile tells apart.
const MaxPage = 10_000
MaxPage is the most rows a page holds, whatever the query asks: a client asking for millions doesn't hold them all in memory.
Variables ¶
var ErrBadFilter = errors.New("bad filter")
ErrBadFilter wraps a filter that can't be read.
var SortLimit = 200_000
SortLimit is the most matching rows a page sorts: past it, the rows come in file order (filter first).
Functions ¶
func Describe ¶
Describe writes a profile as text, a line per column, for a model to read (search.enrich).
Types ¶
type Column ¶
Column is a column's name and what its values look like in the rows profiled: its kind, how many were empty, the range of a number column, and a few distinct values.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a test on one column's cell: a comparison with a number (">5", ">=5", "<5", "<=5", "=5", "!=5", a range "10..20"), equality with text ("=north", "!=north"), "empty" or "!empty", else that the cell contains the text, ignoring case.
type Format ¶
Format is how a table's bytes are read: its delimiter, and whether it's Latin-1 (Windows-1252) rather than UTF-8.
type Page ¶
Page is a page of a table: its columns, the rows asked for, how many rows matched and how many there are in all. Sorted is false when there were too many matches to sort (more than SortLimit).