Skip to content

Commit 5da4f8b

Browse files
authored
Merge pull request #6 from dancixx/feat/improve-error-handling
refactor: improve performance for beta
2 parents 820cfa8 + e5a8334 commit 5da4f8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1765
-1500
lines changed

Cargo.toml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
[package]
2-
name = "rust-sql-gui-ui"
3-
version = "1.0.0-alpha.9"
2+
name = "rsql"
3+
version = "1.0.0-beta.0"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
[dependencies]
8-
leptos = { version = "0.6.8", features = ["csr", "nightly"] }
8+
leptos = { version = "0.6.11", features = ["csr", "nightly"] }
99
leptos_devtools = { git = "https://github.com/luoxiaozero/leptos-devtools" }
1010
serde = { version = "1.0.192", features = ["derive"] }
1111
serde-wasm-bindgen = "0.6.3"
1212
wasm-bindgen = { version ="0.2.91", features = ["serde-serialize"] }
1313
js-sys = "0.3.68"
14-
leptos-use = { version = "0.10.9", features = ["serde", "serde_json"]}
14+
leptos-use = { version = "0.10.10", features = ["serde", "serde_json"]}
1515
leptos_icons = "0.3.0" # https://carlosted.github.io/icondata/
1616
serde_json = "1.0.113"
1717
wasm-bindgen-futures = "0.4.39"
@@ -22,6 +22,16 @@ common = { path = "common" }
2222
futures = "0.3.30"
2323
async-stream = "0.3.5"
2424
icondata = "0.3.0"
25+
ahash = { version = "0.8.11", features = ["serde"] }
26+
leptos_toaster = { version = "0.1.6", features = ["builtin_toast"] }
27+
proc-macro2 = "1.0.82"
28+
quote = "1.0.36"
29+
syn = { version = "2.0.64", features = ["full"] }
30+
chrono = "0.4.38"
31+
2532

2633
[workspace]
2734
members = ["src-tauri", "common"]
35+
36+
[lib]
37+
proc-macro = true

common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "common"
3-
version = "1.0.0-alpha.9"
3+
version = "1.0.0-beta.0"
44
edition = "2021"
55

66
[dependencies]

common/src/drivers/mod.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

common/src/drivers/postgresql.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

common/src/enums.rs

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,68 @@ use std::fmt::Display;
22

33
use serde::{Deserialize, Serialize};
44

5-
use super::projects::postgresql::Postgresql;
6-
7-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8-
pub enum Project {
9-
POSTGRESQL(Postgresql),
10-
}
11-
12-
#[derive(Clone, Serialize, Deserialize)]
5+
#[derive(Clone, Copy, Serialize, Deserialize, Default)]
136
pub enum Drivers {
14-
POSTGRESQL,
7+
#[default]
8+
PGSQL,
159
}
1610

1711
impl Display for Drivers {
1812
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1913
match self {
20-
Drivers::POSTGRESQL => write!(f, "POSTGRESQL"),
14+
Drivers::PGSQL => write!(f, "PGSQL"),
15+
}
16+
}
17+
}
18+
19+
impl AsRef<str> for Drivers {
20+
fn as_ref(&self) -> &str {
21+
match self {
22+
Drivers::PGSQL => "PGSQL",
2123
}
2224
}
2325
}
2426

2527
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
2628
pub enum ProjectConnectionStatus {
2729
Connected,
30+
Connecting,
2831
#[default]
2932
Disconnected,
33+
Failed,
3034
}
35+
36+
impl std::error::Error for ProjectConnectionStatus {}
37+
impl Display for ProjectConnectionStatus {
38+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39+
match self {
40+
ProjectConnectionStatus::Connected => write!(f, "Connected"),
41+
ProjectConnectionStatus::Connecting => write!(f, "Connecting"),
42+
ProjectConnectionStatus::Disconnected => write!(f, "Disconnected"),
43+
ProjectConnectionStatus::Failed => write!(f, "Failed"),
44+
}
45+
}
46+
}
47+
48+
use std::fmt;
49+
50+
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
51+
pub enum PostgresqlError {
52+
ConnectionTimeout,
53+
ConnectionError,
54+
QueryTimeout,
55+
QueryError,
56+
}
57+
58+
impl std::error::Error for PostgresqlError {}
59+
impl fmt::Display for PostgresqlError {
60+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
61+
match *self {
62+
PostgresqlError::ConnectionTimeout => write!(f, "ConnectionTimeout"),
63+
PostgresqlError::ConnectionError => write!(f, "ConnectionError"),
64+
PostgresqlError::QueryTimeout => write!(f, "QueryTimeout"),
65+
PostgresqlError::QueryError => write!(f, "QueryError"),
66+
}
67+
}
68+
}
69+

common/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pub mod drivers;
21
pub mod enums;
3-
pub mod projects;
2+
pub mod types;
3+

common/src/projects/mod.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

common/src/projects/postgresql.rs

Lines changed: 0 additions & 36 deletions
This file was deleted.

common/src/types/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod pgsql;
2+

common/src/types/pgsql.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pub type PgsqlLoadSchemas = Vec<String>;
2+
pub type PgsqlLoadTables = Vec<(String, String)>;
3+
pub type PgsqlRunQuery = (Vec<String>, Vec<Vec<String>>, f32);
4+

0 commit comments

Comments
 (0)