Tweak lifetime

This commit is contained in:
Chris Tsang 2021-10-12 14:56:22 +08:00
parent 3a6e55ced1
commit 069040be8b
3 changed files with 6 additions and 9 deletions

View File

@ -18,7 +18,7 @@ impl<'a, A: 'a> DeleteOne<A>
where where
A: ActiveModelTrait, A: ActiveModelTrait,
{ {
pub fn exec<C>(self, db: &'a C) -> impl Future<Output = Result<DeleteResult, DbErr>> + 'a pub fn exec<C>(self, db: &'a C) -> impl Future<Output = Result<DeleteResult, DbErr>> + '_
where where
C: ConnectionTrait<'a>, C: ConnectionTrait<'a>,
{ {
@ -31,7 +31,7 @@ impl<'a, E> DeleteMany<E>
where where
E: EntityTrait, E: EntityTrait,
{ {
pub fn exec<C>(self, db: &'a C) -> impl Future<Output = Result<DeleteResult, DbErr>> + 'a pub fn exec<C>(self, db: &'a C) -> impl Future<Output = Result<DeleteResult, DbErr>> + '_
where where
C: ConnectionTrait<'a>, C: ConnectionTrait<'a>,
{ {
@ -61,8 +61,7 @@ where
Deleter::new(query).exec(db).await Deleter::new(query).exec(db).await
} }
// Only Statement impl Send async fn exec_delete<'a, C>(statement: Statement, db: &'a C) -> Result<DeleteResult, DbErr>
async fn exec_delete<'a, C>(statement: Statement, db: &C) -> Result<DeleteResult, DbErr>
where where
C: ConnectionTrait<'a>, C: ConnectionTrait<'a>,
{ {

View File

@ -28,7 +28,7 @@ where
A: ActiveModelTrait, A: ActiveModelTrait,
{ {
#[allow(unused_mut)] #[allow(unused_mut)]
pub fn exec<'a, C>(self, db: &'a C) -> impl Future<Output = Result<InsertResult<A>, DbErr>> + 'a pub fn exec<'a, C>(self, db: &'a C) -> impl Future<Output = Result<InsertResult<A>, DbErr>> + '_
where where
C: ConnectionTrait<'a>, C: ConnectionTrait<'a>,
A: 'a, A: 'a,
@ -61,7 +61,7 @@ where
} }
} }
pub fn exec<'a, C>(self, db: &'a C) -> impl Future<Output = Result<InsertResult<A>, DbErr>> + 'a pub fn exec<'a, C>(self, db: &'a C) -> impl Future<Output = Result<InsertResult<A>, DbErr>> + '_
where where
C: ConnectionTrait<'a>, C: ConnectionTrait<'a>,
A: 'a, A: 'a,
@ -71,7 +71,6 @@ where
} }
} }
// Only Statement impl Send
async fn exec_insert<'a, A, C>( async fn exec_insert<'a, A, C>(
primary_key: Option<ValueTuple>, primary_key: Option<ValueTuple>,
statement: Statement, statement: Statement,

View File

@ -32,7 +32,7 @@ impl<'a, E> UpdateMany<E>
where where
E: EntityTrait, E: EntityTrait,
{ {
pub fn exec<C>(self, db: &'a C) -> impl Future<Output = Result<UpdateResult, DbErr>> + 'a pub fn exec<C>(self, db: &'a C) -> impl Future<Output = Result<UpdateResult, DbErr>> + '_
where where
C: ConnectionTrait<'a>, C: ConnectionTrait<'a>,
{ {
@ -83,7 +83,6 @@ where
Ok(model) Ok(model)
} }
// Only Statement impl Send
async fn exec_update<'a, C>( async fn exec_update<'a, C>(
statement: Statement, statement: Statement,
db: &'a C, db: &'a C,