pub struct InsertBatcher { /* private fields */ }Expand description
INSERT Batcher
Batches INSERT statements for improved throughput.
Implementations§
Source§impl InsertBatcher
impl InsertBatcher
Sourcepub fn new(config: BatchConfig) -> Self
pub fn new(config: BatchConfig) -> Self
Create a new INSERT batcher
Sourcepub fn add(
&self,
table: String,
columns: Vec<String>,
values: Vec<Vec<String>>,
original_sql: String,
) -> Result<BatchTicket, BatchError>
pub fn add( &self, table: String, columns: Vec<String>, values: Vec<Vec<String>>, original_sql: String, ) -> Result<BatchTicket, BatchError>
Add an INSERT to the batch
Sourcepub fn flush_batch(&self, table: &str)
pub fn flush_batch(&self, table: &str)
Flush a batch for a table
Sourcepub fn batch_size(&self, table: &str) -> usize
pub fn batch_size(&self, table: &str) -> usize
Get the current batch size for a table
Sourcepub fn stats(&self) -> BatchStats
pub fn stats(&self) -> BatchStats
Get statistics snapshot
Sourcepub fn start_auto_flush(self: Arc<Self>) -> JoinHandle<()>
pub fn start_auto_flush(self: Arc<Self>) -> JoinHandle<()>
Start auto-flush background task
Auto Trait Implementations§
impl !Freeze for InsertBatcher
impl !RefUnwindSafe for InsertBatcher
impl Send for InsertBatcher
impl Sync for InsertBatcher
impl Unpin for InsertBatcher
impl UnsafeUnpin for InsertBatcher
impl !UnwindSafe for InsertBatcher
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
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