1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use sqlx::database::HasArguments;
use sqlx::query::QueryAs;
use sqlx::Database;
use sqlx::Encode;
use sqlx::Type;
pub trait QueryExt<'a, DB: Database> {
fn bind_all<Vs, V>(self, values: Vs) -> Self
where
V: Send + Encode<'a, DB> + Type<DB> + 'a,
Vs: IntoIterator<Item = V>;
}
impl<'a, DB: Database, O> QueryExt<'a, DB>
for QueryAs<'a, DB, O, <DB as HasArguments<'a>>::Arguments>
{
fn bind_all<Vs, V>(self, values: Vs) -> Self
where
V: Send + Encode<'a, DB> + Type<DB> + 'a,
Vs: IntoIterator<Item = V>,
{
let mut this = self;
for value in values.into_iter() {
this = this.bind(value);
}
this
}
}