Compare commits

...

3 Commits

Author SHA1 Message Date
Jon Häggblad 22d6eaf9b8 Some minor conversions 2025-03-18 22:04:30 +01:00
Jon Häggblad a6b0b6f0f6 EXISTS return i64 2025-03-18 21:51:33 +01:00
Jon Häggblad a4bad2e697 Upgrade to sqlx 0.8.3 2025-03-18 21:34:51 +01:00
11 changed files with 91 additions and 95 deletions
Generated
+73 -77
View File
@@ -100,19 +100,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "ahash"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
"cfg-if",
"getrandom 0.2.15",
"once_cell",
"version_check",
"zerocopy 0.7.35",
]
[[package]]
name = "aho-corasick"
version = "1.1.3"
@@ -2466,6 +2453,12 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "foldhash"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "form_urlencoded"
version = "1.2.1"
@@ -2869,7 +2862,7 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash 0.7.8",
"ahash",
]
[[package]]
@@ -2877,24 +2870,25 @@ name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash 0.8.11",
"allocator-api2",
]
[[package]]
name = "hashbrown"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash",
]
[[package]]
name = "hashlink"
version = "0.8.4"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
dependencies = [
"hashbrown 0.14.5",
"hashbrown 0.15.2",
]
[[package]]
@@ -2948,9 +2942,6 @@ name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "heck"
@@ -3953,9 +3944,9 @@ dependencies = [
[[package]]
name = "libsqlite3-sys"
version = "0.27.0"
version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
dependencies = [
"cc",
"pkg-config",
@@ -8369,6 +8360,20 @@ dependencies = [
"zeroize",
]
[[package]]
name = "rustls"
version = "0.23.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c"
dependencies = [
"once_cell",
"ring",
"rustls-pki-types",
"rustls-webpki 0.103.0",
"subtle 2.6.1",
"zeroize",
]
[[package]]
name = "rustls-native-certs"
version = "0.6.3"
@@ -8439,6 +8444,17 @@ dependencies = [
"untrusted",
]
[[package]]
name = "rustls-webpki"
version = "0.103.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0aa4eeac2588ffff23e9d7a7e9b3f971c5fb5b7ebc9452745e0c232c64f83b2f"
dependencies = [
"ring",
"rustls-pki-types",
"untrusted",
]
[[package]]
name = "rustversion"
version = "1.0.19"
@@ -9016,6 +9032,9 @@ name = "smallvec"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
dependencies = [
"serde",
]
[[package]]
name = "smawk"
@@ -9099,21 +9118,11 @@ dependencies = [
"der",
]
[[package]]
name = "sqlformat"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bba3a93db0cc4f7bdece8bb09e77e2e785c20bfebf79eb8340ed80708048790"
dependencies = [
"nom",
"unicode_categories",
]
[[package]]
name = "sqlx"
version = "0.7.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa"
checksum = "4410e73b3c0d8442c5f99b425d7a435b5ee0ae4167b3196771dd3f7a01be745f"
dependencies = [
"sqlx-core",
"sqlx-macros",
@@ -9124,70 +9133,64 @@ dependencies = [
[[package]]
name = "sqlx-core"
version = "0.7.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6"
checksum = "6a007b6936676aa9ab40207cde35daab0a04b823be8ae004368c0793b96a61e0"
dependencies = [
"ahash 0.8.11",
"atoi",
"byteorder",
"bytes",
"chrono",
"crc",
"crossbeam-queue",
"either",
"event-listener 2.5.3",
"futures-channel",
"event-listener 5.4.0",
"futures-core",
"futures-intrusive",
"futures-io",
"futures-util",
"hashbrown 0.15.2",
"hashlink",
"hex",
"indexmap 2.7.1",
"log",
"memchr",
"once_cell",
"paste",
"percent-encoding",
"rustls 0.21.12",
"rustls-pemfile 1.0.4",
"rustls 0.23.25",
"rustls-pemfile 2.2.0",
"serde",
"serde_json",
"sha2 0.10.8",
"smallvec",
"sqlformat",
"thiserror 1.0.69",
"thiserror 2.0.12",
"time",
"tokio",
"tokio-stream",
"tracing",
"url",
"webpki-roots 0.25.4",
"webpki-roots 0.26.8",
]
[[package]]
name = "sqlx-macros"
version = "0.7.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127"
checksum = "3112e2ad78643fef903618d78cf0aec1cb3134b019730edb039b69eaf531f310"
dependencies = [
"proc-macro2",
"quote",
"sqlx-core",
"sqlx-macros-core",
"syn 1.0.109",
"syn 2.0.98",
]
[[package]]
name = "sqlx-macros-core"
version = "0.7.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8"
checksum = "4e9f90acc5ab146a99bf5061a7eb4976b573f560bc898ef3bf8435448dd5e7ad"
dependencies = [
"dotenvy",
"either",
"heck 0.4.1",
"heck 0.5.0",
"hex",
"once_cell",
"proc-macro2",
@@ -9199,7 +9202,7 @@ dependencies = [
"sqlx-mysql",
"sqlx-postgres",
"sqlx-sqlite",
"syn 1.0.109",
"syn 2.0.98",
"tempfile",
"tokio",
"url",
@@ -9207,12 +9210,12 @@ dependencies = [
[[package]]
name = "sqlx-mysql"
version = "0.7.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418"
checksum = "4560278f0e00ce64938540546f59f590d60beee33fffbd3b9cd47851e5fff233"
dependencies = [
"atoi",
"base64 0.21.7",
"base64 0.22.1",
"bitflags 2.8.0",
"byteorder",
"bytes",
@@ -9243,7 +9246,7 @@ dependencies = [
"smallvec",
"sqlx-core",
"stringprep",
"thiserror 1.0.69",
"thiserror 2.0.12",
"time",
"tracing",
"whoami",
@@ -9251,12 +9254,12 @@ dependencies = [
[[package]]
name = "sqlx-postgres"
version = "0.7.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e"
checksum = "c5b98a57f363ed6764d5b3a12bfedf62f07aa16e1856a7ddc2a0bb190a959613"
dependencies = [
"atoi",
"base64 0.21.7",
"base64 0.22.1",
"bitflags 2.8.0",
"byteorder",
"chrono",
@@ -9265,7 +9268,6 @@ dependencies = [
"etcetera",
"futures-channel",
"futures-core",
"futures-io",
"futures-util",
"hex",
"hkdf",
@@ -9283,7 +9285,7 @@ dependencies = [
"smallvec",
"sqlx-core",
"stringprep",
"thiserror 1.0.69",
"thiserror 2.0.12",
"time",
"tracing",
"whoami",
@@ -9291,9 +9293,9 @@ dependencies = [
[[package]]
name = "sqlx-sqlite"
version = "0.7.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa"
checksum = "f85ca71d3a5b24e64e1d08dd8fe36c6c95c339a896cc33068148906784620540"
dependencies = [
"atoi",
"chrono",
@@ -9307,11 +9309,11 @@ dependencies = [
"log",
"percent-encoding",
"serde",
"serde_urlencoded",
"sqlx-core",
"time",
"tracing",
"url",
"urlencoding",
]
[[package]]
@@ -10548,12 +10550,6 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "unicode_categories"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
[[package]]
name = "uniffi"
version = "0.29.0"
+1 -1
View File
@@ -322,7 +322,7 @@ serde_yaml = "0.9.25"
sha2 = "0.10.8"
si-scale = "0.2.3"
sphinx-packet = "=0.3.2"
sqlx = "0.7.4"
sqlx = "0.8.3"
strum = "0.26"
strum_macros = "0.26"
subtle-encoding = "0.5"
@@ -87,7 +87,7 @@ impl StorageManager {
sqlx::query!("SELECT EXISTS (SELECT 1 FROM registered_gateway WHERE gateway_id_bs58 = ?) AS 'exists'", gateway_id)
.fetch_one(&self.connection_pool)
.await
.map(|result| result.exists == Some(1))
.map(|result| result.exists == 1)
}
pub(crate) async fn maybe_get_registered_gateway(
+1 -1
View File
@@ -182,7 +182,7 @@ impl PersistentStatsStorage {
pub async fn get_started_sessions_count(
&self,
start_date: Date,
) -> Result<i32, StatsStorageError> {
) -> Result<i64, StatsStorageError> {
Ok(self
.session_manager
.get_started_sessions_count(start_date)
+1 -1
View File
@@ -148,7 +148,7 @@ impl SessionManager {
.await
}
pub(crate) async fn get_started_sessions_count(&self, start_date: Date) -> Result<i32> {
pub(crate) async fn get_started_sessions_count(&self, start_date: Date) -> Result<i64> {
Ok(sqlx::query!(
"SELECT COUNT(*) as count FROM sessions_active WHERE date(start_time) = ?",
start_date
+1 -1
View File
@@ -17,7 +17,7 @@ sqlx = { workspace = true, features = [
"macros",
"migrate",
"time",
"chrono"
# "chrono"
] }
time = { workspace = true }
thiserror = { workspace = true }
+1 -1
View File
@@ -92,7 +92,7 @@ impl TicketStorageManager {
)
.fetch_one(&self.connection_pool)
.await
.map(|result| result.exists == Some(1))
.map(|result| result.exists == 1)
}
pub(crate) async fn remove_binary_ticket_data(
+1 -1
View File
@@ -111,7 +111,7 @@ impl StorageManager {
consensus_address: &str,
start_height: i64,
end_height: i64,
) -> Result<i32, sqlx::Error> {
) -> Result<i64, sqlx::Error> {
trace!("get_signed_between");
let start = Instant::now();
+2 -2
View File
@@ -170,7 +170,7 @@ impl ScraperStorage {
consensus_address: &str,
start_height: i64,
end_height: i64,
) -> Result<i32, ScraperError> {
) -> Result<i64, ScraperError> {
Ok(self
.manager
.get_signed_between(consensus_address, start_height, end_height)
@@ -182,7 +182,7 @@ impl ScraperStorage {
consensus_address: &str,
start_time: OffsetDateTime,
end_time: OffsetDateTime,
) -> Result<i32, ScraperError> {
) -> Result<i64, ScraperError> {
let Some(block_start) = self.get_first_block_height_after(start_time).await? else {
return Ok(0);
};
+7 -7
View File
@@ -747,7 +747,7 @@ impl StorageManager {
&self,
db_mixnode_id: i64,
since: i64,
) -> Result<i32, sqlx::Error> {
) -> Result<i64, sqlx::Error> {
let count = sqlx::query!(
r#"
SELECT COUNT(*) as count FROM
@@ -786,7 +786,7 @@ impl StorageManager {
&self,
gateway_id: i64,
since: i64,
) -> Result<i32, sqlx::Error> {
) -> Result<i64, sqlx::Error> {
let count = sqlx::query!(
r#"
SELECT COUNT(*) as count FROM
@@ -824,7 +824,7 @@ impl StorageManager {
)
.fetch_one(&self.connection_pool)
.await
.map(|result| result.exists == Some(1))
.map(|result| result.exists == 1)
}
/// Creates new entry for mixnode historical uptime
@@ -966,7 +966,7 @@ impl StorageManager {
&self,
since: i64,
until: i64,
) -> Result<i32, sqlx::Error> {
) -> Result<i64, sqlx::Error> {
let count = sqlx::query!(
"SELECT COUNT(*) as count FROM monitor_run WHERE timestamp > ? AND timestamp < ?",
since,
@@ -1227,7 +1227,7 @@ impl StorageManager {
.await
}
pub(super) async fn get_mixnode_statuses_count(&self, db_id: i64) -> Result<i32, sqlx::Error> {
pub(super) async fn get_mixnode_statuses_count(&self, db_id: i64) -> Result<i64, sqlx::Error> {
sqlx::query!(
r#"
SELECT COUNT(*) as count
@@ -1279,7 +1279,7 @@ impl StorageManager {
.await
}
pub(super) async fn get_gateway_statuses_count(&self, db_id: i64) -> Result<i32, sqlx::Error> {
pub(super) async fn get_gateway_statuses_count(&self, db_id: i64) -> Result<i64, sqlx::Error> {
sqlx::query!(
r#"
SELECT COUNT(*) as count
@@ -1341,7 +1341,7 @@ pub(crate) mod v3_migration {
sqlx::query!("SELECT EXISTS (SELECT 1 FROM v3_migration_info) AS 'exists'",)
.fetch_one(&self.connection_pool)
.await
.map(|result| result.exists == Some(1))
.map(|result| result.exists == 1)
}
pub(crate) async fn set_v3_migration_completion(&self) -> Result<(), sqlx::Error> {
+2 -2
View File
@@ -679,7 +679,7 @@ impl NymApiStorage {
&self,
mix_id: NodeId,
since: Option<i64>,
) -> Result<i32, NymApiStorageError> {
) -> Result<i64, NymApiStorageError> {
let db_id = self.manager.get_mixnode_database_id(mix_id).await?;
if let Some(node_id) = db_id {
@@ -707,7 +707,7 @@ impl NymApiStorage {
&self,
identity: &str,
since: Option<i64>,
) -> Result<i32, NymApiStorageError> {
) -> Result<i64, NymApiStorageError> {
let node_id = self
.manager
.get_gateway_database_id_by_identity(identity)