feat: insert works

This commit is contained in:
2021-02-12 23:17:00 +08:00
parent fb84b0f85e
commit 4c5ee6f908
5 changed files with 34 additions and 24 deletions

View File

@@ -1,7 +1,16 @@
use crate::schema::posts;
#[derive(Queryable)]
pub struct Post {
pub id: i32,
pub title: String,
pub body: String,
pub published: bool,
}
}
#[derive(Insertable)]
#[table_name = "posts"]
pub struct NewPost<'a> {
pub title: &'a str,
pub body: &'a str,
}