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
I often want a few tweaks to the various derivable traits that would improve quality of life quite a bit.
They are mostly inspired by serde_derive, which has similar features.
If this is ok with the maintainers, I'd start working on a PR for this.
Skip
Allow skipping of fields for AsChangeset and Insertable.
A plain skip would already be useful.
What would be even more useful is selective skipping eg only for updates.
#[derive(Queryable)]
...structUser{
....
// Will use Default::default()#[diesel(default)]extra_value:Option<_>,// Will use custom function#[diesel(default = "::user::whatever_default")]extra_value:Whatever,}
Attribute names
It seems to be an established practice to wrap attributes with the crate name to be more specific, a la serde(...), ...
It's somewhat ok for things like table_name and primary_key, but
not really for default and skip, since they are so generic.
So i'd propose wrapping for those.
Actually, I'd also propose adding new variants for the existing attributes, and maybe at some point deprecating the old ones, but that's another discussion.
The text was updated successfully, but these errors were encountered:
theduke
changed the title
Improve derive functionality
Improve derive functionality (skip and defaults)
Feb 25, 2018
I often want a few tweaks to the various derivable traits that would improve quality of life quite a bit.
They are mostly inspired by serde_derive, which has similar features.
If this is ok with the maintainers, I'd start working on a PR for this.
Skip
Allow skipping of fields for
AsChangeset
andInsertable
.A plain skip would already be useful.
What would be even more useful is selective skipping eg only for updates.
Default
Attribute names
It seems to be an established practice to wrap attributes with the crate name to be more specific, a la
serde(...)
, ...It's somewhat ok for things like
table_name
andprimary_key
, butnot really for
default
andskip
, since they are so generic.So i'd propose wrapping for those.
Actually, I'd also propose adding new variants for the existing attributes, and maybe at some point deprecating the old ones, but that's another discussion.
The text was updated successfully, but these errors were encountered: