From fc78eaf8363f1d3346ed9f51a6168f4b55152e8a Mon Sep 17 00:00:00 2001 From: Jeb Rosen Date: Mon, 27 May 2019 10:43:15 -0700 Subject: [PATCH] Document contrib database library versions. This commit also adds a note to the contrib database documentation describing how to enable features in upstream database crates. --- contrib/lib/src/databases.rs | 25 +++++++++++++------------ site/guide/6-state.md | 34 ++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/contrib/lib/src/databases.rs b/contrib/lib/src/databases.rs index 66159922..b99f7471 100644 --- a/contrib/lib/src/databases.rs +++ b/contrib/lib/src/databases.rs @@ -345,18 +345,19 @@ //! The list below includes all presently supported database adapters and their //! corresponding [`Poolable`] type. //! -//! | Kind | Driver | `Poolable` Type | Feature | -//! |----------|-----------------------|--------------------------------|------------------------| -//! | MySQL | [Diesel] | [`diesel::MysqlConnection`] | `diesel_mysql_pool` | -//! | MySQL | [`rust-mysql-simple`] | [`mysql::Conn`] | `mysql_pool` | -//! | Postgres | [Diesel] | [`diesel::PgConnection`] | `diesel_postgres_pool` | -//! | Postgres | [Rust-Postgres] | [`postgres::Connection`] | `postgres_pool` | -//! | Sqlite | [Diesel] | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | -//! | Sqlite | [Rustqlite] | [`rusqlite::Connection`] | `sqlite_pool` | -//! | Neo4j | [`rusted_cypher`] | [`rusted_cypher::GraphClient`] | `cypher_pool` | -//! | Redis | [`redis-rs`] | [`redis::Connection`] | `redis_pool` | -//! | MongoDB | [`mongodb`] | [`mongodb::db::Database`] | `mongodb_pool` | -//! | Memcache | [`memcache`] | [`memcache::Client`] | `memcache_pool` | +// Note: Keep this table in sync with site/guite/6-state.md +//! | Kind | Driver | Version | `Poolable` Type | Feature | +//! |----------|-----------------------|-----------|--------------------------------|------------------------| +//! | MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` | +//! | MySQL | [`rust-mysql-simple`] | `16` | [`mysql::conn`] | `mysql_pool` | +//! | Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` | +//! | Postgres | [Rust-Postgres] | `0.15` | [`postgres::Connection`] | `postgres_pool` | +//! | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | +//! | Sqlite | [`Rustqlite`] | `0.16` | [`rusqlite::Connection`] | `sqlite_pool` | +//! | Neo4j | [`rusted_cypher`] | `1` | [`rusted_cypher::GraphClient`] | `cypher_pool` | +//! | Redis | [`redis-rs`] | `0.10` | [`redis::Connection`] | `redis_pool` | +//! | MongoDB | [`mongodb`] | `0.3.12` | [`mongodb::db::Database`] | `mongodb_pool` | +//! | Memcache | [`memcache`] | `0.11` | [`memcache::Client`] | `memcache_pool` | //! //! [Diesel]: https://diesel.rs //! [`redis::Connection`]: https://docs.rs/redis/0.9.0/redis/struct.Connection.html diff --git a/site/guide/6-state.md b/site/guide/6-state.md index f8cb04ac..44c7facc 100644 --- a/site/guide/6-state.md +++ b/site/guide/6-state.md @@ -177,18 +177,19 @@ three simple steps: Presently, Rocket provides built-in support for the following databases: -| Kind | Driver | `Poolable` Type | Feature | -|----------|-----------------------|--------------------------------|------------------------| -| MySQL | [Diesel] | [`diesel::MysqlConnection`] | `diesel_mysql_pool` | -| MySQL | [`rust-mysql-simple`] | [`mysql::conn`] | `mysql_pool` | -| Postgres | [Diesel] | [`diesel::PgConnection`] | `diesel_postgres_pool` | -| Postgres | [Rust-Postgres] | [`postgres::Connection`] | `postgres_pool` | -| Sqlite | [Diesel] | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | -| Sqlite | [`Rustqlite`] | [`rusqlite::Connection`] | `sqlite_pool` | -| Neo4j | [`rusted_cypher`] | [`rusted_cypher::GraphClient`] | `cypher_pool` | -| Redis | [`redis-rs`] | [`redis::Connection`] | `redis_pool` | -| MongoDB | [`mongodb`] | [`mongodb::db::Database`] | `mongodb_pool` | -| Memcache | [`memcache`] | [`memcache::Client`] | `memcache_pool` | + +| Kind | Driver | Version | `Poolable` Type | Feature | +|----------|-----------------------|-----------|--------------------------------|------------------------| +| MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` | +| MySQL | [`rust-mysql-simple`] | `16` | [`mysql::conn`] | `mysql_pool` | +| Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` | +| Postgres | [Rust-Postgres] | `0.15` | [`postgres::Connection`] | `postgres_pool` | +| Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | +| Sqlite | [`Rustqlite`] | `0.16` | [`rusqlite::Connection`] | `sqlite_pool` | +| Neo4j | [`rusted_cypher`] | `1` | [`rusted_cypher::GraphClient`] | `cypher_pool` | +| Redis | [`redis-rs`] | `0.10` | [`redis::Connection`] | `redis_pool` | +| MongoDB | [`mongodb`] | `0.3.12` | [`mongodb::db::Database`] | `mongodb_pool` | +| Memcache | [`memcache`] | `0.11` | [`memcache::Client`] | `memcache_pool` | [`r2d2`]: https://crates.io/crates/r2d2 [Diesel]: https://diesel.rs @@ -266,6 +267,15 @@ fn get_logs(conn: LogsDbConn, id: usize) -> Result { } ``` +If your application uses features of a database engine that are not available +by default, for example support for `chrono` or `uuid`, you may enable those +features by adding them in `Cargo.toml` like so: + +```toml +[dependencies] +postgres = { version = "0.15", features = ["with-chrono"] } +``` + For more on Rocket's built-in database support, see the [`rocket_contrib::databases`] module documentation.