diff options
author | Vincent Ambo <tazjin@gmail.com> | 2018-04-08T13·49+0200 |
---|---|---|
committer | Vincent Ambo <tazjin@gmail.com> | 2018-04-08T13·49+0200 |
commit | f3f509d4631eb7f968894f1f5445071164b2e515 (patch) | |
tree | d0c13a5b28058cd12fe6f0241625c73980886926 | |
parent | 72691c8d6386678be51c71d62e50d168d8fe28bb (diff) |
feat(main): Bootstrap project entrypoint
This doesn't really do anything yet.
-rw-r--r-- | src/main.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 000000000000..2cb814a3434f --- /dev/null +++ b/src/main.rs @@ -0,0 +1,26 @@ +#[macro_use] +extern crate diesel; +extern crate chrono; + +pub mod schema; +pub mod models; + +use diesel::prelude::*; +use diesel::pg::PgConnection; +use std::env; + +fn connect_db() -> PgConnection { + let db_url = env::var("DATABASE_URL") + .expect("DATABASE_URL must be set"); + + PgConnection::establish(&db_url) + .expect(&format!("Error connecting to {}", db_url)) +} + +fn main() { + use schema::threads::dsl::*; + use schema::posts::dsl::*; + + let conn = connect_db(); + let threads = threads. +} |