Skip to content

Commit 73f6f21

Browse files
committed
update
1 parent 59a539b commit 73f6f21

File tree

6 files changed

+29
-1
lines changed

6 files changed

+29
-1
lines changed

crates/rs-tauri-vue/src-tauri/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ mod command;
1313
mod config;
1414
mod ctx;
1515
mod menu;
16+
mod proto;
1617
mod service;
1718
mod storage;
1819
mod util;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod model;
2+
3+
pub use model::*;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use serde::{Deserialize, Serialize};
2+
3+
#[derive(Debug, Clone, Deserialize, Serialize)]
4+
pub struct CoinPriceItem {
5+
pub coin_type: String,
6+
pub price: f64,
7+
pub timestamp: i64,
8+
}
9+
10+
#[derive(Debug, Clone, Deserialize, Serialize)]
11+
pub struct CoinPriceEntity {
12+
pub list: Vec<CoinPriceItem>,
13+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod kv;
2+
3+
pub use kv::*;
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
// 存储 key 定义:
22
pub enum AppStorageKeys {
3-
AppLocale,
3+
AppName,
44
AppVersion,
5+
AppLocale,
56
}
67

78
impl AppStorageKeys {
89
pub fn parse(&self) -> &str {
910
match self {
1011
AppStorageKeys::AppLocale => "app:locale",
1112
AppStorageKeys::AppVersion => "app:version",
13+
AppStorageKeys::AppName => "app:name",
14+
_ => "not:found",
1215
}
1316
}
1417
}

crates/rs-tauri-vue/src-tauri/src/storage/kv/kv.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ impl AppKvStorage {
6969
Self { db }
7070
}
7171

72+
pub fn get_app_name(&self) -> String {
73+
let key = AppStorageKeys::AppName.parse();
74+
self.db.get(key).unwrap_or("app".to_string())
75+
}
76+
7277
pub fn set_locale(&mut self, locale: &str) -> pickledb::error::Result<()> {
7378
// let key = "app:locale";
7479
let key = AppStorageKeys::AppLocale.parse();

0 commit comments

Comments
 (0)