Fix auto_increment as boolean

This commit is contained in:
Marco Napetti 2021-09-07 23:05:36 +08:00 committed by Chris Tsang
parent fa02a45fbf
commit 5567fbc289

View File

@ -100,20 +100,8 @@ pub fn expand_derive_entity_model(data: Data, attrs: Vec<Attribute>) -> syn::Res
));
}
} else if name == "auto_increment" {
if let Lit::Str(litstr) = &nv.lit {
auto_increment = match litstr.value().as_str() {
"true" => true,
"false" => false,
_ => {
return Err(Error::new(
field.span(),
format!(
"Invalid auto_increment = {}",
litstr.value()
),
))
}
};
if let Lit::Bool(litbool) = &nv.lit {
auto_increment = litbool.value();
} else {
return Err(Error::new(
field.span(),