MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / encode_copy_format

Function encode_copy_format

src/pgcopy/src/copy.rs:479–494  ·  view source on GitHub ↗

Encodes the given `Row` into bytes based on the given `CopyFormatParams`.

(
    params: &CopyFormatParams<'a>,
    row: &RowRef,
    typ: &SqlRelationType,
    out: &mut Vec<u8>,
)

Source from the content-addressed store, hash-verified

477
478/// Encodes the given `Row` into bytes based on the given `CopyFormatParams`.
479pub fn encode_copy_format<'a>(
480 params: &CopyFormatParams<'a>,
481 row: &RowRef,
482 typ: &SqlRelationType,
483 out: &mut Vec<u8>,
484) -> Result<(), io::Error> {
485 match params {
486 CopyFormatParams::Text(params) => encode_copy_row_text(params, row, typ, out),
487 CopyFormatParams::Csv(params) => encode_copy_row_csv(params, row, typ, out),
488 CopyFormatParams::Binary => encode_copy_row_binary(row, typ, out),
489 CopyFormatParams::Parquet => {
490 // TODO(cf2): Support Parquet over STDIN.
491 Err(io::Error::new(io::ErrorKind::Unsupported, "parquet format"))
492 }
493 }
494}
495
496pub fn encode_copy_format_header<'a>(
497 params: &CopyFormatParams<'a>,

Callers 3

append_rowMethod · 0.85
copy_rowsMethod · 0.85
test_copy_csv_rowFunction · 0.85

Calls 3

encode_copy_row_textFunction · 0.85
encode_copy_row_csvFunction · 0.85
encode_copy_row_binaryFunction · 0.85

Tested by 1

test_copy_csv_rowFunction · 0.68