20 lines
446 B
Rust
20 lines
446 B
Rust
use diesel::{prelude::{Queryable, Insertable}, Selectable};
|
|
|
|
use crate::schema::posts;
|
|
|
|
#[derive(Queryable, Selectable)]
|
|
#[diesel(table_name = crate::schema::posts)]
|
|
#[diesel(check_for_backend(diesel::pg::Pg))]
|
|
pub struct Post {
|
|
pub id: i32,
|
|
pub title: String,
|
|
pub body: String,
|
|
pub published: bool,
|
|
}
|
|
|
|
#[derive(Insertable)]
|
|
#[diesel(table_name = posts)]
|
|
pub struct NuevoPost<'a> {
|
|
pub title: &'a str,
|
|
pub body: &'a str,
|
|
} |