Update to upstream diesel.

This commit is contained in:
Sergio Benitez 2016-10-12 00:38:30 -07:00
parent 2f35b23514
commit a9b12568d9
3 changed files with 10 additions and 9 deletions

View File

@ -11,8 +11,8 @@ lazy_static = "*"
serde = "0.8"
serde_json = "0.8"
serde_derive = "0.8"
diesel = { git = "https://github.com/SergioBenitez/diesel", features = ["sqlite"] }
diesel_codegen = { git = "https://github.com/SergioBenitez/diesel", default_features = false, features = ["sqlite"] }
diesel = "0.8"
diesel_codegen = { version = "0.8", features = ["sqlite"] }
[dependencies.rocket_contrib]
path = "../../contrib"

View File

@ -1,9 +1,10 @@
#![feature(plugin, custom_derive, custom_attribute, proc_macro)]
#![plugin(rocket_codegen, diesel_codegen)]
#![plugin(rocket_codegen)]
extern crate rocket;
extern crate serde_json;
#[macro_use] extern crate diesel;
#[macro_use] extern crate diesel_codegen;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate rocket_contrib;
#[macro_use] extern crate serde_derive;

View File

@ -1,19 +1,19 @@
mod schema {
infer_schema!("db/db.sql");
}
use diesel;
use diesel::prelude::*;
use diesel::sqlite::SqliteConnection;
use self::schema::tasks;
use self::schema::tasks::dsl::{tasks as all_tasks, completed as task_completed};
mod schema {
infer_schema!("db/db.sql");
}
fn db() -> SqliteConnection {
SqliteConnection::establish("db/db.sql").expect("Failed to connect to db.")
}
#[insertable_into(tasks)]
#[derive(Serialize, Queryable, FromForm, Debug, Clone)]
#[table_name = "tasks"]
#[derive(Serialize, Queryable, Insertable, FromForm, Debug, Clone)]
pub struct Task {
id: Option<i32>,
pub description: String,