pub trait LoadConnection<B = DefaultLoadingMode>: Connection {
type Cursor<'conn, 'query>: Iterator<Item = QueryResult<<Self as LoadConnection<B>>::Row<'conn, 'query>>>
where Self: 'conn;
type Row<'conn, 'query>: Row<'conn, Self::Backend>
where Self: 'conn;
// Required method
fn load<'conn, 'query, T>(
&'conn mut self,
source: T,
) -> QueryResult<Self::Cursor<'conn, 'query>>
where T: Query + QueryFragment<Self::Backend> + QueryId + 'query,
Self::Backend: QueryMetadata<T::SqlType>;
}
Expand description
The specific part of a Connection
which actually loads data from the database
This is a separate trait to allow connection implementations to specify different loading modes via the generic parameter.
Required Associated Types§
Sourcetype Cursor<'conn, 'query>: Iterator<Item = QueryResult<<Self as LoadConnection<B>>::Row<'conn, 'query>>>
where
Self: 'conn
type Cursor<'conn, 'query>: Iterator<Item = QueryResult<<Self as LoadConnection<B>>::Row<'conn, 'query>>> where Self: 'conn
The cursor type returned by LoadConnection::load
Users should handle this as opaque type that implements Iterator
Sourcetype Row<'conn, 'query>: Row<'conn, Self::Backend>
where
Self: 'conn
type Row<'conn, 'query>: Row<'conn, Self::Backend> where Self: 'conn
The row type used as Iterator::Item
for the iterator implementation
of LoadConnection::Cursor
Required Methods§
Sourcefn load<'conn, 'query, T>(
&'conn mut self,
source: T,
) -> QueryResult<Self::Cursor<'conn, 'query>>where
T: Query + QueryFragment<Self::Backend> + QueryId + 'query,
Self::Backend: QueryMetadata<T::SqlType>,
Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.
fn load<'conn, 'query, T>(
&'conn mut self,
source: T,
) -> QueryResult<Self::Cursor<'conn, 'query>>where
T: Query + QueryFragment<Self::Backend> + QueryId + 'query,
Self::Backend: QueryMetadata<T::SqlType>,
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Executes a given query and returns any requested values
This function executes a given query and returns the
query result as given by the database. Normal users
should not use this function. Use
QueryDsl::load
instead.
This function is useful for people trying to build an alternative
dsl on top of diesel. It returns an impl Iterator<Item = QueryResult<&impl Row<Self::Backend>>
.
This type can be used to iterate over all rows returned by the database.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl LoadConnection for MysqlConnection
Available on crate features mysql
and mysql_backend
only.
impl LoadConnection for MysqlConnection
mysql
and mysql_backend
only.Source§impl LoadConnection for SqliteConnection
Available on crate feature sqlite
only.
impl LoadConnection for SqliteConnection
sqlite
only.Source§impl<B> LoadConnection<B> for PgConnectionwhere
Self: PgLoadingMode<B>,
Available on crate features postgres
and postgres_backend
only.
impl<B> LoadConnection<B> for PgConnectionwhere
Self: PgLoadingMode<B>,
postgres
and postgres_backend
only.type Cursor<'conn, 'query> = <PgConnection as PgLoadingMode<B>>::Cursor<'conn, 'query>
type Row<'conn, 'query> = <PgConnection as PgLoadingMode<B>>::Row<'conn, 'query>
Source§impl<B, M> LoadConnection<B> for PooledConnection<M>
Available on crate feature r2d2
only.
impl<B, M> LoadConnection<B> for PooledConnection<M>
r2d2
only.