-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fuyoo
committed
Jun 28, 2024
1 parent
814eac5
commit 9aeda62
Showing
6 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Debug)] | ||
pub struct ConnectionInfo{ | ||
pub host: string, | ||
pub port: Option<String>, | ||
pub db: Option<String>, | ||
pub username: Option<String>, | ||
pub password: Option<String> | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug)] | ||
pub struct ConnectionImpl { | ||
pub id: usize, | ||
pub name: String, | ||
pub node: Vec<ConnectionInfo>, | ||
pub cluster: Option<boolean> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useRoute } from "vue-router" | ||
import db from "@/database" | ||
import { invoke } from "@tauri-apps/api/core" | ||
const getConnectionInfo = async () => { | ||
const route = useRoute() | ||
const id = Number(route.query.id) | ||
return await db.connection.get(id) | ||
} | ||
|
||
export interface ResponseBody<T> { | ||
code: number, | ||
data:T, | ||
msg: string | ||
} | ||
|
||
export const RReq = async <T>(action:string, data: any) => { | ||
const info = await getConnectionInfo() | ||
return invoke<ResponseBody<T>>("request",{ | ||
rid:Math.random().toString(36), | ||
action, | ||
data:JSON.stringify(data), | ||
connectionInfo:JSON.stringify(info) | ||
}) | ||
} | ||
|
||
|
||
export function status<T>(data:any) { | ||
return RReq("/status",data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters