Update to Rust programming language.
This commit is contained in:
parent
943efbfbdb
commit
f88248643b
201 changed files with 12954 additions and 1690 deletions
19
src-tauri/src/tauri_commands/db.rs
Normal file
19
src-tauri/src/tauri_commands/db.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use crate::DB;
|
||||
|
||||
#[tauri::command]
|
||||
pub fn db_read(key: &str) -> String {
|
||||
if let Some(value) = DB.lock().unwrap().get(key) {
|
||||
value
|
||||
} else {
|
||||
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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue