pub trait ConnectionExtensions {
// Required methods
fn begin_transaction(&self) -> StdResult<Transaction<'_>>;
fn query_single_cell<Q: AsRef<str>, T: ReadableWithIndex>(
&self,
sql: Q,
params: &[Value],
) -> StdResult<T>;
fn fetch<Q: Query>(
&self,
query: Q,
) -> StdResult<EntityCursor<'_, Q::Entity>>;
// Provided methods
fn fetch_first<Q: Query>(&self, query: Q) -> StdResult<Option<Q::Entity>> { ... }
fn fetch_collect<Q: Query, B: FromIterator<Q::Entity>>(
&self,
query: Q,
) -> StdResult<B> { ... }
}
Expand description
Extension trait for the SqliteConnection type.
Required Methods§
sourcefn begin_transaction(&self) -> StdResult<Transaction<'_>>
fn begin_transaction(&self) -> StdResult<Transaction<'_>>
Begin a transaction on the connection.
sourcefn query_single_cell<Q: AsRef<str>, T: ReadableWithIndex>(
&self,
sql: Q,
params: &[Value],
) -> StdResult<T>
fn query_single_cell<Q: AsRef<str>, T: ReadableWithIndex>( &self, sql: Q, params: &[Value], ) -> StdResult<T>
Execute the given sql query and return the value of the first cell read.
Provided Methods§
sourcefn fetch_first<Q: Query>(&self, query: Q) -> StdResult<Option<Q::Entity>>
fn fetch_first<Q: Query>(&self, query: Q) -> StdResult<Option<Q::Entity>>
Fetch the first entity from the database returned using the given query.
sourcefn fetch_collect<Q: Query, B: FromIterator<Q::Entity>>(
&self,
query: Q,
) -> StdResult<B>
fn fetch_collect<Q: Query, B: FromIterator<Q::Entity>>( &self, query: Q, ) -> StdResult<B>
Fetch entities from the database using the given query and collect the result in a collection.
Object Safety§
This trait is not object safe.