#[derive(Debug, Clone, Default)]
pub struct UpdateOptions {
pub upsert: Option<bool>,
}
impl UpdateOptions {
pub fn builder() -> UpdateOptionsBuilder {
UpdateOptionsBuilder::default()
}
pub(crate) fn is_upsert(&self) -> bool {
self.upsert.unwrap_or(false)
}
}
#[derive(Default)]
pub struct UpdateOptionsBuilder {
upsert: Option<bool>,
}
impl UpdateOptionsBuilder {
pub fn upsert(mut self, upsert: bool) -> Self {
self.upsert = Some(upsert);
self
}
pub fn build(self) -> UpdateOptions {
UpdateOptions {
upsert: self.upsert,
}
}
}