Skip to main content

Module csv

Module csv 

Source
Expand description

CSV and TSV straight into a DynTable, fed in chunks so a stream (a file, Postgres COPY ... TO STDOUT) never has to be held whole. RFC 4180 quoting: fields in double quotes may contain the delimiter, line breaks and "" for a quote.

Structs§

CsvLoader
Parser state carried between chunks.
CsvOptions

Enums§

ColType
How a field’s text becomes a value.

Functions§

record_pieces
Where to cut data into pieces of about every records, so each piece can go to its own CsvLoader (on its own thread) and the tables be joined in order. A cut falls only after a record’s line break, never inside a quoted field, by the same quoting rules feed follows: a quote opens a quoted field only at the start of a field, so the quote in 5"10 is a character. Returns each piece’s start as (byte offset, line number), beginning with (0, 1); the first piece holds the header row, if any. Give the later pieces header: false with the first loader’s names(), and starting_at_line with their line number. Field types need nothing passed: ColType::Infer decides each value by itself, so pieces read the same values as one pass over the file.