pub struct CopyToQuery<T, O> { /* private fields */ }
postgres_backend
only.Expand description
Implementations§
source§impl<T> CopyToQuery<T, NotSet>where
T: CopyTarget,
impl<T> CopyToQuery<T, NotSet>where
T: CopyTarget,
sourcepub fn load<U, C>(
self,
conn: &mut C,
) -> QueryResult<impl Iterator<Item = QueryResult<U>> + '_>where
U: FromSqlRow<<U::SelectExpression as Expression>::SqlType, Pg> + Selectable<Pg>,
U::SelectExpression: AppearsOnTable<T::Table> + CopyTarget<Table = T::Table>,
C: ExecuteCopyToConnection,
pub fn load<U, C>(
self,
conn: &mut C,
) -> QueryResult<impl Iterator<Item = QueryResult<U>> + '_>where
U: FromSqlRow<<U::SelectExpression as Expression>::SqlType, Pg> + Selectable<Pg>,
U::SelectExpression: AppearsOnTable<T::Table> + CopyTarget<Table = T::Table>,
C: ExecuteCopyToConnection,
Copy data from the database by returning an iterator of deserialized data
This function allows to easily load data from the database via a COPY TO
statement.
It does not allow to configure any settings via the with_*
method, as it internally
sets the required options itself. It will use the binary format to deserialize the result
into the specified type U
. Column selection is performed via Selectable
.
source§impl<T, O> CopyToQuery<T, O>where
O: CopyToMarker,
T: CopyTarget,
impl<T, O> CopyToQuery<T, O>where
O: CopyToMarker,
T: CopyTarget,
sourcepub fn load_raw<C>(self, conn: &mut C) -> QueryResult<impl BufRead + '_>where
C: ExecuteCopyToConnection,
pub fn load_raw<C>(self, conn: &mut C) -> QueryResult<impl BufRead + '_>where
C: ExecuteCopyToConnection,
Copy data from the database by directly accessing the provided response
This function returns a type that implements std::io::BufRead
which allows to directly read
the data as provided by the database. The exact format depends on what options are
set via the various with_*
methods.
sourcepub fn with_format(self, format: CopyFormat) -> CopyToQuery<T, CopyToOptions>
pub fn with_format(self, format: CopyFormat) -> CopyToQuery<T, CopyToOptions>
The format used for the copy statement
See the PostgreSQL documentation for more details.
sourcepub fn with_freeze(self, freeze: bool) -> CopyToQuery<T, CopyToOptions>
pub fn with_freeze(self, freeze: bool) -> CopyToQuery<T, CopyToOptions>
Whether or not the freeze
option is set
See the PostgreSQL documentation for more details.
sourcepub fn with_delimiter(self, delimiter: char) -> CopyToQuery<T, CopyToOptions>
pub fn with_delimiter(self, delimiter: char) -> CopyToQuery<T, CopyToOptions>
Which delimiter should be used for textual output formats
See the PostgreSQL documentation for more details.
sourcepub fn with_null(self, null: impl Into<String>) -> CopyToQuery<T, CopyToOptions>
pub fn with_null(self, null: impl Into<String>) -> CopyToQuery<T, CopyToOptions>
Which string should be used in place of a NULL
value
for textual output formats
See the PostgreSQL documentation for more details.
sourcepub fn with_quote(self, quote: char) -> CopyToQuery<T, CopyToOptions>
pub fn with_quote(self, quote: char) -> CopyToQuery<T, CopyToOptions>
Which quote character should be used for textual output formats
See the PostgreSQL documentation for more details.
sourcepub fn with_escape(self, escape: char) -> CopyToQuery<T, CopyToOptions>
pub fn with_escape(self, escape: char) -> CopyToQuery<T, CopyToOptions>
Which escape character should be used for textual output formats
See the PostgreSQL documentation for more details.
sourcepub fn with_header(self, set: bool) -> CopyToQuery<T, CopyToOptions>
pub fn with_header(self, set: bool) -> CopyToQuery<T, CopyToOptions>
Is a header provided as part of the textual input or not
See the PostgreSQL documentation for more details.
Trait Implementations§
Auto Trait Implementations§
impl<T, O> Freeze for CopyToQuery<T, O>
impl<T, O> RefUnwindSafe for CopyToQuery<T, O>where
T: RefUnwindSafe,
O: RefUnwindSafe,
impl<T, O> Send for CopyToQuery<T, O>
impl<T, O> Sync for CopyToQuery<T, O>
impl<T, O> Unpin for CopyToQuery<T, O>
impl<T, O> UnwindSafe for CopyToQuery<T, O>where
T: UnwindSafe,
O: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.