INNER CODE UNIT · Rust

write_dump

gluesql/gluesql · cli/src/lib.rs:215

fn write_dump<T: Store>(storage: &T, file: &mut File) -> Result<()> {
    let schemas = storage.fetch_all_schemas()?;
    for schema in schemas {
        writeln!(file, "{}", schema.to_ddl())?;

        let mut rows = storage
            .scan_data(&schema.table_name)?
            .map(|result| result.map(|(_, row)| row));

        loop {
            let exprs_list = rows
                .by_ref()
                .take(100)
                .map(|result| {
                    result.map(|row| row.into_iter().map(Expr::Value).collect::<Vec<_>>())
                })
                .collect::<std::result::Result<Vec<_>, _>>()?;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…