aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-23 16:08:47 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-24 15:21:32 -0700
commitb27f2317899f1d0fa2e02ade3bd9b3c396ae0685 (patch)
treea678f84a3d80e953312a98a030edbfecd3ea481c
parent72b4f6a9258053267f8436b1548d9101220497a9 (diff)
downloadfatcat-b27f2317899f1d0fa2e02ade3bd9b3c396ae0685.tar.gz
fatcat-b27f2317899f1d0fa2e02ade3bd9b3c396ae0685.zip
use diesel::r2d2 instead of r2d2 directly
-rw-r--r--rust/Cargo.lock1
-rw-r--r--rust/Cargo.toml1
-rw-r--r--rust/src/lib.rs5
3 files changed, 2 insertions, 5 deletions
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index 6d3b6e1f..21c65be1 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -301,7 +301,6 @@ dependencies = [
"iron 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"iron-slog 0.0.1 (git+https://github.com/bnewbold/iron-slog?branch=bnewbold-iron-0.6)",
"iron-test 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "r2d2 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index ee078629..0fda6950 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -12,7 +12,6 @@ diesel = { version = "1.2", features = ["postgres", "uuid", "serde_json", "chron
dotenv = "0.9.0"
clap = "*"
error-chain = "0.11"
-r2d2 = "0.8"
uuid = "0.5"
# API server
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 8069ad0b..dcefcdab 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -12,7 +12,6 @@ extern crate hyper;
#[macro_use]
extern crate error_chain;
extern crate iron;
-extern crate r2d2;
extern crate serde_json;
pub mod api_server;
@@ -42,7 +41,7 @@ use iron::middleware::AfterMiddleware;
use iron::{Request, Response};
use std::env;
-pub type ConnectionPool = r2d2::Pool<ConnectionManager<diesel::pg::PgConnection>>;
+pub type ConnectionPool = diesel::r2d2::Pool<ConnectionManager<diesel::pg::PgConnection>>;
/// Establish a direct database connection. Not currently used, but could be helpful for
/// single-threaded tests or utilities.
@@ -58,7 +57,7 @@ pub fn server() -> Result<api_server::Server> {
dotenv().ok();
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let manager = ConnectionManager::<PgConnection>::new(database_url);
- let pool = r2d2::Pool::builder()
+ let pool = diesel::r2d2::Pool::builder()
.build(manager)
.expect("Failed to create database pool.");
Ok(api_server::Server { db_pool: pool })