diff --git a/contrib/db_pools/lib/src/lib.rs b/contrib/db_pools/lib/src/lib.rs index fb4fc0ec..88947aae 100644 --- a/contrib/db_pools/lib/src/lib.rs +++ b/contrib/db_pools/lib/src/lib.rs @@ -106,16 +106,16 @@ //! | Database | Feature | [`Pool`] Type | [`Connection`] Deref | //! |----------|---------------------|-----------------------------|---------------------------------------| //! | Postgres | `deadpool_postgres` | [`deadpool_postgres::Pool`] | [`deadpool_postgres::ClientWrapper`] | -//! | Redis | `deadpool_redis` | [`deadpool_redis::Pool`] | [`deadpool_redis::ConnectionWrapper`] | +//! | Redis | `deadpool_redis` | [`deadpool_redis::Pool`] | [`deadpool_redis::Connection`] | //! //! ## `sqlx` (v0.5) //! //! | Database | Feature | [`Pool`] Type | [`Connection`] Deref | //! |----------|-----------------|----------------------|------------------------------------| -//! | Postgres | `sqlx_postgres` | [`sqlx::PgPool`] | [`sqlx::PoolConnection`] | -//! | MySQL | `sqlx_mysql` | [`sqlx::MySqlPool`] | [`sqlx::PoolConnection`] | -//! | SQLite | `sqlx_sqlite` | [`sqlx::SqlitePool`] | [`sqlx::PoolConnection`] | -//! | MSSQL | `sqlx_mssql` | [`sqlx::MssqlPool`] | [`sqlx::PoolConnection`] | +//! | Postgres | `sqlx_postgres` | [`sqlx::PgPool`] | [`sqlx::pool::PoolConnection`] | +//! | MySQL | `sqlx_mysql` | [`sqlx::MySqlPool`] | [`sqlx::pool::PoolConnection`] | +//! | SQLite | `sqlx_sqlite` | [`sqlx::SqlitePool`] | [`sqlx::pool::PoolConnection`] | +//! | MSSQL | `sqlx_mssql` | [`sqlx::MssqlPool`] | [`sqlx::pool::PoolConnection`] | //! //! [`sqlx::PgPool`]: https://docs.rs/sqlx/0.5/sqlx/type.PgPool.html //! [`sqlx::MySqlPool`]: https://docs.rs/sqlx/0.5/sqlx/type.MySqlPool.html diff --git a/contrib/db_pools/lib/tests/databases.rs b/contrib/db_pools/lib/tests/databases.rs new file mode 100644 index 00000000..ce0bd369 --- /dev/null +++ b/contrib/db_pools/lib/tests/databases.rs @@ -0,0 +1,67 @@ +macro_rules! check_types_match { + ($feature:expr, $name:ident, $Pool:ty, $Conn:ty $(,)?) => ( + #[cfg(feature = $feature)] + mod $name { + use rocket::*; + use rocket_db_pools::{Connection, Database}; + + #[derive(Database)] + #[database("foo")] + struct Db($Pool); + + #[get("/")] + fn _db(conn: Connection) { + let _: &$Conn = &*conn; + } + } + ) +} + +check_types_match!( + "deadpool_postgres", + deadpool_postgres, + deadpool_postgres::Pool, + deadpool_postgres::ClientWrapper, +); + +check_types_match!( + "deadpool_redis", + deadpool_redis, + deadpool_redis::Pool, + deadpool_redis::Connection, +); + +check_types_match!( + "sqlx_postgres", + sqlx_postgres, + sqlx::PgPool, + sqlx::pool::PoolConnection, +); + +check_types_match!( + "sqlx_mysql", + sqlx_mysql, + sqlx::MySqlPool, + sqlx::pool::PoolConnection, +); + +check_types_match!( + "sqlx_sqlite", + sqlx_sqlite, + sqlx::SqlitePool, + sqlx::pool::PoolConnection, +); + +check_types_match!( + "sqlx_mssql", + sqlx_mssql, + sqlx::MssqlPool, + sqlx::pool::PoolConnection, +); + +check_types_match!( + "mongodb", + mongodb, + mongodb::Client, + mongodb::Client, +);