pub struct TxOutcome { /* private fields */ }Expand description
Outcome returned by committing or rolling back a backend transaction.
Most backends do not need to surface anything after commit/rollback, but SQLite
consumes the pooled connection for the transaction and needs to hand it back
(with its translation flag) so callers can keep using the pooled wrapper.
If you started a raw SQLite transaction, continue using the connection from the returned
outcome instead of the pre-transaction wrapper to preserve the translation flag and pool state.
Implementations§
Source§impl TxOutcome
impl TxOutcome
Sourcepub fn without_restored_connection() -> Self
pub fn without_restored_connection() -> Self
Outcome with no connection to restore (common for Postgres, Turso, MSSQL).
Sourcepub fn with_restored_connection(conn: MiddlewarePoolConnection) -> Self
pub fn with_restored_connection(conn: MiddlewarePoolConnection) -> Self
Outcome that includes a connection restored to its pooled wrapper.
Sourcepub fn restored_connection(&self) -> Option<&MiddlewarePoolConnection>
pub fn restored_connection(&self) -> Option<&MiddlewarePoolConnection>
Borrow the restored connection, if present.
Sourcepub fn into_restored_connection(self) -> Option<MiddlewarePoolConnection>
pub fn into_restored_connection(self) -> Option<MiddlewarePoolConnection>
Consume the outcome and take ownership of the restored connection, if present.
Sourcepub fn restore_into(self, conn_slot: &mut MiddlewarePoolConnection)
pub fn restore_into(self, conn_slot: &mut MiddlewarePoolConnection)
Restore any pooled connection contained in this outcome back into the caller’s slot.
This is primarily useful for SQLite, where the transaction API consumes the pooled wrapper
and returns it on commit/rollback. Other backends return an empty outcome, making this a
no-op.
Sourcepub fn into_sqlite_parts(self) -> Option<(SqliteConnection, bool)>
pub fn into_sqlite_parts(self) -> Option<(SqliteConnection, bool)>
Consume the outcome and unwrap the SQLite connection + translation flag.