mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-30 05:11:13 +00:00
* impl AnyQueryResult for Sqlite and MySQL * fix MySQL AnyQueryResult * fix MySQL AnyQueryResult * fix manifest * rewrite `use` and address implementation concerns
31 lines
720 B
Rust
31 lines
720 B
Rust
use std::iter::{Extend, IntoIterator};
|
|
|
|
#[derive(Debug, Default)]
|
|
pub struct PgQueryResult {
|
|
pub(super) rows_affected: u64,
|
|
}
|
|
|
|
impl PgQueryResult {
|
|
pub fn rows_affected(&self) -> u64 {
|
|
self.rows_affected
|
|
}
|
|
}
|
|
|
|
impl Extend<PgQueryResult> for PgQueryResult {
|
|
fn extend<T: IntoIterator<Item = PgQueryResult>>(&mut self, iter: T) {
|
|
for elem in iter {
|
|
self.rows_affected += elem.rows_affected;
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(feature = "any")]
|
|
impl From<PgQueryResult> for sqlx_core::any::AnyQueryResult {
|
|
fn from(done: PgQueryResult) -> Self {
|
|
sqlx_core::any::AnyQueryResult {
|
|
rows_affected: done.rows_affected,
|
|
last_insert_id: None,
|
|
}
|
|
}
|
|
}
|