Skip to content

Instantly share code, notes, and snippets.

@sean3z
Last active March 18, 2018 03:57
Show Gist options
  • Save sean3z/f50da005c0fd10537650ff0fe769b26c to your computer and use it in GitHub Desktop.
Save sean3z/f50da005c0fd10537650ff0fe769b26c to your computer and use it in GitHub Desktop.
bind our struct to our table
use diesel;
use diesel::prelude::*;
use diesel::mysql::MysqlConnection;
use schema::heroes;
#[table_name = "heroes"]
#[derive(Serialize, Deserialize, Queryable, Insertable)]
pub struct Hero {
pub id: Option<i32>,
pub name: String,
pub identity: String,
pub hometown: String,
pub age: i32
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment