first working instance
This commit is contained in:
commit
cfbeb07f37
13 changed files with 2555 additions and 0 deletions
20
src/db/models.rs
Normal file
20
src/db/models.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
use super::schema::posts;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Queryable, Serialize, Deserialize)]
|
||||
pub struct Post {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub body: String,
|
||||
pub published: bool,
|
||||
pub publish_date: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Insertable)]
|
||||
#[table_name = "posts"]
|
||||
pub struct NewPost<'a> {
|
||||
pub title: &'a str,
|
||||
pub body: &'a str,
|
||||
pub published: &'a bool,
|
||||
pub publish_date: &'a chrono::NaiveDateTime,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue