use serde::{Deserialize, Serialize};
use strum::Display;
use tardis::web::poem_openapi;
#[derive(Display, Debug, poem_openapi::Tags)]
pub enum ApiTag {
#[oai(rename = "Common Console")]
Common,
#[oai(rename = "Tenant Console")]
Tenant,
#[oai(rename = "App Console")]
App,
#[oai(rename = "System Console")]
System,
#[oai(rename = "Passport Console")]
Passport,
#[oai(rename = "Interface Console")]
Interface,
}
#[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize, poem_openapi::Enum)]
pub enum BasicQueryOpKind {
#[oai(rename = "=")]
Eq,
#[oai(rename = "!=")]
Ne,
#[oai(rename = ">")]
Gt,
#[oai(rename = ">=")]
Ge,
#[oai(rename = "<")]
Lt,
#[oai(rename = "<=")]
Le,
#[oai(rename = "like")]
Like,
#[oai(rename = "not_like")]
NotLike,
#[oai(rename = "l_like")]
LLike,
#[oai(rename = "not_l_like")]
NotLLike,
#[oai(rename = "r_like")]
RLike,
#[oai(rename = "not_r_like")]
NotRLike,
#[oai(rename = "in")]
In,
#[oai(rename = "not_in")]
NotIn,
#[oai(rename = "is_null")]
IsNull,
#[oai(rename = "is_not_null")]
IsNotNull,
#[oai(rename = "is_null_or_empty")]
IsNullOrEmpty,
#[oai(rename = "length")]
Len,
}
impl BasicQueryOpKind {
pub fn to_sql(&self) -> String {
match self {
BasicQueryOpKind::Eq => "=".to_string(),
BasicQueryOpKind::Ne => "!=".to_string(),
BasicQueryOpKind::Gt => ">".to_string(),
BasicQueryOpKind::Ge => ">=".to_string(),
BasicQueryOpKind::Lt => "<".to_string(),
BasicQueryOpKind::Le => "<=".to_string(),
BasicQueryOpKind::Like => "LIKE".to_string(),
BasicQueryOpKind::NotLike => "NOT LIKE".to_string(),
BasicQueryOpKind::LLike => "LIKE".to_string(),
BasicQueryOpKind::NotLLike => "NOT LIKE".to_string(),
BasicQueryOpKind::RLike => "LIKE".to_string(),
BasicQueryOpKind::NotRLike => "NOT LIKE".to_string(),
BasicQueryOpKind::In => "IN".to_string(),
BasicQueryOpKind::NotIn => "NOT IN".to_string(),
BasicQueryOpKind::IsNull => "IS NULL".to_string(),
BasicQueryOpKind::IsNotNull => "IS NOT NULL".to_string(),
BasicQueryOpKind::IsNullOrEmpty => "IS NULL".to_string(),
BasicQueryOpKind::Len => "=".to_string(),
}
}
}