sqlite_wasm_example/
models.rs

1use super::schema::posts;
2use diesel::prelude::*;
3use serde::Serialize;
4
5#[derive(Queryable, Selectable, Serialize)]
6#[diesel(table_name = posts)]
7#[diesel(check_for_backend(diesel::sqlite::Sqlite))]
8pub struct Post {
9    pub id: i32,
10    pub title: String,
11    pub body: String,
12    pub published: bool,
13}
14
15#[derive(Insertable)]
16#[diesel(table_name = posts)]
17pub struct NewPost<'a> {
18    pub title: &'a str,
19    pub body: &'a str,
20}