feat: add surreal db

This commit is contained in:
2024-02-03 11:24:08 +07:00
parent a3a8f57bfc
commit bd2b6a3759
6 changed files with 1643 additions and 11 deletions

View File

@@ -0,0 +1,23 @@
use crate::model::*;
use crate::AppState;
use tauri::State;
#[tauri::command(async)]
pub async fn create_account(
pubkey: String,
app_state: State<'_, AppState>,
) -> Result<Vec<Record>, ()> {
let db = app_state.db.lock().await;
let created: Vec<Record> = db
.create("account")
.content(Account {
id: None,
pubkey,
is_active: true,
})
.await
.expect("Create account failed");
Ok(created)
}