bios_basic/
enumeration.rs1use serde::{Deserialize, Serialize};
3use strum::Display;
4
5use tardis::web::poem_openapi;
6
7#[derive(Display, Debug, poem_openapi::Tags)]
11pub enum ApiTag {
12 #[oai(rename = "Common Console")]
16 Common,
17 #[oai(rename = "Tenant Console")]
21 Tenant,
22 #[oai(rename = "App Console")]
26 App,
27 #[oai(rename = "System Console")]
31 System,
32 #[oai(rename = "Passport Console")]
36 Passport,
37 #[oai(rename = "Interface Console")]
41 Interface,
42}
43
44#[derive(Display, Clone, Debug, PartialEq, Eq, Deserialize, Serialize, poem_openapi::Enum)]
48pub enum BasicQueryOpKind {
49 #[oai(rename = "=")]
50 Eq,
51 #[oai(rename = "!=")]
52 Ne,
53 #[oai(rename = ">")]
54 Gt,
55 #[oai(rename = ">=")]
56 Ge,
57 #[oai(rename = "<")]
58 Lt,
59 #[oai(rename = "<=")]
60 Le,
61 #[oai(rename = "like")]
62 Like,
63 #[oai(rename = "not_like")]
64 NotLike,
65 #[oai(rename = "l_like")]
66 LLike,
67 #[oai(rename = "not_l_like")]
68 NotLLike,
69 #[oai(rename = "r_like")]
70 RLike,
71 #[oai(rename = "not_r_like")]
72 NotRLike,
73 #[oai(rename = "in")]
74 In,
75 #[oai(rename = "not_in")]
76 NotIn,
77 #[oai(rename = "is_null")]
78 IsNull,
79 #[oai(rename = "is_not_null")]
80 IsNotNull,
81 #[oai(rename = "is_null_or_empty")]
82 IsNullOrEmpty,
83 #[oai(rename = "length")]
84 Len,
85}
86
87impl BasicQueryOpKind {
88 pub fn to_sql(&self) -> String {
89 match self {
90 BasicQueryOpKind::Eq => "=".to_string(),
91 BasicQueryOpKind::Ne => "!=".to_string(),
92 BasicQueryOpKind::Gt => ">".to_string(),
93 BasicQueryOpKind::Ge => ">=".to_string(),
94 BasicQueryOpKind::Lt => "<".to_string(),
95 BasicQueryOpKind::Le => "<=".to_string(),
96 BasicQueryOpKind::Like => "LIKE".to_string(),
97 BasicQueryOpKind::NotLike => "NOT LIKE".to_string(),
98 BasicQueryOpKind::LLike => "LIKE".to_string(),
99 BasicQueryOpKind::NotLLike => "NOT LIKE".to_string(),
100 BasicQueryOpKind::RLike => "LIKE".to_string(),
101 BasicQueryOpKind::NotRLike => "NOT LIKE".to_string(),
102 BasicQueryOpKind::In => "IN".to_string(),
103 BasicQueryOpKind::NotIn => "NOT IN".to_string(),
104 BasicQueryOpKind::IsNull => "IS NULL".to_string(),
105 BasicQueryOpKind::IsNotNull => "IS NOT NULL".to_string(),
106 BasicQueryOpKind::IsNullOrEmpty => "IS NULL".to_string(),
107 BasicQueryOpKind::Len => "=".to_string(),
108 }
109 }
110}