sentinel-driver 2.0.0

High-performance PostgreSQL wire protocol driver for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::{copy, Connection, Result};

impl Connection {
    /// Start a COPY IN operation for bulk data loading.
    pub async fn copy_in(&mut self, sql: &str) -> Result<copy::CopyIn<'_>> {
        let (format, col_count) = copy::start_copy_in(&mut self.conn, sql).await?;
        Ok(copy::CopyIn::new(&mut self.conn, format, col_count))
    }

    /// Start a COPY OUT operation for bulk data export.
    pub async fn copy_out(&mut self, sql: &str) -> Result<copy::CopyOut<'_>> {
        let format = copy::start_copy_out(&mut self.conn, sql).await?;
        Ok(copy::CopyOut::new(&mut self.conn, format))
    }
}