pub struct CopyToQuery<T, O> { /* private fields */ }
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.