pub struct TransactionWeak<S> { /* private fields */ }Expand description
This is the weak version of Transaction.
The reason that it is called weak is because TransactionWeak can not guarantee
that TableRows prove the existence of their particular row.
TransactionWeak is useful because it allowes deleting rows.
Implementations§
Source§impl<S: Schema> TransactionWeak<S>
impl<S: Schema> TransactionWeak<S>
Sourcepub fn delete<T: Table<Schema = S>>(
&mut self,
val: TableRow<T>,
) -> Result<bool, T::Referer>
pub fn delete<T: Table<Schema = S>>( &mut self, val: TableRow<T>, ) -> Result<bool, T::Referer>
Sourcepub fn delete_ok<T: Table<Referer = Infallible, Schema = S>>(
&mut self,
val: TableRow<T>,
) -> bool
pub fn delete_ok<T: Table<Referer = Infallible, Schema = S>>( &mut self, val: TableRow<T>, ) -> bool
Delete a row from the database.
This is the infallible version of TransactionWeak::delete.
To be able to use this method you have to mark the table as #[no_reference] in the schema.
Sourcepub fn rusqlite_transaction<R>(
&mut self,
f: impl FnOnce(&Transaction<'_>) -> R,
) -> R
pub fn rusqlite_transaction<R>( &mut self, f: impl FnOnce(&Transaction<'_>) -> R, ) -> R
This allows you to do (almost) anything you want with the internal rusqlite::Transaction.
Note that there are some things that you should not do with the transaction, such as:
- Changes to the schema, these will result in a panic as described in Database.
- Making changes that violate foreign-key constraints (see below).
Sadly it is not possible to enable (or disable) the foreign_keys pragma during a transaction.
This means that whether this pragma is enabled depends on which [crate::migrate::ForeignKeys]
option is used and can not be changed.