mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
allow rename with rename_all (close #2896)
This commit is contained in:
parent
16e3f1025a
commit
22e52c1171
1 changed files with 8 additions and 7 deletions
|
@ -87,14 +87,15 @@ fn expand_derive_from_row_struct(
|
|||
));
|
||||
}
|
||||
|
||||
let id_s = attributes
|
||||
.rename
|
||||
.or_else(|| Some(id.to_string().trim_start_matches("r#").to_owned()))
|
||||
.map(|s| match container_attributes.rename_all {
|
||||
let id_s = if let Some(s) = attributes.rename {
|
||||
s
|
||||
} else {
|
||||
let s = id.to_string().trim_start_matches("r#").to_owned();
|
||||
match container_attributes.rename_all {
|
||||
Some(pattern) => rename_all(&s, pattern),
|
||||
None => s,
|
||||
})
|
||||
.unwrap();
|
||||
None => s
|
||||
}
|
||||
};
|
||||
|
||||
let expr: Expr = match (attributes.flatten, attributes.try_from, attributes.json) {
|
||||
// <No attributes>
|
||||
|
|
Loading…
Reference in a new issue