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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
pub mod error;
pub mod types;
use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub enum Wql {
CreateEntity {
name: String,
uniques: Option<Vec<String>>,
encrypts: Option<Vec<String>>,
},
}
#[derive(Debug, PartialEq)]
pub enum Operation {
#[allow(non_camel_case_types)]
CREATE,
#[allow(non_camel_case_types)]
INSERT,
#[allow(non_camel_case_types)]
UPDATE,
#[allow(non_camel_case_types)]
DELETE,
#[allow(non_camel_case_types)]
MATCH_UPDATE,
#[allow(non_camel_case_types)]
EVICT,
#[allow(non_camel_case_types)]
SELECT,
#[allow(non_camel_case_types)]
CHECK,
#[allow(non_camel_case_types)]
RELATION,
#[allow(non_camel_case_types)]
JOIN,
}
#[derive(Debug, PartialEq)]
pub enum CreateOptions {
#[allow(non_camel_case_types)]
UNIQUES,
#[allow(non_camel_case_types)]
ENCRYPT,
}
impl From<&str> for Operation {
fn from(i: &str) -> Self {
match i.to_uppercase().as_str() {
"CREATE" => Operation::CREATE,
"INSERT" => Operation::INSERT,
"UPDATE" => Operation::UPDATE,
"DELETE" => Operation::DELETE,
"MATCH" => Operation::MATCH_UPDATE,
"EVICT" => Operation::EVICT,
"SELECT" => Operation::SELECT,
"CHECK" => Operation::CHECK,
"RELATION" => Operation::RELATION,
"JOIN" => Operation::JOIN,
_ => unimplemented!("no other operation supported"),
}
}
}
impl From<&str> for CreateOptions {
fn from(i: &str) -> Self {
match i.to_uppercase().as_str() {
"UNIQUES" => CreateOptions::UNIQUES,
"ENCRYPT" => CreateOptions::ENCRYPT,
_ => unimplemented!("no other create option supported"),
}
}
}