Skip to main content

encode_copy_csv_cells

Function encode_copy_csv_cells 

Source
pub fn encode_copy_csv_cells(
    cells: &[Option<String>],
    delimiter: char,
    quote: char,
    null_str: &str,
) -> String
Expand description

Encode one row’s cells as a CSV line (PG COPY … WITH (FORMAT csv)). A non-NULL field is quoted when it contains the delimiter, the quote character, a CR or LF, or when its text equals null_str — so an empty string under the default empty NULL, or any value that collides with the NULL marker, reads back as itself rather than as NULL. The quote character is doubled inside a quoted field. NULL is emitted as null_str, unquoted.