taitan_orm_trait/location/
location_mode.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub enum LocationMode {
    #[serde(alias = "AND")]
    And,
    #[serde(alias = "OR")]
    Or,
}

impl LocationMode {
    pub fn as_str(&self) -> &str {
        match self {
            Self::And => "AND",
            Self::Or => "OR",
        }
    }
    pub fn as_connective(&self) -> &str {
        match self {
            Self::And => " AND ",
            Self::Or => " OR ",
        }
    }
}

impl Default for LocationMode {
    fn default() -> Self {
        Self::And
    }
}