Created
February 19, 2017 22:23
This file contains hidden or 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
#[derive(Queryable)] | |
pub struct Account { | |
#[diesel(type="BigInt")] | |
pub id: i32, | |
#[diesel(name="user_name", type="Nullable<VarChar>")] | |
pub username: String, | |
#[diesel(type="BigInt")] | |
pub balance: i32, | |
} | |
table! { | |
users (non_standard_primary_key) { | |
non_standard_primary_key -> Integer, | |
name -> VarChar, | |
favorite_color -> Nullable<VarChar>, | |
} | |
} | |
#[derive(Queryable)] | |
#[diesel(pk="user_id")] | |
pub struct User { | |
#[diesel(type="Integer")] | |
user_id: i32, | |
#[diesel(type="VarChar")] | |
name: String, | |
#[diesel(type="Nullable<VarChar>")] | |
favorite_color: Option<String>, | |
} | |
#[derive(Queryable)] | |
#[diesel(pk="(user_id, post_id)")] | |
pub struct Followings { | |
#[diesel(type="Integer")] | |
pub user_id: i32, | |
#[diesel(type="Integer")] | |
pub post_id: i32, | |
#[diesel(type="Bool")] | |
pub favorited: bool, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment