You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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.
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.
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:
and then use it in insert as:
The same could be applied to other fields like
created_at
andupdated_at
.See also: #860 and this reddit discussion
The text was updated successfully, but these errors were encountered: