pub struct BatchInsert<'a, T> { /* private fields */ }Expand description
A batch insert builder for inserting multiple entities efficiently.
This generates a single INSERT statement with multiple value tuples, which is more efficient than executing individual INSERT statements.
§Example
ⓘ
use rdbi::{BatchInsert, Pool};
let users = vec![
User { id: 0, username: "alice".into(), email: "alice@example.com".into() },
User { id: 0, username: "bob".into(), email: "bob@example.com".into() },
];
let result = BatchInsert::new("users", &users)
.execute(&pool)
.await?;
println!("Inserted {} rows", result.rows_affected);Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for BatchInsert<'a, T>
impl<'a, T> RefUnwindSafe for BatchInsert<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for BatchInsert<'a, T>where
T: Sync,
impl<'a, T> Sync for BatchInsert<'a, T>where
T: Sync,
impl<'a, T> Unpin for BatchInsert<'a, T>
impl<'a, T> UnwindSafe for BatchInsert<'a, T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more