mirror of https://github.com/rwf2/Rocket.git
Remove upstream unmaintained 'mysql' support.
Also updates 'sqlite' dependencies.
This commit is contained in:
parent
4c0d66b6b1
commit
ff22645d3a
|
@ -35,11 +35,10 @@ uuid = ["serde", "_uuid"]
|
||||||
# The barage of user-facing database features.
|
# The barage of user-facing database features.
|
||||||
diesel_sqlite_pool = ["databases", "diesel/sqlite", "diesel/r2d2"]
|
diesel_sqlite_pool = ["databases", "diesel/sqlite", "diesel/r2d2"]
|
||||||
diesel_postgres_pool = ["databases", "diesel/postgres", "diesel/r2d2"]
|
diesel_postgres_pool = ["databases", "diesel/postgres", "diesel/r2d2"]
|
||||||
diesel_mysql_pool = ["databases", "diesel/mysql", "diesel/r2d2"]
|
|
||||||
postgres_pool = ["databases", "postgres", "r2d2_postgres"]
|
postgres_pool = ["databases", "postgres", "r2d2_postgres"]
|
||||||
mysql_pool = ["databases", "mysql", "r2d2_mysql"]
|
|
||||||
sqlite_pool = ["databases", "rusqlite", "r2d2_sqlite"]
|
sqlite_pool = ["databases", "rusqlite", "r2d2_sqlite"]
|
||||||
memcache_pool = ["databases", "memcache", "r2d2-memcache"]
|
memcache_pool = ["databases", "memcache", "r2d2-memcache"]
|
||||||
|
diesel_mysql_pool = ["databases", "diesel/mysql", "diesel/r2d2"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Global dependencies.
|
# Global dependencies.
|
||||||
|
@ -51,7 +50,7 @@ log = "0.4"
|
||||||
# Serialization and templating dependencies.
|
# Serialization and templating dependencies.
|
||||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||||
serde_json = { version = "1.0.26", optional = true }
|
serde_json = { version = "1.0.26", optional = true }
|
||||||
rmp-serde = { version = "0.14.0", optional = true }
|
rmp-serde = { version = "0.15.0", optional = true }
|
||||||
|
|
||||||
# Templating dependencies.
|
# Templating dependencies.
|
||||||
handlebars = { version = "3.0", optional = true }
|
handlebars = { version = "3.0", optional = true }
|
||||||
|
@ -65,10 +64,8 @@ diesel = { version = "1.0", default-features = false, optional = true }
|
||||||
postgres = { version = "0.19", optional = true }
|
postgres = { version = "0.19", optional = true }
|
||||||
r2d2 = { version = "0.8", optional = true }
|
r2d2 = { version = "0.8", optional = true }
|
||||||
r2d2_postgres = { version = "0.18", optional = true }
|
r2d2_postgres = { version = "0.18", optional = true }
|
||||||
mysql = { version = "18.0", optional = true }
|
rusqlite = { version = "0.24", optional = true }
|
||||||
r2d2_mysql = { version = "18.0", optional = true }
|
r2d2_sqlite = { version = "0.17", optional = true }
|
||||||
rusqlite = { version = "0.23", optional = true }
|
|
||||||
r2d2_sqlite = { version = "0.16", optional = true }
|
|
||||||
memcache = { version = "0.15", optional = true }
|
memcache = { version = "0.15", optional = true }
|
||||||
r2d2-memcache = { version = "0.6", optional = true }
|
r2d2-memcache = { version = "0.6", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
//!
|
//!
|
||||||
//! # Option 2:
|
//! # Option 2:
|
||||||
//! [global.databases.my_db]
|
//! [global.databases.my_db]
|
||||||
//! url = "mysql://root:root@localhost/my_db"
|
//! url = "postgres://root:root@localhost/my_db"
|
||||||
//!
|
//!
|
||||||
//! # With a `pool_size` key:
|
//! # With a `pool_size` key:
|
||||||
//! [global.databases]
|
//! [global.databases]
|
||||||
|
@ -320,11 +320,10 @@
|
||||||
//! | Kind | Driver | Version | `Poolable` Type | Feature |
|
//! | Kind | Driver | Version | `Poolable` Type | Feature |
|
||||||
//! |----------|-----------------------|-----------|--------------------------------|------------------------|
|
//! |----------|-----------------------|-----------|--------------------------------|------------------------|
|
||||||
//! | MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` |
|
//! | MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` |
|
||||||
//! | MySQL | [`rust-mysql-simple`] | `18` | [`mysql::Conn`] | `mysql_pool` |
|
|
||||||
//! | Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` |
|
//! | Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` |
|
||||||
//! | Postgres | [Rust-Postgres] | `0.19` | [`postgres::Client`] | `postgres_pool` |
|
//! | Postgres | [Rust-Postgres] | `0.19` | [`postgres::Client`] | `postgres_pool` |
|
||||||
//! | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` |
|
//! | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` |
|
||||||
//! | Sqlite | [`Rusqlite`] | `0.23` | [`rusqlite::Connection`] | `sqlite_pool` |
|
//! | Sqlite | [`Rusqlite`] | `0.24` | [`rusqlite::Connection`] | `sqlite_pool` |
|
||||||
//! | Memcache | [`memcache`] | `0.15` | [`memcache::Client`] | `memcache_pool` |
|
//! | Memcache | [`memcache`] | `0.15` | [`memcache::Client`] | `memcache_pool` |
|
||||||
//!
|
//!
|
||||||
//! [Diesel]: https://diesel.rs
|
//! [Diesel]: https://diesel.rs
|
||||||
|
@ -332,11 +331,9 @@
|
||||||
//! [`diesel::SqliteConnection`]: http://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html
|
//! [`diesel::SqliteConnection`]: http://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html
|
||||||
//! [`postgres::Client`]: https://docs.rs/postgres/0.19/postgres/struct.Client.html
|
//! [`postgres::Client`]: https://docs.rs/postgres/0.19/postgres/struct.Client.html
|
||||||
//! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html
|
//! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html
|
||||||
//! [`mysql::Conn`]: https://docs.rs/mysql/18/mysql/struct.Conn.html
|
|
||||||
//! [`diesel::MysqlConnection`]: http://docs.diesel.rs/diesel/mysql/struct.MysqlConnection.html
|
//! [`diesel::MysqlConnection`]: http://docs.diesel.rs/diesel/mysql/struct.MysqlConnection.html
|
||||||
//! [`Rusqlite`]: https://github.com/jgallagher/rusqlite
|
//! [`Rusqlite`]: https://github.com/jgallagher/rusqlite
|
||||||
//! [Rust-Postgres]: https://github.com/sfackler/rust-postgres
|
//! [Rust-Postgres]: https://github.com/sfackler/rust-postgres
|
||||||
//! [`rust-mysql-simple`]: https://github.com/blackbeam/rust-mysql-simple
|
|
||||||
//! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html
|
//! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html
|
||||||
//! [`memcache`]: https://github.com/aisk/rust-memcache
|
//! [`memcache`]: https://github.com/aisk/rust-memcache
|
||||||
//! [`memcache::Client`]: https://docs.rs/memcache/0.15/memcache/struct.Client.html
|
//! [`memcache::Client`]: https://docs.rs/memcache/0.15/memcache/struct.Client.html
|
||||||
|
@ -370,9 +367,6 @@ pub extern crate diesel;
|
||||||
#[cfg(feature = "postgres_pool")] pub extern crate postgres;
|
#[cfg(feature = "postgres_pool")] pub extern crate postgres;
|
||||||
#[cfg(feature = "postgres_pool")] pub extern crate r2d2_postgres;
|
#[cfg(feature = "postgres_pool")] pub extern crate r2d2_postgres;
|
||||||
|
|
||||||
#[cfg(feature = "mysql_pool")] pub extern crate mysql;
|
|
||||||
#[cfg(feature = "mysql_pool")] pub extern crate r2d2_mysql;
|
|
||||||
|
|
||||||
#[cfg(feature = "sqlite_pool")] pub extern crate rusqlite;
|
#[cfg(feature = "sqlite_pool")] pub extern crate rusqlite;
|
||||||
#[cfg(feature = "sqlite_pool")] pub extern crate r2d2_sqlite;
|
#[cfg(feature = "sqlite_pool")] pub extern crate r2d2_sqlite;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ use crate::databases::{Config, Error};
|
||||||
/// * `diesel::PgConnection`
|
/// * `diesel::PgConnection`
|
||||||
/// * `diesel::SqliteConnection`
|
/// * `diesel::SqliteConnection`
|
||||||
/// * `postgres::Connection`
|
/// * `postgres::Connection`
|
||||||
/// * `mysql::Conn`
|
|
||||||
/// * `rusqlite::Connection`
|
/// * `rusqlite::Connection`
|
||||||
///
|
///
|
||||||
/// # Implementation Guide
|
/// # Implementation Guide
|
||||||
|
@ -155,19 +154,6 @@ impl Poolable for postgres::Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "mysql_pool")]
|
|
||||||
impl Poolable for mysql::Conn {
|
|
||||||
type Manager = r2d2_mysql::MysqlConnectionManager;
|
|
||||||
type Error = std::convert::Infallible;
|
|
||||||
|
|
||||||
fn pool(db_name: &str, rocket: &rocket::Rocket) -> PoolResult<Self> {
|
|
||||||
let config = Config::from(db_name, rocket)?;
|
|
||||||
let opts = mysql::OptsBuilder::from_opts(&config.url);
|
|
||||||
let manager = r2d2_mysql::MysqlConnectionManager::new(opts);
|
|
||||||
Ok(r2d2::Pool::builder().max_size(config.pool_size).build(manager)?)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "sqlite_pool")]
|
#[cfg(feature = "sqlite_pool")]
|
||||||
impl Poolable for rusqlite::Connection {
|
impl Poolable for rusqlite::Connection {
|
||||||
type Manager = r2d2_sqlite::SqliteConnectionManager;
|
type Manager = r2d2_sqlite::SqliteConnectionManager;
|
||||||
|
|
|
@ -63,7 +63,6 @@ function test_contrib() {
|
||||||
diesel_sqlite_pool
|
diesel_sqlite_pool
|
||||||
diesel_mysql_pool
|
diesel_mysql_pool
|
||||||
postgres_pool
|
postgres_pool
|
||||||
mysql_pool
|
|
||||||
sqlite_pool
|
sqlite_pool
|
||||||
memcache_pool
|
memcache_pool
|
||||||
brotli_compression
|
brotli_compression
|
||||||
|
|
|
@ -229,11 +229,10 @@ Presently, Rocket provides built-in support for the following databases:
|
||||||
| Kind | Driver | Version | `Poolable` Type | Feature |
|
| Kind | Driver | Version | `Poolable` Type | Feature |
|
||||||
|----------|-----------------------|-----------|--------------------------------|------------------------|
|
|----------|-----------------------|-----------|--------------------------------|------------------------|
|
||||||
| MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` |
|
| MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` |
|
||||||
| MySQL | [`rust-mysql-simple`] | `18` | [`mysql::Conn`] | `mysql_pool` |
|
|
||||||
| Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` |
|
| Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` |
|
||||||
| Postgres | [Rust-Postgres] | `0.19` | [`postgres::Client`] | `postgres_pool` |
|
| Postgres | [Rust-Postgres] | `0.19` | [`postgres::Client`] | `postgres_pool` |
|
||||||
| Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` |
|
| Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` |
|
||||||
| Sqlite | [`Rusqlite`] | `0.23` | [`rusqlite::Connection`] | `sqlite_pool` |
|
| Sqlite | [`Rusqlite`] | `0.24` | [`rusqlite::Connection`] | `sqlite_pool` |
|
||||||
| Memcache | [`memcache`] | `0.15` | [`memcache::Client`] | `memcache_pool` |
|
| Memcache | [`memcache`] | `0.15` | [`memcache::Client`] | `memcache_pool` |
|
||||||
|
|
||||||
[`r2d2`]: https://crates.io/crates/r2d2
|
[`r2d2`]: https://crates.io/crates/r2d2
|
||||||
|
@ -242,11 +241,9 @@ Presently, Rocket provides built-in support for the following databases:
|
||||||
[`diesel::SqliteConnection`]: https://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html
|
[`diesel::SqliteConnection`]: https://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html
|
||||||
[`postgres::Client`]: https://docs.rs/postgres/0.19/postgres/struct.Client.html
|
[`postgres::Client`]: https://docs.rs/postgres/0.19/postgres/struct.Client.html
|
||||||
[`diesel::PgConnection`]: https://docs.diesel.rs/diesel/pg/struct.PgConnection.html
|
[`diesel::PgConnection`]: https://docs.diesel.rs/diesel/pg/struct.PgConnection.html
|
||||||
[`mysql::Conn`]: https://docs.rs/mysql/18/mysql/struct.Conn.html
|
|
||||||
[`diesel::MysqlConnection`]: https://docs.diesel.rs/diesel/mysql/struct.MysqlConnection.html
|
[`diesel::MysqlConnection`]: https://docs.diesel.rs/diesel/mysql/struct.MysqlConnection.html
|
||||||
[`Rusqlite`]: https://github.com/jgallagher/rusqlite
|
[`Rusqlite`]: https://github.com/jgallagher/rusqlite
|
||||||
[Rust-Postgres]: https://github.com/sfackler/rust-postgres
|
[Rust-Postgres]: https://github.com/sfackler/rust-postgres
|
||||||
[`rust-mysql-simple`]: https://github.com/blackbeam/rust-mysql-simple
|
|
||||||
[`diesel::PgConnection`]: https://docs.diesel.rs/diesel/pg/struct.PgConnection.html
|
[`diesel::PgConnection`]: https://docs.diesel.rs/diesel/pg/struct.PgConnection.html
|
||||||
[`memcache`]: https://github.com/aisk/rust-memcache
|
[`memcache`]: https://github.com/aisk/rust-memcache
|
||||||
[`memcache::Client`]: https://docs.rs/memcache/0.15/memcache/struct.Client.html
|
[`memcache::Client`]: https://docs.rs/memcache/0.15/memcache/struct.Client.html
|
||||||
|
|
Loading…
Reference in New Issue