File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 3737//! # async fn run_test() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
3838//! # use schema::users::dsl::*;
3939//! # let config = get_config();
40- //! let pool = Pool::builder().build(config).await?;
40+ //! # #[cfg(feature = "postgres")]
41+ //! let pool: Pool<AsyncPgConnection> = Pool::builder().build(config).await?;
42+ //! # #[cfg(not(feature = "postgres"))]
43+ //! # let pool = Pool::builder().build(config).await?;
4144//! let mut conn = pool.get().await?;
4245//! # conn.begin_test_transaction();
4346//! # create_tables(&mut conn).await;
@@ -53,6 +56,9 @@ use bb8::ManageConnection;
5356use diesel:: query_builder:: QueryFragment ;
5457
5558/// Type alias for using [`bb8::Pool`] with [`diesel-async`]
59+ ///
60+ /// This is **not** equal to [`bb8::Pool`]. It already uses the correct
61+ /// connection manager and expects only the connection type as generic argument
5662pub type Pool < C > = bb8:: Pool < AsyncDieselConnectionManager < C > > ;
5763/// Type alias for using [`bb8::PooledConnection`] with [`diesel-async`]
5864pub type PooledConnection < ' a , C > = bb8:: PooledConnection < ' a , AsyncDieselConnectionManager < C > > ;
Original file line number Diff line number Diff line change 3737//! # async fn run_test() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
3838//! # use schema::users::dsl::*;
3939//! # let config = get_config();
40- //! let pool = Pool::builder(config).build()?;
40+ //! # #[cfg(feature = "postgres")]
41+ //! let pool: Pool<AsyncPgConnection> = Pool::builder(config).build()?;
42+ //! # #[cfg(not(feature = "postgres"))]
43+ //! # let pool = Pool::builder(config).build()?;
4144//! let mut conn = pool.get().await?;
4245//! # conn.begin_test_transaction();
4346//! # create_tables(&mut conn).await;
@@ -51,6 +54,9 @@ use deadpool::managed::Manager;
5154use diesel:: query_builder:: QueryFragment ;
5255
5356/// Type alias for using [`deadpool::managed::Pool`] with [`diesel-async`]
57+ ///
58+ /// This is **not** equal to [`deadpool::managed::Pool`]. It already uses the correct
59+ /// connection manager and expects only the connection type as generic argument
5460pub type Pool < C > = deadpool:: managed:: Pool < AsyncDieselConnectionManager < C > > ;
5561/// Type alias for using [`deadpool::managed::PoolBuilder`] with [`diesel-async`]
5662pub type PoolBuilder < C > = deadpool:: managed:: PoolBuilder < AsyncDieselConnectionManager < C > > ;
Original file line number Diff line number Diff line change 3737//! # async fn run_test() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
3838//! # use schema::users::dsl::*;
3939//! # let config = get_config();
40- //! let pool = Pool::new(config);
40+ //! # #[cfg(feature = "postgres")]
41+ //! let pool: Pool<AsyncPgConnection> = Pool::new(config);
42+ //! # #[cfg(not(feature = "postgres"))]
43+ //! # let pool = Pool::new(config);
4144//! let mut conn = pool.get().await?;
4245//! # conn.begin_test_transaction();
4346//! # create_tables(&mut conn).await;
@@ -51,6 +54,10 @@ use diesel::query_builder::QueryFragment;
5154use mobc:: Manager ;
5255
5356/// Type alias for using [`mobc::Pool`] with [`diesel-async`]
57+ ///
58+ ///
59+ /// This is **not** equal to [`mobc::Pool`]. It already uses the correct
60+ /// connection manager and expects only the connection type as generic argument
5461pub type Pool < C > = mobc:: Pool < AsyncDieselConnectionManager < C > > ;
5562
5663/// Type alias for using [`mobc::Connection`] with [`diesel-async`]
You can’t perform that action at this time.
0 commit comments