Hotfix: conditionally impl impl_try_getable_array
This commit is contained in:
parent
e9acabd847
commit
42babea318
@ -290,6 +290,22 @@ impl ActiveEnum {
|
||||
quote!()
|
||||
};
|
||||
|
||||
let impl_try_getable_array = if cfg!(feature = "postgres-array") {
|
||||
quote!(
|
||||
#[automatically_derived]
|
||||
impl sea_orm::TryGetableArray for #ident {
|
||||
fn try_get_by<I: sea_orm::ColIdx>(res: &sea_orm::QueryResult, index: I) -> std::result::Result<Vec<Self>, sea_orm::TryGetError> {
|
||||
<<Self as sea_orm::ActiveEnum>::Value as sea_orm::ActiveEnumValue>::try_get_vec_by(res, index)?
|
||||
.into_iter()
|
||||
.map(|value| <Self as sea_orm::ActiveEnum>::try_from_value(&value).map_err(Into::into))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
)
|
||||
} else {
|
||||
quote!()
|
||||
};
|
||||
|
||||
quote!(
|
||||
#[doc = " Generated by sea-orm-macros"]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@ -337,15 +353,7 @@ impl ActiveEnum {
|
||||
}
|
||||
}
|
||||
|
||||
#[automatically_derived]
|
||||
impl sea_orm::TryGetableArray for #ident {
|
||||
fn try_get_by<I: sea_orm::ColIdx>(res: &sea_orm::QueryResult, index: I) -> std::result::Result<Vec<Self>, sea_orm::TryGetError> {
|
||||
<<Self as sea_orm::ActiveEnum>::Value as sea_orm::ActiveEnumValue>::try_get_vec_by(res, index)?
|
||||
.into_iter()
|
||||
.map(|value| <Self as sea_orm::ActiveEnum>::try_from_value(&value).map_err(Into::into))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
#impl_try_getable_array
|
||||
|
||||
#[automatically_derived]
|
||||
#[allow(clippy::from_over_into)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user