forked from transact-rs/sqlx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdone.rs
More file actions
34 lines (29 loc) · 739 Bytes
/
Copy pathdone.rs
File metadata and controls
34 lines (29 loc) · 739 Bytes
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
34
use crate::done::Done;
use crate::postgres::Postgres;
use std::iter::{Extend, IntoIterator};
#[derive(Debug, Default)]
pub struct PgDone {
pub(super) rows_affected: u64,
}
impl Done for PgDone {
type Database = Postgres;
fn rows_affected(&self) -> u64 {
self.rows_affected
}
}
impl Extend<PgDone> for PgDone {
fn extend<T: IntoIterator<Item = PgDone>>(&mut self, iter: T) {
for elem in iter {
self.rows_affected += elem.rows_affected;
}
}
}
#[cfg(feature = "any")]
impl From<PgDone> for crate::any::AnyDone {
fn from(done: PgDone) -> Self {
crate::any::AnyDone {
rows_affected: done.rows_affected,
last_insert_id: None,
}
}
}