mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-24 17:20:51 +02:00
Co-authored-by: Fabian-Lars <github@fabianlars.de>
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"sql": "patch"
|
||||||
|
"sql-js": "patch"
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes issue with UUIDs returned as null in sql query results.
|
||||||
Generated
+25
-8
@@ -5613,10 +5613,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.219"
|
version = "1.0.228"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5632,10 +5633,19 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_core"
|
||||||
version = "1.0.219"
|
version = "1.0.228"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.228"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -6032,6 +6042,7 @@ dependencies = [
|
|||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
|
"uuid",
|
||||||
"webpki-roots",
|
"webpki-roots",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -6114,6 +6125,7 @@ dependencies = [
|
|||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
"time",
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"uuid",
|
||||||
"whoami",
|
"whoami",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -6152,6 +6164,7 @@ dependencies = [
|
|||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
"time",
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"uuid",
|
||||||
"whoami",
|
"whoami",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -6178,6 +6191,7 @@ dependencies = [
|
|||||||
"time",
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6975,6 +6989,7 @@ dependencies = [
|
|||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
"time",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7919,12 +7934,14 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.16.0"
|
version = "1.19.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"
|
checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.3.2",
|
"getrandom 0.3.2",
|
||||||
"serde",
|
"js-sys",
|
||||||
|
"serde_core",
|
||||||
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -29,10 +29,11 @@ tauri = { workspace = true }
|
|||||||
log = { workspace = true }
|
log = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
futures-core = "0.3"
|
futures-core = "0.3"
|
||||||
sqlx = { version = "0.8", features = ["json", "time"] }
|
sqlx = { version = "0.8", features = ["json", "time", "uuid"] }
|
||||||
time = "0.3"
|
time = "0.3"
|
||||||
tokio = { version = "1", features = ["sync"] }
|
tokio = { version = "1", features = ["sync"] }
|
||||||
indexmap = { version = "2", features = ["serde"] }
|
indexmap = { version = "2", features = ["serde"] }
|
||||||
|
uuid = "1"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
sqlite = ["sqlx/sqlite", "sqlx/runtime-tokio"]
|
sqlite = ["sqlx/sqlite", "sqlx/runtime-tokio"]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
use sqlx::{postgres::PgValueRef, TypeInfo, Value, ValueRef};
|
use sqlx::{postgres::PgValueRef, TypeInfo, Value, ValueRef};
|
||||||
use time::{Date, OffsetDateTime, PrimitiveDateTime, Time};
|
use time::{Date, OffsetDateTime, PrimitiveDateTime, Time};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
@@ -14,13 +15,20 @@ pub(crate) fn to_json(v: PgValueRef) -> Result<JsonValue, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let res = match v.type_info().name() {
|
let res = match v.type_info().name() {
|
||||||
"CHAR" | "VARCHAR" | "TEXT" | "NAME" | "UUID" => {
|
"CHAR" | "VARCHAR" | "TEXT" | "NAME" => {
|
||||||
if let Ok(v) = ValueRef::to_owned(&v).try_decode() {
|
if let Ok(v) = ValueRef::to_owned(&v).try_decode() {
|
||||||
JsonValue::String(v)
|
JsonValue::String(v)
|
||||||
} else {
|
} else {
|
||||||
JsonValue::Null
|
JsonValue::Null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"UUID" => {
|
||||||
|
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<Uuid>() {
|
||||||
|
JsonValue::String(v.to_string())
|
||||||
|
} else {
|
||||||
|
JsonValue::Null
|
||||||
|
}
|
||||||
|
}
|
||||||
"FLOAT4" => {
|
"FLOAT4" => {
|
||||||
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<f32>() {
|
if let Ok(v) = ValueRef::to_owned(&v).try_decode::<f32>() {
|
||||||
JsonValue::from(v)
|
JsonValue::from(v)
|
||||||
|
|||||||
Reference in New Issue
Block a user