Documentation
¶
Overview ¶
Package csvsrc opens CSV files for repeated, seekable reads.
A Source hides three details from the rest of the program: where the bytes live (a file on disk or a buffer in memory), what encoding they arrived in, and which delimiter separates the fields. Everything downstream just asks for a *csv.Reader positioned at a byte offset.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Source ¶
type Source struct {
Name string // display name ("-" becomes "<stdin>")
Delimiter rune
Encoding Encoding
// contains filtered or unexported fields
}
Source is an opened CSV input. Reads are cheap and repeatable: the file path is reopened per read for on-disk sources, so many readers can be live at once without sharing a file position.
func Open ¶
Open reads enough of path to work out its encoding and delimiter. A path of "-" reads standard input into memory. A non-zero delim skips delimiter detection.
func (*Source) DelimiterName ¶
DelimiterName gives a human name for the delimiter, for status lines.