pub struct Batch {
pub statements: Vec<BatchStatement>,
/* private fields */
}
Expand description
CQL batch statement.
This represents a CQL batch that can be executed on a server.
Fields§
§statements: Vec<BatchStatement>
Implementations§
source§impl Batch
impl Batch
sourcepub fn new_with_statements(
batch_type: BatchType,
statements: Vec<BatchStatement>,
) -> Self
pub fn new_with_statements( batch_type: BatchType, statements: Vec<BatchStatement>, ) -> Self
Creates a new, empty Batch
of batch_type
type with the provided statements.
sourcepub fn append_statement(&mut self, statement: impl Into<BatchStatement>)
pub fn append_statement(&mut self, statement: impl Into<BatchStatement>)
Appends a new statement to the batch.
sourcepub fn set_consistency(&mut self, c: Consistency)
pub fn set_consistency(&mut self, c: Consistency)
Sets the consistency to be used when executing this batch.
sourcepub fn get_consistency(&self) -> Option<Consistency>
pub fn get_consistency(&self) -> Option<Consistency>
Gets the consistency to be used when executing this batch if it is filled. If this is empty, the default_consistency of the session will be used.
sourcepub fn set_serial_consistency(&mut self, sc: Option<SerialConsistency>)
pub fn set_serial_consistency(&mut self, sc: Option<SerialConsistency>)
Sets the serial consistency to be used when executing this batch. (Ignored unless the batch is an LWT)
sourcepub fn get_serial_consistency(&self) -> Option<SerialConsistency>
pub fn get_serial_consistency(&self) -> Option<SerialConsistency>
Gets the serial consistency to be used when executing this batch. (Ignored unless the batch is an LWT)
sourcepub fn set_is_idempotent(&mut self, is_idempotent: bool)
pub fn set_is_idempotent(&mut self, is_idempotent: bool)
Sets the idempotence of this batch
A query is idempotent if it can be applied multiple times without changing the result of the initial application
If set to true
we can be sure that it is idempotent
If set to false
it is unknown whether it is idempotent
This is used in RetryPolicy
to decide if retrying a query is safe
sourcepub fn get_is_idempotent(&self) -> bool
pub fn get_is_idempotent(&self) -> bool
Gets the idempotence of this batch
sourcepub fn set_tracing(&mut self, should_trace: bool)
pub fn set_tracing(&mut self, should_trace: bool)
Enable or disable CQL Tracing for this batch If enabled session.batch() will return a QueryResult containing tracing_id which can be used to query tracing information about the execution of this query
sourcepub fn get_tracing(&self) -> bool
pub fn get_tracing(&self) -> bool
Gets whether tracing is enabled for this batch
sourcepub fn set_timestamp(&mut self, timestamp: Option<i64>)
pub fn set_timestamp(&mut self, timestamp: Option<i64>)
Sets the default timestamp for this batch in microseconds. If not None, it will replace the server side assigned timestamp as default timestamp for all the statements contained in the batch.
sourcepub fn get_timestamp(&self) -> Option<i64>
pub fn get_timestamp(&self) -> Option<i64>
Gets the default timestamp for this batch in microseconds.
sourcepub fn set_retry_policy(&mut self, retry_policy: Option<Arc<dyn RetryPolicy>>)
pub fn set_retry_policy(&mut self, retry_policy: Option<Arc<dyn RetryPolicy>>)
Set the retry policy for this batch, overriding the one from execution profile if not None.
sourcepub fn get_retry_policy(&self) -> Option<&Arc<dyn RetryPolicy>>
pub fn get_retry_policy(&self) -> Option<&Arc<dyn RetryPolicy>>
Get the retry policy set for the batch.
sourcepub fn set_history_listener(
&mut self,
history_listener: Arc<dyn HistoryListener>,
)
pub fn set_history_listener( &mut self, history_listener: Arc<dyn HistoryListener>, )
Sets the listener capable of listening what happens during query execution.
sourcepub fn remove_history_listener(&mut self) -> Option<Arc<dyn HistoryListener>>
pub fn remove_history_listener(&mut self) -> Option<Arc<dyn HistoryListener>>
Removes the listener set by set_history_listener
.
sourcepub fn set_execution_profile_handle(
&mut self,
profile_handle: Option<ExecutionProfileHandle>,
)
pub fn set_execution_profile_handle( &mut self, profile_handle: Option<ExecutionProfileHandle>, )
Associates the batch with execution profile referred by the provided handle. Handle may be later remapped to another profile, and batch will reflect those changes.
sourcepub fn get_execution_profile_handle(&self) -> Option<&ExecutionProfileHandle>
pub fn get_execution_profile_handle(&self) -> Option<&ExecutionProfileHandle>
Borrows the execution profile handle associated with this batch.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Batch
impl !RefUnwindSafe for Batch
impl Send for Batch
impl Sync for Batch
impl Unpin for Batch
impl !UnwindSafe for Batch
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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