Added a database cache type.

This commit is contained in:
Jeff Baskin 2023-01-17 13:02:43 -05:00
parent 809bcb641b
commit 13aa4328cc
1 changed files with 10 additions and 0 deletions

View File

@ -14,6 +14,7 @@ impl Databases {
pub enum CacheType { pub enum CacheType {
Raw(String), Raw(String),
DBMap(Databases), DBMap(Databases),
TableMap,
} }
impl CacheType { impl CacheType {
@ -21,6 +22,7 @@ impl CacheType {
match self { match self {
CacheType::Raw(_) => "Raw".to_string(), CacheType::Raw(_) => "Raw".to_string(),
CacheType::DBMap(_) => "DBMap".to_string(), CacheType::DBMap(_) => "DBMap".to_string(),
CacheType::TableMap => "TableMap".to_string(),
} }
} }
@ -30,6 +32,7 @@ impl CacheType {
match self { match self {
CacheType::Raw(s) => output.append(&mut s.as_bytes().to_vec()), CacheType::Raw(s) => output.append(&mut s.as_bytes().to_vec()),
CacheType::DBMap(_) => (), CacheType::DBMap(_) => (),
CacheType::TableMap => (),
} }
return output; return output;
} }
@ -69,6 +72,7 @@ impl fmt::Display for CacheType {
match self { match self {
CacheType::Raw(s) => write!(f, "{}", s), CacheType::Raw(s) => write!(f, "{}", s),
CacheType::DBMap(_) => todo!(), CacheType::DBMap(_) => todo!(),
CacheType::TableMap => todo!(),
} }
} }
} }
@ -168,4 +172,10 @@ mod enum_ctype {
let output = CacheType::from_bytes(data).unwrap(); let output = CacheType::from_bytes(data).unwrap();
assert_eq!(output.entry_type(), "DBMap"); assert_eq!(output.entry_type(), "DBMap");
} }
#[test]
fn get_tablemap_type() {
let holder = CacheType::TableMap;
assert_eq!(holder.entry_type(), "TableMap");
}
} }