use serde::{Deserialize, Serialize};
use crate::models;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum IndexAction {
#[serde(rename = "create")]
Create,
#[serde(rename = "update")]
Update,
#[serde(rename = "upsert")]
Upsert,
#[serde(rename = "emplace")]
Emplace,
}
impl std::fmt::Display for IndexAction {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::Create => write!(f, "create"),
Self::Update => write!(f, "update"),
Self::Upsert => write!(f, "upsert"),
Self::Emplace => write!(f, "emplace"),
}
}
}
impl Default for IndexAction {
fn default() -> IndexAction {
Self::Create
}
}