Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ErrCSV marks a CSV parse failure. ErrCSV errs.Const = "csv" // ErrJSON marks a JSON encoding failure. ErrJSON errs.Const = "json" )
The package's error vocabulary: errs.Const sentinels matched with errors.Is.
View Source
const ( FromCSVWithHeader fromCSVNoHeader = false FromCSVWithoutHeader fromCSVNoHeader = true FromCSVNoTrim fromCSVTrimSpaces = false FromCSVTrim fromCSVTrimSpaces = true )
Variables ¶
This section is empty.
Functions ¶
func FromCsv ¶
FromCsv returns a command that converts CSV input into newline-delimited JSON: each row becomes one compact JSON object keyed by the column headers.
Flags:
- Delimiter(r): field delimiter (default ',')
- FromCSVWithoutHeader: treat every row as data and synthesize col1, col2…
- FromCSVTrim: trim leading whitespace in each field
Input is buffered so the CSV reader can honor quoted fields that span lines.
Types ¶
Click to show internal directories.
Click to hide internal directories.