-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from clux/bump-test-deps
bump test deps for pq and diesel
- Loading branch information
Showing
6 changed files
with
61 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,52 @@ | ||
// The order of these extern crate lines matter for ssl! | ||
extern crate openssl; | ||
#[macro_use] extern crate diesel; | ||
#[macro_use] | ||
extern crate diesel; | ||
// openssl must be included before diesel atm. | ||
|
||
mod schema { | ||
table! { | ||
posts (id) { | ||
id -> Int4, | ||
title -> Varchar, | ||
body -> Text, | ||
published -> Bool, | ||
} | ||
} | ||
table! { | ||
posts (id) { | ||
id -> Int4, | ||
title -> Varchar, | ||
body -> Text, | ||
published -> Bool, | ||
} | ||
} | ||
} | ||
|
||
mod models { | ||
use schema::posts; | ||
#[derive(Queryable)] | ||
pub struct Post { | ||
pub id: i32, | ||
pub title: String, | ||
pub body: String, | ||
pub published: bool, | ||
} | ||
use schema::posts; | ||
#[derive(Queryable)] | ||
pub struct Post { | ||
pub id: i32, | ||
pub title: String, | ||
pub body: String, | ||
pub published: bool, | ||
} | ||
|
||
// apparently this can be done without heap storage, but lifetimes spread far.. | ||
#[derive(Insertable)] | ||
#[table_name="posts"] | ||
pub struct NewPost { | ||
pub title: String, | ||
pub body: String, | ||
} | ||
// apparently this can be done without heap storage, but lifetimes spread far.. | ||
#[derive(Insertable)] | ||
#[diesel(table_name = posts)] | ||
pub struct NewPost { | ||
pub title: String, | ||
pub body: String, | ||
} | ||
} | ||
|
||
use diesel::prelude::*; | ||
use diesel::pg::PgConnection; | ||
use diesel::prelude::*; | ||
|
||
fn main() { | ||
let database_url = std::env::var("DATABASE_URL") | ||
.unwrap_or("postgres://localhost?connect_timeout=1&sslmode=require".into()); | ||
.unwrap_or("postgres://localhost?connect_timeout=1&sslmode=require".into()); | ||
match PgConnection::establish(&database_url) { | ||
Err(e) => { | ||
println!("Should fail to connect here:"); | ||
println!("{}", e); | ||
} | ||
Ok(_) => { | ||
unreachable!(); | ||
} | ||
Err(e) => { | ||
println!("Should fail to connect here:"); | ||
println!("{}", e); | ||
} | ||
Ok(_) => { | ||
unreachable!(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ name = "pqcrate" | |
version = "0.1.0" | ||
|
||
[dependencies] | ||
pq-sys = "0.4.5" | ||
pq-sys = "0.5" | ||
openssl = "*" |