|
@@ -204,19 +204,19 @@ impl<'l> QueryInterface<'l> {
|
|
|
|
|
|
/// Search for an entity by multiple properties
|
|
|
pub fn get_one_by_multi<
|
|
|
- C: EntityColumn,
|
|
|
+ T: Entity
|
|
|
>(
|
|
|
&self,
|
|
|
- c: &[&dyn EntityColumn<Entity = C::Entity>],
|
|
|
+ c: &[&dyn EntityColumn<Entity = T>],
|
|
|
val: &[&dyn crate::model::Modelable],
|
|
|
- ) -> Option<WithID<C::Entity>> {
|
|
|
- let table_name = <C::Entity as Entity>::table_name();
|
|
|
+ ) -> Option<WithID<T>> {
|
|
|
+ let table_name = T::table_name();
|
|
|
|
|
|
assert_eq!(c.len(), val.len());
|
|
|
|
|
|
self.cached_query_column(
|
|
|
"get_one_by_multi",
|
|
|
- std::any::TypeId::of::<C::Entity>(),
|
|
|
+ std::any::TypeId::of::<T>(),
|
|
|
c,
|
|
|
&|| {
|
|
|
let query = format!(
|
|
@@ -239,7 +239,7 @@ impl<'l> QueryInterface<'l> {
|
|
|
|
|
|
self.expect_one_result(stmt, &mut |stmt| {
|
|
|
let id: i64 = stmt.read(0).ok()?;
|
|
|
- Some(WithID::wrap(C::Entity::build_from(stmt).ok()?, id))
|
|
|
+ Some(WithID::wrap(T::build_from(stmt).ok()?, id))
|
|
|
})
|
|
|
},
|
|
|
)
|