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.
This commit is contained in:
Jeb Rosen 2019-05-27 10:43:15 -07:00 committed by Sergio Benitez
parent da7e022f99
commit fc78eaf836
2 changed files with 35 additions and 24 deletions

View File

@ -345,18 +345,19 @@
//! The list below includes all presently supported database adapters and their //! The list below includes all presently supported database adapters and their
//! corresponding [`Poolable`] type. //! corresponding [`Poolable`] type.
//! //!
//! | Kind | Driver | `Poolable` Type | Feature | // Note: Keep this table in sync with site/guite/6-state.md
//! |----------|-----------------------|--------------------------------|------------------------| //! | Kind | Driver | Version | `Poolable` Type | Feature |
//! | MySQL | [Diesel] | [`diesel::MysqlConnection`] | `diesel_mysql_pool` | //! |----------|-----------------------|-----------|--------------------------------|------------------------|
//! | MySQL | [`rust-mysql-simple`] | [`mysql::Conn`] | `mysql_pool` | //! | MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` |
//! | Postgres | [Diesel] | [`diesel::PgConnection`] | `diesel_postgres_pool` | //! | MySQL | [`rust-mysql-simple`] | `16` | [`mysql::conn`] | `mysql_pool` |
//! | Postgres | [Rust-Postgres] | [`postgres::Connection`] | `postgres_pool` | //! | Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` |
//! | Sqlite | [Diesel] | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | //! | Postgres | [Rust-Postgres] | `0.15` | [`postgres::Connection`] | `postgres_pool` |
//! | Sqlite | [Rustqlite] | [`rusqlite::Connection`] | `sqlite_pool` | //! | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` |
//! | Neo4j | [`rusted_cypher`] | [`rusted_cypher::GraphClient`] | `cypher_pool` | //! | Sqlite | [`Rustqlite`] | `0.16` | [`rusqlite::Connection`] | `sqlite_pool` |
//! | Redis | [`redis-rs`] | [`redis::Connection`] | `redis_pool` | //! | Neo4j | [`rusted_cypher`] | `1` | [`rusted_cypher::GraphClient`] | `cypher_pool` |
//! | MongoDB | [`mongodb`] | [`mongodb::db::Database`] | `mongodb_pool` | //! | Redis | [`redis-rs`] | `0.10` | [`redis::Connection`] | `redis_pool` |
//! | Memcache | [`memcache`] | [`memcache::Client`] | `memcache_pool` | //! | MongoDB | [`mongodb`] | `0.3.12` | [`mongodb::db::Database`] | `mongodb_pool` |
//! | Memcache | [`memcache`] | `0.11` | [`memcache::Client`] | `memcache_pool` |
//! //!
//! [Diesel]: https://diesel.rs //! [Diesel]: https://diesel.rs
//! [`redis::Connection`]: https://docs.rs/redis/0.9.0/redis/struct.Connection.html //! [`redis::Connection`]: https://docs.rs/redis/0.9.0/redis/struct.Connection.html

View File

@ -177,18 +177,19 @@ three simple steps:
Presently, Rocket provides built-in support for the following databases: Presently, Rocket provides built-in support for the following databases:
| Kind | Driver | `Poolable` Type | Feature | <!-- Note: Keep this table in sync with contrib/lib/src/databases.rs -->
|----------|-----------------------|--------------------------------|------------------------| | Kind | Driver | Version | `Poolable` Type | Feature |
| MySQL | [Diesel] | [`diesel::MysqlConnection`] | `diesel_mysql_pool` | |----------|-----------------------|-----------|--------------------------------|------------------------|
| MySQL | [`rust-mysql-simple`] | [`mysql::conn`] | `mysql_pool` | | MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` |
| Postgres | [Diesel] | [`diesel::PgConnection`] | `diesel_postgres_pool` | | MySQL | [`rust-mysql-simple`] | `16` | [`mysql::conn`] | `mysql_pool` |
| Postgres | [Rust-Postgres] | [`postgres::Connection`] | `postgres_pool` | | Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` |
| Sqlite | [Diesel] | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | | Postgres | [Rust-Postgres] | `0.15` | [`postgres::Connection`] | `postgres_pool` |
| Sqlite | [`Rustqlite`] | [`rusqlite::Connection`] | `sqlite_pool` | | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` |
| Neo4j | [`rusted_cypher`] | [`rusted_cypher::GraphClient`] | `cypher_pool` | | Sqlite | [`Rustqlite`] | `0.16` | [`rusqlite::Connection`] | `sqlite_pool` |
| Redis | [`redis-rs`] | [`redis::Connection`] | `redis_pool` | | Neo4j | [`rusted_cypher`] | `1` | [`rusted_cypher::GraphClient`] | `cypher_pool` |
| MongoDB | [`mongodb`] | [`mongodb::db::Database`] | `mongodb_pool` | | Redis | [`redis-rs`] | `0.10` | [`redis::Connection`] | `redis_pool` |
| Memcache | [`memcache`] | [`memcache::Client`] | `memcache_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 [`r2d2`]: https://crates.io/crates/r2d2
[Diesel]: https://diesel.rs [Diesel]: https://diesel.rs
@ -266,6 +267,15 @@ fn get_logs(conn: LogsDbConn, id: usize) -> Result<Logs> {
} }
``` ```
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 For more on Rocket's built-in database support, see the
[`rocket_contrib::databases`] module documentation. [`rocket_contrib::databases`] module documentation.