mirror of
https://github.com/Priler/jarvis.git
synced 2026-05-26 07:08:11 +00:00
18 lines
454 B
Rust
18 lines
454 B
Rust
use crate::AppState;
|
|
|
|
#[tauri::command]
|
|
pub fn db_read(state: tauri::State<'_, AppState>, key: &str) -> String {
|
|
state.settings.read(key).unwrap_or_default()
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn db_write(state: tauri::State<'_, AppState>, key: &str, val: &str) -> bool {
|
|
match state.settings.write(key, val) {
|
|
Ok(()) => true,
|
|
Err(e) => {
|
|
log::warn!("db_write('{}', '{}'): {}", key, val, e);
|
|
false
|
|
}
|
|
}
|
|
}
|