File tree 3 files changed +22
-3
lines changed 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 37
37
//! # async fn run_test() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
38
38
//! # use schema::users::dsl::*;
39
39
//! # 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?;
41
44
//! let mut conn = pool.get().await?;
42
45
//! # conn.begin_test_transaction();
43
46
//! # create_tables(&mut conn).await;
@@ -53,6 +56,9 @@ use bb8::ManageConnection;
53
56
use diesel:: query_builder:: QueryFragment ;
54
57
55
58
/// 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
56
62
pub type Pool < C > = bb8:: Pool < AsyncDieselConnectionManager < C > > ;
57
63
/// Type alias for using [`bb8::PooledConnection`] with [`diesel-async`]
58
64
pub type PooledConnection < ' a , C > = bb8:: PooledConnection < ' a , AsyncDieselConnectionManager < C > > ;
Original file line number Diff line number Diff line change 37
37
//! # async fn run_test() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
38
38
//! # use schema::users::dsl::*;
39
39
//! # 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()?;
41
44
//! let mut conn = pool.get().await?;
42
45
//! # conn.begin_test_transaction();
43
46
//! # create_tables(&mut conn).await;
@@ -51,6 +54,9 @@ use deadpool::managed::Manager;
51
54
use diesel:: query_builder:: QueryFragment ;
52
55
53
56
/// 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
54
60
pub type Pool < C > = deadpool:: managed:: Pool < AsyncDieselConnectionManager < C > > ;
55
61
/// Type alias for using [`deadpool::managed::PoolBuilder`] with [`diesel-async`]
56
62
pub type PoolBuilder < C > = deadpool:: managed:: PoolBuilder < AsyncDieselConnectionManager < C > > ;
Original file line number Diff line number Diff line change 37
37
//! # async fn run_test() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
38
38
//! # use schema::users::dsl::*;
39
39
//! # 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);
41
44
//! let mut conn = pool.get().await?;
42
45
//! # conn.begin_test_transaction();
43
46
//! # create_tables(&mut conn).await;
@@ -51,6 +54,10 @@ use diesel::query_builder::QueryFragment;
51
54
use mobc:: Manager ;
52
55
53
56
/// 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
54
61
pub type Pool < C > = mobc:: Pool < AsyncDieselConnectionManager < C > > ;
55
62
56
63
/// Type alias for using [`mobc::Connection`] with [`diesel-async`]
You can’t perform that action at this time.
0 commit comments