Last active
July 29, 2020 01:48
-
-
Save luisvonmuller/6a080d08910d6e9376b603c654687eba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Import macros and others */ | |
use crate::schema::*; | |
/* For beeing able to serialize */ | |
use serde::Serialize; | |
#[derive(Debug, Queryable, Serialize)] | |
pub struct Hero { | |
pub id: i32, | |
pub fantasy_name: String, | |
pub real_name: Option<String>, | |
pub spotted_photo: String, | |
pub strength_level: i32, | |
} | |
#[derive(Debug, Insertable, AsChangeset)] | |
#[table_name="heroes"] | |
pub struct NewHero<'x> { | |
pub fantasy_name: &'x str, | |
pub real_name: Option<&'x str>, | |
pub spotted_photo: String, | |
pub strength_level: i32, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment