From 56d7e05e59aa70cdc60eb7870ff703590db4e787 Mon Sep 17 00:00:00 2001 From: Valentin Leistner Date: Sun, 7 Jan 2024 01:41:38 +0100 Subject: [PATCH] make `impl IntoFuture for Insertion` generic over Database --- core/src/insert.rs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/core/src/insert.rs b/core/src/insert.rs index fe584f7e..3c8fb87e 100644 --- a/core/src/insert.rs +++ b/core/src/insert.rs @@ -22,27 +22,7 @@ impl<'a, Acquire, Model, DB: sqlx::Database> Insertion<'a, Acquire, Model, DB> { } } - -#[cfg(feature = "sqlite")] -impl<'a, Acquire, Model> std::future::IntoFuture for Insertion<'a, Acquire, Model, sqlx::sqlite::Sqlite> - where - Model: for<'r> sqlx::FromRow<'r, sqlx::sqlite::SqliteRow> + Send + Unpin, - Acquire: Send, -{ - type Output = Result; - type IntoFuture = BoxFuture<'a, Self::Output>; - - fn into_future(self) -> Self::IntoFuture { - let q = self.insert.to_sql(Dialect::Sqlite); - (self.closure)(self.acquire, self.model, q) - } -} - -#[cfg(feature = "postgres")] -impl<'a, Acquire, Model> std::future::IntoFuture for Insertion<'a, Acquire, Model, sqlx::postgres::Postgres> - where - Model: for<'r> sqlx::FromRow<'r, sqlx::postgres::PgRow> + Send + Unpin -{ +impl<'a, Acquire, Model: crate::model::Model, DB: sqlx::Database> std::future::IntoFuture for Insertion<'a, Acquire, Model, DB> { type Output = Result; type IntoFuture = BoxFuture<'a, Self::Output>;