mirror of https://github.com/rwf2/Rocket.git
Update to upstream diesel.
This commit is contained in:
parent
2f35b23514
commit
a9b12568d9
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue