Last active
October 21, 2019 11:12
-
-
Save trimoq/455ddf31149d668a94a5e0df9daa7887 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
pub fn insert(con: &DbCon, new_stay: NewStay) -> Result<Stay, Error> { | |
diesel::insert_into(stay::table) | |
.values(&new_stay) | |
.get_result(&**conn) | |
} | |
pub fn get_all_for_user(con: &DbCon, user: ApiUser) -> Vec<Stay> { | |
Stay::belonging_to(&user) | |
.load::<Stay>(&**conn) | |
.unwrap() // this is quite bad but let's ignore it for the example | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment