Remove generics on find_by_id
This commit is contained in:
parent
dd7585c4e6
commit
26cd0846d2
@ -239,23 +239,15 @@ pub trait EntityTrait: EntityName {
|
|||||||
/// vec![2i32.into(), 3i32.into()]
|
/// vec![2i32.into(), 3i32.into()]
|
||||||
/// )]);
|
/// )]);
|
||||||
/// ```
|
/// ```
|
||||||
fn find_by_id<V>(values: V) -> Select<Self>
|
fn find_by_id(values: <Self::PrimaryKey as PrimaryKeyTrait>::ValueType) -> Select<Self> {
|
||||||
where
|
|
||||||
V: IntoValueTuple,
|
|
||||||
{
|
|
||||||
let mut select = Self::find();
|
let mut select = Self::find();
|
||||||
let mut keys = Self::PrimaryKey::iter();
|
let mut keys = Self::PrimaryKey::iter();
|
||||||
for v in values.into_value_tuple() {
|
for v in values.into_value_tuple() {
|
||||||
if let Some(key) = keys.next() {
|
if let Some(key) = keys.next() {
|
||||||
let col = key.into_column();
|
let col = key.into_column();
|
||||||
select = select.filter(col.eq(v));
|
select = select.filter(col.eq(v));
|
||||||
} else {
|
|
||||||
panic!("primary key arity mismatch");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if keys.next().is_some() {
|
|
||||||
panic!("primary key arity mismatch");
|
|
||||||
}
|
|
||||||
select
|
select
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user