pub struct QueryPipeline { /* private fields */ }Expand description
Query pipeline for batching multiple operations.
Implementations§
Source§impl QueryPipeline
impl QueryPipeline
Sourcepub fn new(config: PipelineConfig) -> Self
pub fn new(config: PipelineConfig) -> Self
Create a new query pipeline.
Sourcepub fn for_database(self, db_type: DatabaseType) -> Self
pub fn for_database(self, db_type: DatabaseType) -> Self
Set database type.
Sourcepub fn add_query(self, sql: impl Into<String>, params: Vec<FilterValue>) -> Self
pub fn add_query(self, sql: impl Into<String>, params: Vec<FilterValue>) -> Self
Add a query to the pipeline.
Sourcepub fn add_execute(
self,
sql: impl Into<String>,
params: Vec<FilterValue>,
) -> Self
pub fn add_execute( self, sql: impl Into<String>, params: Vec<FilterValue>, ) -> Self
Add an execute-only query.
Sourcepub fn add_insert(
self,
sql: impl Into<String>,
params: Vec<FilterValue>,
) -> Self
pub fn add_insert( self, sql: impl Into<String>, params: Vec<FilterValue>, ) -> Self
Add an INSERT query.
Sourcepub fn add_update(
self,
sql: impl Into<String>,
params: Vec<FilterValue>,
) -> Self
pub fn add_update( self, sql: impl Into<String>, params: Vec<FilterValue>, ) -> Self
Add an UPDATE query.
Sourcepub fn add_delete(
self,
sql: impl Into<String>,
params: Vec<FilterValue>,
) -> Self
pub fn add_delete( self, sql: impl Into<String>, params: Vec<FilterValue>, ) -> Self
Add a DELETE query.
Sourcepub fn add_select(
self,
sql: impl Into<String>,
params: Vec<FilterValue>,
) -> Self
pub fn add_select( self, sql: impl Into<String>, params: Vec<FilterValue>, ) -> Self
Add a SELECT query.
Sourcepub fn push(&mut self, query: PipelineQuery)
pub fn push(&mut self, query: PipelineQuery)
Add a custom pipeline query.
Sourcepub fn queries(&self) -> &VecDeque<PipelineQuery>
pub fn queries(&self) -> &VecDeque<PipelineQuery>
Get the queries.
Sourcepub fn to_batch_sql(&self) -> Option<(String, Vec<FilterValue>)>
pub fn to_batch_sql(&self) -> Option<(String, Vec<FilterValue>)>
Convert to batch SQL for databases that support it.
Returns None if the database doesn’t support multi-statement execution.
Sourcepub fn into_batches(self) -> Vec<Vec<PipelineQuery>>
pub fn into_batches(self) -> Vec<Vec<PipelineQuery>>
Split into batches based on config.
Sourcepub fn to_transaction_sql(&self) -> Vec<(String, Vec<FilterValue>)>
pub fn to_transaction_sql(&self) -> Vec<(String, Vec<FilterValue>)>
Create SQL for transactional execution.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QueryPipeline
impl RefUnwindSafe for QueryPipeline
impl Send for QueryPipeline
impl Sync for QueryPipeline
impl Unpin for QueryPipeline
impl UnwindSafe for QueryPipeline
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