J.A.R.V.I.S-rust/src-tauri/src/tauri_commands/db.rs
2023-04-28 19:05:35 +05:00

19 lines
358 B
Rust

use crate::DB;
#[tauri::command]
pub fn db_read(key: &str) -> String {
if let Some(value) = DB.lock().unwrap().get::<String>(key) {
return value
}
String::from("")
}
#[tauri::command]
pub fn db_write(key: &str, val: &str) -> bool {
if let Ok(_) = DB.lock().unwrap().set(key, &val) {
true
} else {
false
}
}