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> { ... }
    fn apply<Q: Query>(&self, query: Q) -> StdResult<()> { ... }
}
Expand description

Extension trait for the SqliteConnection type.

Required Methods§

source

fn begin_transaction(&self) -> StdResult<Transaction<'_>>

Begin a transaction on the connection.

source

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.

source

fn fetch<Q: Query>(&self, query: Q) -> StdResult<EntityCursor<'_, Q::Entity>>

Fetch entities from the database using the given query.

Provided Methods§

source

fn fetch_first<Q: Query>(&self, query: Q) -> StdResult<Option<Q::Entity>>

Fetch the first entity from the database returned using the given query.

source

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.

source

fn apply<Q: Query>(&self, query: Q) -> StdResult<()>

Apply a query that do not return data from the database(ie: insert, delete, …).

Object Safety§

This trait is not object safe.

Implementors§