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
sourceimpl 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_retry_policy(&mut self, retry_policy: Box<dyn RetryPolicy>)
pub fn set_retry_policy(&mut self, retry_policy: Box<dyn RetryPolicy>)
Sets a custom RetryPolicy
to be used with this batch
By default Session’s retry policy is used, this allows to use a custom retry policy
sourcepub fn get_retry_policy(&self) -> &Option<Box<dyn RetryPolicy>>
pub fn get_retry_policy(&self) -> &Option<Box<dyn RetryPolicy>>
Gets custom RetryPolicy
used by 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 BatchResult 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.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Batch
impl Send for Batch
impl Sync for Batch
impl Unpin for Batch
impl !UnwindSafe for Batch
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more