Struct scylla::statement::batch::Batch

source ·
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

source

pub fn new(batch_type: BatchType) -> Self

Creates a new, empty Batch of batch_type type.

source

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.

source

pub fn append_statement(&mut self, statement: impl Into<BatchStatement>)

Appends a new statement to the batch.

source

pub fn get_type(&self) -> BatchType

Gets type of batch.

source

pub fn set_consistency(&mut self, c: Consistency)

Sets the consistency to be used when executing this batch.

source

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.

source

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)

source

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)

source

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

source

pub fn get_is_idempotent(&self) -> bool

Gets the idempotence of this batch

source

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

source

pub fn get_tracing(&self) -> bool

Gets whether tracing is enabled for this batch

source

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.

source

pub fn get_timestamp(&self) -> Option<i64>

Gets the default timestamp for this batch in microseconds.

source

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.

source

pub fn get_retry_policy(&self) -> Option<&Arc<dyn RetryPolicy>>

Get the retry policy set for the batch.

source

pub fn set_history_listener( &mut self, history_listener: Arc<dyn HistoryListener> )

Sets the listener capable of listening what happens during query execution.

source

pub fn remove_history_listener(&mut self) -> Option<Arc<dyn HistoryListener>>

Removes the listener set by set_history_listener.

source

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.

source

pub fn get_execution_profile_handle(&self) -> Option<&ExecutionProfileHandle>

Borrows the execution profile handle associated with this batch.

Trait Implementations§

source§

impl Clone for Batch

source§

fn clone(&self) -> Batch

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for Batch

source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more