rivet-cli 0.2.0-beta.2

CLI tool to export PostgreSQL and MySQL to Parquet/CSV (local, S3, GCS) with tuning, preflight checks, and SQLite-backed state.
Documentation
use std::io::Write;
use std::path::Path;

use crate::error::Result;

pub struct StdoutDestination;

impl StdoutDestination {
    pub fn new() -> Result<Self> {
        Ok(Self)
    }
}

impl super::Destination for StdoutDestination {
    fn write(&self, local_path: &Path, _remote_key: &str) -> Result<()> {
        let mut src = std::fs::File::open(local_path)?;
        let stdout = std::io::stdout();
        let mut handle = stdout.lock();
        std::io::copy(&mut src, &mut handle)?;
        handle.flush()?;
        Ok(())
    }
}