pub enum MiddlewarePoolConnection {
Postgres(Object),
Sqlite(SqliteConnection),
}Variants§
Postgres(Object)
Sqlite(SqliteConnection)
Implementations§
Source§impl MiddlewarePoolConnection
impl MiddlewarePoolConnection
Sourcepub async fn with_sqlite_connection<F, R>(
&mut self,
func: F,
) -> Result<R, SqlMiddlewareDbError>where
F: FnOnce(&mut Connection) -> Result<R, SqlMiddlewareDbError> + Send + 'static,
R: Send + 'static,
pub async fn with_sqlite_connection<F, R>(
&mut self,
func: F,
) -> Result<R, SqlMiddlewareDbError>where
F: FnOnce(&mut Connection) -> Result<R, SqlMiddlewareDbError> + Send + 'static,
R: Send + 'static,
Run synchronous SQLite work on the underlying worker-owned connection.
§Errors
Returns SqlMiddlewareDbError::Unimplemented when the connection is not SQLite.
Sourcepub async fn prepare_sqlite_statement(
&mut self,
query: &str,
) -> Result<SqlitePreparedStatement, SqlMiddlewareDbError>
pub async fn prepare_sqlite_statement( &mut self, query: &str, ) -> Result<SqlitePreparedStatement, SqlMiddlewareDbError>
Prepare a SQLite statement and obtain a reusable handle backed by the worker thread.
§Errors
Returns SqlMiddlewareDbError::Unimplemented when the underlying connection is not
SQLite, or propagates any preparation error reported by the worker thread.
Source§impl MiddlewarePoolConnection
impl MiddlewarePoolConnection
Sourcepub async fn interact_async<F, Fut>(
&mut self,
func: F,
) -> Result<Fut::Output, SqlMiddlewareDbError>where
F: FnOnce(AnyConnWrapper<'_>) -> Fut + Send + 'static,
Fut: Future<Output = Result<(), SqlMiddlewareDbError>> + Send + 'static,
pub async fn interact_async<F, Fut>(
&mut self,
func: F,
) -> Result<Fut::Output, SqlMiddlewareDbError>where
F: FnOnce(AnyConnWrapper<'_>) -> Fut + Send + 'static,
Fut: Future<Output = Result<(), SqlMiddlewareDbError>> + Send + 'static,
Interact with the connection asynchronously
§Errors
Returns SqlMiddlewareDbError::Unimplemented for unsupported database types.
Sourcepub async fn interact_sync<F, R>(&self, f: F) -> Result<R, SqlMiddlewareDbError>
pub async fn interact_sync<F, R>(&self, f: F) -> Result<R, SqlMiddlewareDbError>
Interact with the connection synchronously
§Errors
Returns SqlMiddlewareDbError::Unimplemented for unsupported database types.
Trait Implementations§
Source§impl AsyncDatabaseExecutor for MiddlewarePoolConnection
impl AsyncDatabaseExecutor for MiddlewarePoolConnection
Source§fn execute_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SqlMiddlewareDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), SqlMiddlewareDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executes a batch of SQL queries within a transaction by delegating to the specific database module.
Source§fn execute_select<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
params: &'life2 [RowValues],
) -> Pin<Box<dyn Future<Output = Result<ResultSet, SqlMiddlewareDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_select<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
params: &'life2 [RowValues],
) -> Pin<Box<dyn Future<Output = Result<ResultSet, SqlMiddlewareDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Executes a single SELECT statement and returns the result set.
Source§fn execute_dml<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
params: &'life2 [RowValues],
) -> Pin<Box<dyn Future<Output = Result<usize, SqlMiddlewareDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_dml<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
query: &'life1 str,
params: &'life2 [RowValues],
) -> Pin<Box<dyn Future<Output = Result<usize, SqlMiddlewareDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Executes a single DML statement (INSERT, UPDATE, DELETE, etc.) and returns the number of rows affected.
Auto Trait Implementations§
impl Freeze for MiddlewarePoolConnection
impl !RefUnwindSafe for MiddlewarePoolConnection
impl Send for MiddlewarePoolConnection
impl Sync for MiddlewarePoolConnection
impl Unpin for MiddlewarePoolConnection
impl !UnwindSafe for MiddlewarePoolConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more