-
-
Save stephanbuys/4b2c874b3731e7f93b2b4d021f8ddcff 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
fn create_post(conn: &PgConnection, title: &str, body: &str) -> Post { | |
use schema::posts; | |
let new_post = NewPost { | |
title: title, | |
body: body, | |
}; | |
diesel::insert(&new_post).into(posts::table) | |
.get_result(conn) | |
.expect("Error saving new post") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment