From 8745a6cc45a30b9899212259e2f254091c36d363 Mon Sep 17 00:00:00 2001 From: dull b Date: Fri, 14 Jul 2023 05:02:52 +0000 Subject: [PATCH] Simplify Crud::read lifetimes --- crates/db_schema/src/traits.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/db_schema/src/traits.rs b/crates/db_schema/src/traits.rs index aa87322a8..0042956f1 100644 --- a/crates/db_schema/src/traits.rs +++ b/crates/db_schema/src/traits.rs @@ -67,14 +67,14 @@ where .get_result::(conn) .await }*/ - async fn read<'conn, 'conn2: 'conn, 'a: 'conn>(pool: &'conn2 mut DbPool<'a>, id: Self::IdType) -> Result - where diesel::helper_types::Limit<::PrimaryKey, Self::IdType>>>::Output>: LoadQuery<'static, DbConn<'conn>, Self> + Send + 'static + Sized + async fn read(pool: &'async_trait mut DbPool<'_>, id: Self::IdType) -> Result + where diesel::helper_types::Limit<::PrimaryKey, Self::IdType>>>::Output>: LoadQuery<'static, DbConn<'async_trait>, Self> + Send + 'static + Sized { - let mut conn = get_conn::<'conn2, 'a>(pool).await?; let col = Self::table().primary_key(); // FindDsl is not used because it uses a private trait let query = FilterDsl::filter(Self::table(), ExpressionMethods::eq(col, id)); - let future = RunQueryDsl::first::<'static, 'conn, Self>(query, &mut conn); + let mut conn = get_conn(pool).await?; + let future = RunQueryDsl::first::<'static, 'async_trait, Self>(query, &mut conn); future.await } /// when you want to null out a column, you have to send Some(None)), since sending None means you just don't want to update that column.