Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upServerSide wrapper #1291
Comments
This comment has been minimized.
|
What is your reasoning to make this a wrapper struct and not an attribute? Am I missing something or is this a subset of #860 (and thus a dupe of it)?
… Am 03.11.2017 um 01:48 schrieb Hernan Grecco ***@***.***>:
Is there a way to implement a (let's call it) ServerSide object (similar to Option) to tell diesel that a particular field should be ignored from any insert/update?
The example from the guide would then become:
#[derive(Queryable, Insertable)]
pub struct Post
{
pub id: ServerSide<i32>
,
pub title: String
,
pub body: String
,
pub published: bool
,
}
and then use it in insert as:
let new_post = NewPost {
id: None // Or another special value
title: title,
body: body,
published: false
};
diesel::insert(&new_post).into(posts::table)
.get_result(conn)
.expect("Error saving new post")
The same could be applied to other fields like created_at and updated_at.
See also: #860 and this reddit discussion
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This comment has been minimized.
|
Yeah this seems like a duplicate of #860 to me. |
sgrif
closed this
Jan 8, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hgrecco commentedNov 3, 2017
Is there a way to implement a (let's call it)
ServerSideobject (similar to Option) to tell diesel that a particular field should be ignored from any insert/update?The example from the guide would then become:
and then use it in insert as:
The same could be applied to other fields like
created_atandupdated_at.See also: #860 and this reddit discussion