pub enum WriteOp<'a> {
Single {
query: &'a str,
params: Vec<DbValue>,
mode: FetchMode,
},
BatchDDL {
queries: &'a [&'a str],
},
BatchParams {
query: &'a str,
params_list: Vec<Vec<DbValue>>,
isolate_rows: bool,
},
}Expand description
Unified write operation types.
Variants§
Single
Single query with optional return.
BatchDDL
Batch of DDL statements executed in a single transaction.
BatchParams
Same query executed once per parameter set, in a single transaction.
Use for batched INSERT … ON CONFLICT, UPDATEs, or any non-Postgres
backend. For a plain high-volume insert into one table,
PgHandler::copy_in is ~30–50× faster — see
its docs for a full copy_in-vs-BatchParams decision guide.
Fields
§
isolate_rows: boolPer-row error isolation.
true— a bad row is contained and the rest of the batch still commits. BothPgHandlerand the multi-backendBaseHandlerwrap each row in aSAVEPOINT(standard SQL: Postgres, MySQL/InnoDB, SQLite), so a failed row rolls back alone instead of aborting the transaction.false— all-or-nothing: no per-row savepoints, so the first error rolls back the whole batch. ~2× faster than the isolated path. Use for trusted bulk inserts where partial success isn’t needed. For the fastest plain bulk load, preferPgHandler::copy_in.
Auto Trait Implementations§
impl<'a> Freeze for WriteOp<'a>
impl<'a> RefUnwindSafe for WriteOp<'a>
impl<'a> Send for WriteOp<'a>
impl<'a> Sync for WriteOp<'a>
impl<'a> Unpin for WriteOp<'a>
impl<'a> UnsafeUnpin for WriteOp<'a>
impl<'a> UnwindSafe for WriteOp<'a>
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more