diff --git a/Cargo.toml b/Cargo.toml index 6f1d216f5..db69cece6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ async-stream = { version = "0.3", default-features = false } async-trait = { version = "0.1", default-features = false } chrono = { version = "0.4.30", default-features = false, optional = true } time = { version = "0.3.36", default-features = false, optional = true } -futures = { version = "0.3", default-features = false, features = ["std"] } +futures-util = { version = "0.3", default-features = false, features = ["std"] } log = { version = "0.4", default-features = false } tracing = { version = "0.1", default-features = false, features = ["attributes", "log"] } rust_decimal = { version = "1", default-features = false, optional = true } diff --git a/src/database/connection.rs b/src/database/connection.rs index d512c9695..6fb2a9968 100644 --- a/src/database/connection.rs +++ b/src/database/connection.rs @@ -1,7 +1,7 @@ use crate::{ DatabaseTransaction, DbBackend, DbErr, ExecResult, QueryResult, Statement, TransactionError, }; -use futures::Stream; +use futures_util::Stream; use std::{future::Future, pin::Pin}; /// The generic API for a database connection that can perform query or execute statements. diff --git a/src/database/mock.rs b/src/database/mock.rs index f038d8933..b872312ef 100644 --- a/src/database/mock.rs +++ b/src/database/mock.rs @@ -623,7 +623,7 @@ mod tests { #[smol_potat::test] async fn test_stream_1() -> Result<(), DbErr> { - use futures::TryStreamExt; + use futures_util::TryStreamExt; let apple = fruit::Model { id: 1, @@ -655,7 +655,7 @@ mod tests { #[smol_potat::test] async fn test_stream_2() -> Result<(), DbErr> { use fruit::Entity as Fruit; - use futures::TryStreamExt; + use futures_util::TryStreamExt; let db = MockDatabase::new(DbBackend::Postgres) .append_query_results([Vec::::new()]) @@ -672,7 +672,7 @@ mod tests { #[smol_potat::test] async fn test_stream_in_transaction() -> Result<(), DbErr> { - use futures::TryStreamExt; + use futures_util::TryStreamExt; let apple = fruit::Model { id: 1, diff --git a/src/database/stream/metric.rs b/src/database/stream/metric.rs index 9b56a36b9..cafd9628c 100644 --- a/src/database/stream/metric.rs +++ b/src/database/stream/metric.rs @@ -1,6 +1,6 @@ use std::{pin::Pin, task::Poll, time::Duration}; -use futures::Stream; +use futures_util::Stream; use crate::{DbErr, QueryResult, Statement}; diff --git a/src/database/stream/query.rs b/src/database/stream/query.rs index a8670fa3f..2b37e5a18 100644 --- a/src/database/stream/query.rs +++ b/src/database/stream/query.rs @@ -1,11 +1,11 @@ #![allow(missing_docs, unreachable_code, unused_variables)] -use futures::Stream; +use futures_util::Stream; use std::{pin::Pin, task::Poll}; use tracing::instrument; #[cfg(feature = "sqlx-dep")] -use futures::TryStreamExt; +use futures_util::TryStreamExt; #[cfg(feature = "sqlx-dep")] use sqlx::Executor; diff --git a/src/database/stream/transaction.rs b/src/database/stream/transaction.rs index 06034a105..e49bcde1f 100644 --- a/src/database/stream/transaction.rs +++ b/src/database/stream/transaction.rs @@ -4,8 +4,8 @@ use std::{ops::DerefMut, pin::Pin, task::Poll}; use tracing::instrument; #[cfg(feature = "sqlx-dep")] -use futures::TryStreamExt; -use futures::{lock::MutexGuard, Stream}; +use futures_util::TryStreamExt; +use futures_util::{lock::MutexGuard, Stream}; #[cfg(feature = "sqlx-dep")] use sqlx::Executor; diff --git a/src/database/transaction.rs b/src/database/transaction.rs index 2e58a4768..7faa134eb 100644 --- a/src/database/transaction.rs +++ b/src/database/transaction.rs @@ -5,7 +5,7 @@ use crate::{ }; #[cfg(feature = "sqlx-dep")] use crate::{sqlx_error_to_exec_err, sqlx_error_to_query_err}; -use futures::lock::Mutex; +use futures_util::lock::Mutex; #[cfg(feature = "sqlx-dep")] use sqlx::TransactionManager; use std::{future::Future, pin::Pin, sync::Arc}; diff --git a/src/driver/mock.rs b/src/driver/mock.rs index c25d1954b..619bab315 100644 --- a/src/driver/mock.rs +++ b/src/driver/mock.rs @@ -2,7 +2,7 @@ use crate::{ debug_print, error::*, DatabaseConnection, DbBackend, ExecResult, MockDatabase, QueryResult, Statement, Transaction, }; -use futures::Stream; +use futures_util::Stream; use std::{ fmt::Debug, pin::Pin, @@ -170,8 +170,8 @@ impl MockDatabaseConnection { statement: &Statement, ) -> Pin> + Send>> { match self.query_all(statement.clone()) { - Ok(v) => Box::pin(futures::stream::iter(v.into_iter().map(Ok))), - Err(e) => Box::pin(futures::stream::iter(Some(Err(e)).into_iter())), + Ok(v) => Box::pin(futures_util::stream::iter(v.into_iter().map(Ok))), + Err(e) => Box::pin(futures_util::stream::iter(Some(Err(e)).into_iter())), } } @@ -231,7 +231,7 @@ impl crate::DatabaseTransaction { inner: Arc, metric_callback: Option, ) -> Result { - use futures::lock::Mutex; + use futures_util::lock::Mutex; let backend = inner.get_database_backend(); Self::begin( Arc::new(Mutex::new(crate::InnerConnection::Mock(inner))), diff --git a/src/driver/proxy.rs b/src/driver/proxy.rs index cf852895f..870eceb63 100644 --- a/src/driver/proxy.rs +++ b/src/driver/proxy.rs @@ -134,7 +134,7 @@ impl crate::DatabaseTransaction { inner: Arc, metric_callback: Option, ) -> Result { - use futures::lock::Mutex; + use futures_util::lock::Mutex; let backend = inner.get_database_backend(); Self::begin( Arc::new(Mutex::new(crate::InnerConnection::Proxy(inner))), diff --git a/src/driver/sqlx_mysql.rs b/src/driver/sqlx_mysql.rs index 2bd4a3fff..e45f7bd27 100644 --- a/src/driver/sqlx_mysql.rs +++ b/src/driver/sqlx_mysql.rs @@ -1,4 +1,4 @@ -use futures::lock::Mutex; +use futures_util::lock::Mutex; use log::LevelFilter; use sea_query::Values; use std::{future::Future, pin::Pin, sync::Arc}; diff --git a/src/driver/sqlx_postgres.rs b/src/driver/sqlx_postgres.rs index 704db812f..36cc44326 100644 --- a/src/driver/sqlx_postgres.rs +++ b/src/driver/sqlx_postgres.rs @@ -1,4 +1,4 @@ -use futures::lock::Mutex; +use futures_util::lock::Mutex; use log::LevelFilter; use sea_query::Values; use std::{fmt::Write, future::Future, pin::Pin, sync::Arc}; diff --git a/src/driver/sqlx_sqlite.rs b/src/driver/sqlx_sqlite.rs index 4d343027f..be52477a4 100644 --- a/src/driver/sqlx_sqlite.rs +++ b/src/driver/sqlx_sqlite.rs @@ -1,4 +1,4 @@ -use futures::lock::Mutex; +use futures_util::lock::Mutex; use log::LevelFilter; use sea_query::Values; use std::{future::Future, pin::Pin, sync::Arc}; diff --git a/src/executor/paginator.rs b/src/executor/paginator.rs index d6007edd9..79401fed0 100644 --- a/src/executor/paginator.rs +++ b/src/executor/paginator.rs @@ -3,7 +3,7 @@ use crate::{ SelectTwo, SelectTwoModel, Selector, SelectorRaw, SelectorTrait, }; use async_stream::stream; -use futures::Stream; +use futures_util::Stream; use sea_query::{Alias, Expr, SelectStatement}; use std::{marker::PhantomData, pin::Pin}; @@ -307,7 +307,7 @@ mod tests { use crate::entity::prelude::*; use crate::{tests_cfg::*, ConnectionTrait, Statement}; use crate::{DatabaseConnection, DbBackend, MockDatabase, Transaction}; - use futures::TryStreamExt; + use futures_util::TryStreamExt; use once_cell::sync::Lazy; use pretty_assertions::assert_eq; use sea_query::{Alias, Expr, SelectStatement, Value}; diff --git a/src/executor/select.rs b/src/executor/select.rs index 99177626f..cdeceaa08 100644 --- a/src/executor/select.rs +++ b/src/executor/select.rs @@ -4,7 +4,7 @@ use crate::{ QueryResult, QuerySelect, Select, SelectA, SelectB, SelectTwo, SelectTwoMany, Statement, StreamTrait, TryGetableMany, }; -use futures::{Stream, TryStreamExt}; +use futures_util::{Stream, TryStreamExt}; use sea_query::{SelectStatement, Value}; use std::collections::HashMap; use std::{hash::Hash, marker::PhantomData, pin::Pin}; @@ -986,7 +986,7 @@ where { let stream = db.stream(self.stmt).await?; Ok(Box::pin(stream.and_then(|row| { - futures::future::ready(S::from_raw_query_result(row)) + futures_util::future::ready(S::from_raw_query_result(row)) }))) } } diff --git a/tests/parallel_tests.rs b/tests/parallel_tests.rs index 591f81b82..f572fe562 100644 --- a/tests/parallel_tests.rs +++ b/tests/parallel_tests.rs @@ -47,13 +47,13 @@ pub async fn crud_in_parallel(db: &DatabaseConnection) -> Result<(), DbErr> { }, ]; - let _insert_res = futures::try_join!( + let _insert_res = futures_util::try_join!( metadata[0].clone().into_active_model().insert(db), metadata[1].clone().into_active_model().insert(db), metadata[2].clone().into_active_model().insert(db), )?; - let find_res = futures::try_join!( + let find_res = futures_util::try_join!( Metadata::find_by_id(metadata[0].uuid).one(db), Metadata::find_by_id(metadata[1].uuid).one(db), Metadata::find_by_id(metadata[2].uuid).one(db), @@ -78,13 +78,13 @@ pub async fn crud_in_parallel(db: &DatabaseConnection) -> Result<(), DbErr> { active_models.1.bytes = Set(vec![1]); active_models.2.bytes = Set(vec![2]); - let _update_res = futures::try_join!( + let _update_res = futures_util::try_join!( active_models.0.clone().update(db), active_models.1.clone().update(db), active_models.2.clone().update(db), )?; - let find_res = futures::try_join!( + let find_res = futures_util::try_join!( Metadata::find_by_id(metadata[0].uuid).one(db), Metadata::find_by_id(metadata[1].uuid).one(db), Metadata::find_by_id(metadata[2].uuid).one(db), @@ -103,7 +103,7 @@ pub async fn crud_in_parallel(db: &DatabaseConnection) -> Result<(), DbErr> { ] ); - let _delete_res = futures::try_join!( + let _delete_res = futures_util::try_join!( active_models.0.delete(db), active_models.1.delete(db), active_models.2.delete(db), diff --git a/tests/stream_tests.rs b/tests/stream_tests.rs index 4ec59cc6c..4ef7c5e5e 100644 --- a/tests/stream_tests.rs +++ b/tests/stream_tests.rs @@ -8,7 +8,7 @@ pub use sea_orm::{ConnectionTrait, DbErr, QueryFilter}; #[sea_orm_macros::test] pub async fn stream() -> Result<(), DbErr> { - use futures::StreamExt; + use futures_util::StreamExt; let ctx = TestContext::new("stream").await; create_tables(&ctx.db).await?;