Struct tokio_postgres::binary_copy::BinaryCopyInWriter
source · pub struct BinaryCopyInWriter { /* private fields */ }
Expand description
A type which serializes rows into the PostgreSQL binary copy format.
The copy must be explicitly completed via the finish
method. If it is not, the copy will be aborted.
Implementations§
source§impl BinaryCopyInWriter
impl BinaryCopyInWriter
sourcepub fn new(sink: CopyInSink<Bytes>, types: &[Type]) -> BinaryCopyInWriter
pub fn new(sink: CopyInSink<Bytes>, types: &[Type]) -> BinaryCopyInWriter
Creates a new writer which will write rows of the provided types to the provided sink.
sourcepub async fn write(
self: Pin<&mut Self>,
values: &[&(dyn ToSql + Sync)]
) -> Result<(), Error>
pub async fn write( self: Pin<&mut Self>, values: &[&(dyn ToSql + Sync)] ) -> Result<(), Error>
Writes a single row.
Panics
Panics if the number of values provided does not match the number expected.
sourcepub async fn write_raw<P, I>(
self: Pin<&mut Self>,
values: I
) -> Result<(), Error>where
P: BorrowToSql,
I: IntoIterator<Item = P>,
I::IntoIter: ExactSizeIterator,
pub async fn write_raw<P, I>( self: Pin<&mut Self>, values: I ) -> Result<(), Error>where P: BorrowToSql, I: IntoIterator<Item = P>, I::IntoIter: ExactSizeIterator,
A maximally-flexible version of write
.
Panics
Panics if the number of values provided does not match the number expected.