use azure_data_cosmos_driver::models::{Precondition, SessionToken};
use azure_data_cosmos_driver::options::OperationOptions;
#[derive(Clone, Default)]
#[non_exhaustive]
pub struct BatchOptions {
pub operation: OperationOptions,
pub session_token: Option<SessionToken>,
}
impl BatchOptions {
pub fn with_session_token(mut self, session_token: impl Into<SessionToken>) -> Self {
self.session_token = Some(session_token.into());
self
}
pub fn with_operation_options(mut self, operation: OperationOptions) -> Self {
self.operation = operation;
self
}
}
#[derive(Clone, Debug, Default)]
#[non_exhaustive]
pub struct BatchUpsertOptions {
pub precondition: Option<Precondition>,
}
impl BatchUpsertOptions {
pub fn with_precondition(mut self, precondition: Precondition) -> Self {
self.precondition = Some(precondition);
self
}
}
#[derive(Clone, Debug, Default)]
#[non_exhaustive]
pub struct BatchReplaceOptions {
pub precondition: Option<Precondition>,
}
impl BatchReplaceOptions {
pub fn with_precondition(mut self, precondition: Precondition) -> Self {
self.precondition = Some(precondition);
self
}
}
#[derive(Clone, Debug, Default)]
#[non_exhaustive]
pub struct BatchReadOptions {
pub precondition: Option<Precondition>,
}
impl BatchReadOptions {
pub fn with_precondition(mut self, precondition: Precondition) -> Self {
self.precondition = Some(precondition);
self
}
}
#[derive(Clone, Debug, Default)]
#[non_exhaustive]
pub struct BatchDeleteOptions {
pub precondition: Option<Precondition>,
}
impl BatchDeleteOptions {
pub fn with_precondition(mut self, precondition: Precondition) -> Self {
self.precondition = Some(precondition);
self
}
}