pub trait SqlxBase {
Show 15 methods
// Required method
fn pool(&self) -> &DbPool;
// Provided methods
fn create_table_if_not_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table_name: &'life1 str,
create_sql: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn insert<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
transaction: Option<&'life2 mut DbTransaction<'life3>>,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn insert_and_return_key<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
sql: &'life1 str,
transaction: Option<&'life2 mut DbTransaction<'life3>>,
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>
where T: for<'r> FromRow<'r, DbRow> + Unpin + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
transaction: Option<&'life2 mut DbTransaction<'life3>>,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
transaction: Option<&'life2 mut DbTransaction<'life3>>,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn select_one<'life0, 'life1, 'async_trait, T>(
&'life0 self,
sql: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where T: for<'r> FromRow<'r, DbRow> + Unpin + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn query_one<'life0, 'life1, 'async_trait>(
&'life0 self,
sql: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<PgRow, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn select_all<'life0, 'life1, 'async_trait, T>(
&'life0 self,
sql: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
where T: for<'r> FromRow<'r, DbRow> + Unpin + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn select_page<'life0, 'life1, 'async_trait, T>(
&'life0 self,
sql: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
where T: for<'r> FromRow<'r, DbRow> + Unpin + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn count<'life0, 'life1, 'async_trait>(
&'life0 self,
sql: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn begin<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DbTransaction<'_>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn commit<'life0, 'async_trait>(
transaction: DbTransaction<'life0>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait { ... }
fn rollback<'life0, 'async_trait>(
transaction: DbTransaction<'life0>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait { ... }
}
Expand description
定义 XPlusCore trait
Required Methods§
Provided Methods§
fn create_table_if_not_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table_name: &'life1 str,
create_sql: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn insert<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
transaction: Option<&'life2 mut DbTransaction<'life3>>,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn insert_and_return_key<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, sql: &'life1 str, transaction: Option<&'life2 mut DbTransaction<'life3>>, ) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>
fn update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
transaction: Option<&'life2 mut DbTransaction<'life3>>,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
transaction: Option<&'life2 mut DbTransaction<'life3>>,
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn select_one<'life0, 'life1, 'async_trait, T>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
fn query_one<'life0, 'life1, 'async_trait>(
&'life0 self,
sql: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<PgRow, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn select_all<'life0, 'life1, 'async_trait, T>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
fn select_page<'life0, 'life1, 'async_trait, T>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
fn count<'life0, 'life1, 'async_trait>(
&'life0 self,
sql: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn begin<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DbTransaction<'_>, Error>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn commit<'life0, 'async_trait>(
transaction: DbTransaction<'life0>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
fn rollback<'life0, 'async_trait>(
transaction: DbTransaction<'life0>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.