From 569e9c935bd72d8bbbe0b2ea238c7b9c98ba85ca Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 27 Jun 2021 11:36:54 +0200 Subject: [PATCH] Added deps for using Diesel in Rocket --- Cargo.lock | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 6 +++++ src/main.rs | 11 ++++++-- 3 files changed, 93 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 267150d..a78c95b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -186,6 +186,7 @@ dependencies = [ "byteorder", "diesel_derives", "pq-sys", + "r2d2", ] [[package]] @@ -199,6 +200,16 @@ dependencies = [ "syn", ] +[[package]] +name = "diesel_migrations" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf3cde8413353dc7f5d72fa8ce0b99a560a359d2c5ef1e5817ca731cd9008f4c" +dependencies = [ + "migrations_internals", + "migrations_macros", +] + [[package]] name = "discard" version = "1.0.4" @@ -403,7 +414,9 @@ name = "hilde" version = "0.1.0" dependencies = [ "diesel", + "diesel_migrations", "rocket", + "rocket_sync_db_pools", ] [[package]] @@ -545,6 +558,27 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +[[package]] +name = "migrations_internals" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b4fc84e4af020b837029e017966f86a1c2d5e83e64b589963d5047525995860" +dependencies = [ + "diesel", +] + +[[package]] +name = "migrations_macros" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c" +dependencies = [ + "migrations_internals", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "mime" version = "0.3.16" @@ -743,6 +777,17 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r2d2" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f" +dependencies = [ + "log", + "parking_lot", + "scheduled-thread-pool", +] + [[package]] name = "rand" version = "0.8.4" @@ -903,6 +948,30 @@ dependencies = [ "uncased", ] +[[package]] +name = "rocket_sync_db_pools" +version = "0.1.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38cfdfebd552d075c368e641c88a5cd6ce1c58c5c710548aeb777abb48830f4b" +dependencies = [ + "diesel", + "r2d2", + "rocket", + "rocket_sync_db_pools_codegen", + "serde", + "tokio", +] + +[[package]] +name = "rocket_sync_db_pools_codegen" +version = "0.1.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267808c094db5366e1d8925aaf9f2ce05ff9b3bd92cb18c7040a1fe219c2e25" +dependencies = [ + "devise", + "quote", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -924,6 +993,15 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +[[package]] +name = "scheduled-thread-pool" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7" +dependencies = [ + "parking_lot", +] + [[package]] name = "scoped-tls" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index 906e147..6e66641 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,3 +9,9 @@ edition = "2018" [dependencies] rocket = "0.5.0-rc.1" diesel = { version = "1.4.7", features = ["postgres"] } +diesel_migrations = "1.4.0" + +[dependencies.rocket_sync_db_pools] +version = "0.1.0-rc.1" +default_features = false +features = ["diesel_postgres_pool"] diff --git a/src/main.rs b/src/main.rs index e7a11a9..00dc52d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,10 @@ -fn main() { - println!("Hello, world!"); +#[macro_use] +extern crate rocket; + +#[macro_use] +extern crate diesel_migrations; + +#[launch] +fn rocket() -> _ { + rocket::build() }