Skip to main content

sentinel_driver/connection/
copy_impl.rs

1use super::{copy, Connection, Result};
2
3impl Connection {
4    /// Start a COPY IN operation for bulk data loading.
5    pub async fn copy_in(&mut self, sql: &str) -> Result<copy::CopyIn<'_>> {
6        let (format, col_count) = copy::start_copy_in(&mut self.conn, sql).await?;
7        Ok(copy::CopyIn::new(&mut self.conn, format, col_count))
8    }
9
10    /// Start a COPY OUT operation for bulk data export.
11    pub async fn copy_out(&mut self, sql: &str) -> Result<copy::CopyOut<'_>> {
12        let format = copy::start_copy_out(&mut self.conn, sql).await?;
13        Ok(copy::CopyOut::new(&mut self.conn, format))
14    }
15}