✨ feat(vscode): 代码阅读认 axum、sqlx 和 tauri
This commit is contained in:
1 parent
44de0a1f70
commit
69608f9c70
9 files changed
+500
-3
No files matched your search
@@ -23,3 +23,26 @@ pub enum AgentError {
|
||||
#[error("上游错误")]
|
||||
Upstream(#[from] Other),
|
||||
}
|
||||
|
||||
use axum::routing::get;
|
||||
|
||||
/// 按 id 取一个代理。
|
||||
#[get("/agents/{id}")]
|
||||
async fn get_agent(Path(id): Path<Uuid>) -> Result<Json<AgentRow>, StatusCode> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
let app = Router::new().route("/health", get(health));
|
||||
|
||||
use sqlx::query_as;
|
||||
|
||||
// 按 id 取一行。
|
||||
let row = sqlx::query_as!(AgentRow, "SELECT id, name FROM agents WHERE id = $1", id);
|
||||
|
||||
use tauri::State;
|
||||
|
||||
/// 让窗口把这一行改名。
|
||||
#[tauri::command]
|
||||
async fn rename_agent(state: State<App>, name: String) -> Result<String, String> {
|
||||
todo!()
|
||||
}
|
||||
Reference in new issue
Block a user