From b1576da6747c0e910e84530f4a854097b1254590 Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Sun, 16 Jul 2023 00:21:12 +0200 Subject: [PATCH 01/12] impl Serialize for Join --- Cargo.lock | 83 +++++++++++++++++++++++++----------------------- core/Cargo.toml | 3 +- core/src/join.rs | 13 ++++++++ 3 files changed, 58 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7e601bd9..9fd9c7c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,9 +50,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56fc6cf8dc8c4158eed8649f9b8b0ea1518eb62b544fe9490d66fa0b349eafe9" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "android-tzdata" @@ -120,9 +120,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arrayvec" @@ -144,7 +144,7 @@ checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -197,9 +197,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basic-toml" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f838d03a705d72b12389b8930bd14cacf493be1380bfb15720d4d12db5ab03ac" +checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" dependencies = [ "serde", ] @@ -362,9 +362,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.11" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" +checksum = "3eab9e8ceb9afdade1ab3f0fd8dbce5b1b2f468ad653baf10e771781b2b67b73" dependencies = [ "clap_builder", "clap_derive", @@ -373,9 +373,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.11" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" +checksum = "9f2763db829349bf00cfc06251268865ed4363b93a943174f638daf3ecdba2cd" dependencies = [ "anstream", "anstyle", @@ -385,14 +385,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -612,9 +612,9 @@ dependencies = [ [[package]] name = "dissimilar" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210ec60ae7d710bed8683e333e9d2855a8a56a3e9892b38bad3bb0d4d29b0d5e" +checksum = "86e3bdc80eee6e16b2b6b0f87fbc98c04bee3455e35174c0de1a125d0688c632" [[package]] name = "dotenvy" @@ -768,7 +768,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -1026,9 +1026,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" @@ -1305,6 +1305,7 @@ dependencies = [ "async-trait", "futures", "ormlite-attr", + "serde", "sqlmo", "sqlparser", "sqlx", @@ -1385,9 +1386,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pem-rfc7468" @@ -1421,7 +1422,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -1481,9 +1482,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "92de25114670a878b1261c79c9f8f729fb97e95bac93f6312f583c60dd6a1dfe" dependencies = [ "unicode-ident", ] @@ -1510,9 +1511,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.29" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5907a1b7c277254a8b15170f6e7c97cfa60ee7872a3217663bb81151e48184bb" dependencies = [ "proc-macro2", ] @@ -1743,9 +1744,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -1795,14 +1796,14 @@ checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] name = "serde_json" -version = "1.0.102" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ "itoa", "ryu", @@ -1919,6 +1920,8 @@ dependencies = [ [[package]] name = "sqlmo" version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2c8c2689eb43b89e3eb8feaad2a875ddab39efa08fb5f6841419b6335712ebb" dependencies = [ "anyhow", "tracing", @@ -2109,9 +2112,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" dependencies = [ "proc-macro2", "quote", @@ -2150,7 +2153,7 @@ checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2244,7 +2247,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2298,7 +2301,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2366,9 +2369,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -2485,7 +2488,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", "wasm-bindgen-shared", ] @@ -2507,7 +2510,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/core/Cargo.toml b/core/Cargo.toml index e12ff925..a71e7f5e 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -23,8 +23,9 @@ sqlmo = "0.13" ormlite-attr = { path = "../attr" , version = "0.16"} anyhow = "1.0.69" async-trait = "0.1.68" +serde = { version = "1.0.130", features = ["derive"] } [dev-dependencies] syn = "1.0.108" assert_matches = "1.5.0" -uuid = { version = "1.3.2", features = ["serde", "v4"] } +uuid = { version = "1.3.2", features = ["serde", "v4"] } \ No newline at end of file diff --git a/core/src/join.rs b/core/src/join.rs index 1cb6565b..50d0a3af 100644 --- a/core/src/join.rs +++ b/core/src/join.rs @@ -1,5 +1,6 @@ use std::ops::{Deref, DerefMut}; use async_trait::async_trait; +use serde::{Serialize, Serializer}; use sqlmo::query::{Join as JoinQueryFragment}; use sqlmo::query::SelectColumn; use sqlx::{Database, Decode, Encode, Type}; @@ -207,4 +208,16 @@ impl JoinDescription { pub fn alias(&self, column: &str) -> String { format!("__{}__{}", self.relation, column) } +} + +impl Serialize for Join { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer { + match &self.data { + JoinData::Modified(data) => data.serialize(serializer), + JoinData::NotQueried => serializer.serialize_none(), + JoinData::QueryResult(data) => data.serialize(serializer), + } + } } \ No newline at end of file From 27d74e78ad013832b44b0f2b3835e911e13b87ae Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Sun, 16 Jul 2023 16:24:57 +0200 Subject: [PATCH 02/12] Add constraints to JoinMeta::IdType --- core/src/join.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/join.rs b/core/src/join.rs index 50d0a3af..7f3100e0 100644 --- a/core/src/join.rs +++ b/core/src/join.rs @@ -7,7 +7,7 @@ use sqlx::{Database, Decode, Encode, Type}; use crate::model::Model; pub trait JoinMeta { - type IdType: Clone + Send; + type IdType: Clone + Send + Eq + PartialEq + std::hash::Hash; fn _id(&self) -> Self::IdType; } From bdab001ba738b96159fa83540f5df2c6a6664c6f Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Mon, 17 Jul 2023 10:31:28 +0200 Subject: [PATCH 03/12] Update dependencies, migrate to syn@2 --- Cargo.lock | 529 ++++++++++++++++++++++++++----- attr/Cargo.toml | 20 +- attr/src/metadata.rs | 6 +- attr/src/syndecode.rs | 6 +- attr/src/syndecode/args.rs | 40 ++- attr/src/syndecode/derive.rs | 9 +- attr/src/syndecode/properties.rs | 13 +- cli/Cargo.toml | 34 +- core/Cargo.toml | 22 +- macro/Cargo.toml | 14 +- ormlite/Cargo.toml | 8 +- 11 files changed, 526 insertions(+), 175 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9fd9c7c4..862cebdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,6 +35,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", + "getrandom", "once_cell", "version_check", ] @@ -156,6 +157,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -215,6 +225,9 @@ name = "bitflags" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -420,9 +433,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" [[package]] name = "convert_case" @@ -482,16 +495,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -539,13 +542,13 @@ dependencies = [ [[package]] name = "der" -version = "0.5.1" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" dependencies = [ "const-oid", - "crypto-bigint", "pem-rfc7468", + "zeroize", ] [[package]] @@ -586,6 +589,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] @@ -627,6 +631,9 @@ name = "either" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +dependencies = [ + "serde", +] [[package]] name = "env_logger" @@ -641,6 +648,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.1" @@ -662,12 +675,32 @@ dependencies = [ "libc", ] +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys", +] + [[package]] name = "event-listener" version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "flume" version = "0.10.14" @@ -754,6 +787,17 @@ dependencies = [ "parking_lot 0.11.2", ] +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot 0.12.1", +] + [[package]] name = "futures-io" version = "0.3.28" @@ -923,6 +967,15 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + [[package]] name = "humantime" version = "2.1.0" @@ -995,6 +1048,16 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "instant" version = "0.1.12" @@ -1004,6 +1067,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys", +] + [[package]] name = "is-terminal" version = "0.4.9" @@ -1011,7 +1085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix", + "rustix 0.38.4", "windows-sys", ] @@ -1024,6 +1098,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -1062,15 +1145,21 @@ checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libsqlite3-sys" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" dependencies = [ "cc", "pkg-config", "vcpkg", ] +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "linux-raw-sys" version = "0.4.3" @@ -1248,8 +1337,8 @@ dependencies = [ "ormlite-macro", "serde", "sqlmo", - "sqlx", - "sqlx-core", + "sqlx 0.7.1", + "sqlx-core 0.7.1", "tokio", "tokio-stream", "trybuild", @@ -1268,7 +1357,7 @@ dependencies = [ "quote", "sqlmo", "structmeta", - "syn 1.0.109", + "syn 2.0.26", "tracing", ] @@ -1288,7 +1377,7 @@ dependencies = [ "sha2", "sqlmo", "sqlmo_sqlx", - "syn 1.0.109", + "syn 2.0.26", "time 0.3.23", "tokio", "tracing", @@ -1308,8 +1397,8 @@ dependencies = [ "serde", "sqlmo", "sqlparser", - "sqlx", - "syn 1.0.109", + "sqlx 0.7.1", + "syn 2.0.26", "thiserror", "tokio", "uuid", @@ -1319,15 +1408,15 @@ dependencies = [ name = "ormlite-macro" version = "0.16.0" dependencies = [ - "itertools", + "itertools 0.11.0", "lazy_static", "once_cell", "ormlite-attr", "ormlite-core", "proc-macro2", "quote", - "sqlx", - "syn 1.0.109", + "sqlx 0.7.1", + "syn 2.0.26", ] [[package]] @@ -1392,9 +1481,9 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pem-rfc7468" -version = "0.3.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" dependencies = [ "base64ct", ] @@ -1439,24 +1528,23 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs1" -version = "0.3.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" dependencies = [ "der", "pkcs8", - "zeroize", + "spki", ] [[package]] name = "pkcs8" -version = "0.8.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", - "zeroize", ] [[package]] @@ -1482,9 +1570,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.65" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92de25114670a878b1261c79c9f8f729fb97e95bac93f6312f583c60dd6a1dfe" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -1511,9 +1599,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5907a1b7c277254a8b15170f6e7c97cfa60ee7872a3217663bb81151e48184bb" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" dependencies = [ "proc-macro2", ] @@ -1666,11 +1754,12 @@ dependencies = [ [[package]] name = "rsa" -version = "0.6.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b" +checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" dependencies = [ "byteorder", + "const-oid", "digest", "num-bigint-dig", "num-integer", @@ -1679,7 +1768,8 @@ dependencies = [ "pkcs1", "pkcs8", "rand_core", - "smallvec", + "signature", + "spki", "subtle", "zeroize", ] @@ -1708,6 +1798,20 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustix" +version = "0.37.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys", +] + [[package]] name = "rustix" version = "0.38.4" @@ -1717,7 +1821,7 @@ dependencies = [ "bitflags 2.3.3", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.3", "windows-sys", ] @@ -1733,6 +1837,17 @@ dependencies = [ "webpki", ] +[[package]] +name = "rustls" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" +dependencies = [ + "ring", + "rustls-webpki", + "sct", +] + [[package]] name = "rustls-pemfile" version = "1.0.3" @@ -1742,6 +1857,16 @@ dependencies = [ "base64 0.21.2", ] +[[package]] +name = "rustls-webpki" +version = "0.101.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "ryu" version = "1.0.15" @@ -1850,6 +1975,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "simdutf8" version = "0.1.4" @@ -1898,9 +2033,9 @@ dependencies = [ [[package]] name = "spki" -version = "0.5.4" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", @@ -1912,16 +2047,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e" dependencies = [ - "itertools", + "itertools 0.10.5", "nom", "unicode_categories", ] [[package]] name = "sqlmo" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2c8c2689eb43b89e3eb8feaad2a875ddab39efa08fb5f6841419b6335712ebb" +checksum = "0fa64e26409e061ca3d6e0da7c0b295b735e2b3c86c75bc601d93b0d7d07f43b" dependencies = [ "anyhow", "tracing", @@ -1929,22 +2064,22 @@ dependencies = [ [[package]] name = "sqlmo_sqlx" -version = "0.1.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20eb410bcd9bd13315ae519bbcf07780831d9e91a7c66b0a1d5e8316d2c928d" +checksum = "799e0ea0a8d69e5ce1231a6f1713b704fc6323593c579c26663b9e65d191b6ed" dependencies = [ "anyhow", "async-trait", - "itertools", + "itertools 0.10.5", "sqlmo", - "sqlx", + "sqlx 0.6.3", ] [[package]] name = "sqlparser" -version = "0.28.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "249ae674b9f636b8ff64d8bfe218774cf05a26de40fd9f358669dccc4c0a9d7d" +checksum = "ca597d77c98894be1f965f2e4e2d2a61575d4998088e655476c73715c54b2b43" dependencies = [ "log", ] @@ -1955,8 +2090,21 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8de3b03a925878ed54a954f621e64bf55a3c1bd29652d0d1a17830405350188" dependencies = [ - "sqlx-core", - "sqlx-macros", + "sqlx-core 0.6.3", + "sqlx-macros 0.6.3", +] + +[[package]] +name = "sqlx" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721" +dependencies = [ + "sqlx-core 0.7.1", + "sqlx-macros 0.7.1", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", ] [[package]] @@ -1966,45 +2114,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" dependencies = [ "ahash 0.7.6", - "atoi", + "atoi 1.0.0", "base64 0.13.1", "bitflags 1.3.2", "byteorder", "bytes", - "chrono", "crc", "crossbeam-queue", - "digest", "dirs", "dotenvy", "either", "event-listener", - "flume", "futures-channel", "futures-core", - "futures-executor", - "futures-intrusive", + "futures-intrusive 0.4.2", "futures-util", - "generic-array", "hashlink", "hex", "hkdf", "hmac", - "indexmap", + "indexmap 1.9.3", "itoa", "libc", - "libsqlite3-sys", "log", "md-5", "memchr", - "num-bigint", "once_cell", "paste", "percent-encoding", "rand", - "rsa", - "rust_decimal", - "rustls", + "rustls 0.20.8", "rustls-pemfile", "serde", "serde_json", @@ -2015,12 +2154,57 @@ dependencies = [ "sqlx-rt", "stringprep", "thiserror", + "tokio-stream", + "url", + "webpki-roots 0.22.6", + "whoami", +] + +[[package]] +name = "sqlx-core" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53" +dependencies = [ + "ahash 0.8.3", + "atoi 2.0.0", + "byteorder", + "bytes", + "chrono", + "crc", + "crossbeam-queue", + "dotenvy", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive 0.5.0", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap 2.0.0", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "rust_decimal", + "rustls 0.21.5", + "rustls-pemfile", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", "time 0.3.23", + "tokio", "tokio-stream", + "tracing", "url", "uuid", - "webpki-roots", - "whoami", + "webpki-roots 0.24.0", ] [[package]] @@ -2035,14 +2219,142 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "serde_json", "sha2", - "sqlx-core", + "sqlx-core 0.6.3", "sqlx-rt", "syn 1.0.109", "url", ] +[[package]] +name = "sqlx-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core 0.7.1", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc" +dependencies = [ + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core 0.7.1", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca69bf415b93b60b80dc8fda3cb4ef52b2336614d8da2de5456cc942a110482" +dependencies = [ + "atoi 2.0.0", + "base64 0.21.2", + "bitflags 2.3.3", + "byteorder", + "bytes", + "chrono", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "rust_decimal", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core 0.7.1", + "stringprep", + "thiserror", + "time 0.3.23", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0db2df1b8731c3651e204629dd55e52adbae0462fa1bdcbed56a2302c18181e" +dependencies = [ + "atoi 2.0.0", + "base64 0.21.2", + "bitflags 2.3.3", + "byteorder", + "chrono", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "num-bigint", + "once_cell", + "rand", + "rust_decimal", + "serde", + "serde_json", + "sha1", + "sha2", + "smallvec", + "sqlx-core 0.7.1", + "stringprep", + "thiserror", + "time 0.3.23", + "tracing", + "uuid", + "whoami", +] + [[package]] name = "sqlx-rt" version = "0.6.3" @@ -2054,11 +2366,36 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "sqlx-sqlite" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4c21bf34c7cae5b283efb3ac1bcc7670df7561124dc2f8bdc0b59be40f79a2" +dependencies = [ + "atoi 2.0.0", + "chrono", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive 0.5.0", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core 0.7.1", + "time 0.3.23", + "tracing", + "url", + "uuid", +] + [[package]] name = "stringprep" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +checksum = "db3737bde7edce97102e0e2b15365bf7a20bfdb5f60f4f9e8d7004258a51a8da" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2072,25 +2409,25 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "structmeta" -version = "0.1.6" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104842d6278bf64aa9d2f182ba4bde31e8aec7a131d29b7f444bb9b344a09e2a" +checksum = "78ad9e09554f0456d67a69c1584c9798ba733a5b50349a6c0d0948710523922d" dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 1.0.109", + "syn 2.0.26", ] [[package]] name = "structmeta-derive" -version = "0.1.6" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24420be405b590e2d746d83b01f09af673270cf80e9b003a5fa7b651c58c7d93" +checksum = "a60bcaff7397072dca0017d1db428e30d5002e00b6847703e2e42005c95fbe00" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.26", ] [[package]] @@ -2127,6 +2464,20 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tempfile" +version = "3.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +dependencies = [ + "autocfg", + "cfg-if", + "fastrand", + "redox_syscall 0.3.5", + "rustix 0.37.23", + "windows-sys", +] + [[package]] name = "termcolor" version = "1.2.0" @@ -2256,7 +2607,7 @@ version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "rustls", + "rustls 0.20.8", "tokio", "webpki", ] @@ -2288,6 +2639,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2419,9 +2771,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ "getrandom", "serde", @@ -2550,6 +2902,15 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" +dependencies = [ + "rustls-webpki", +] + [[package]] name = "whoami" version = "1.4.1" diff --git a/attr/Cargo.toml b/attr/Cargo.toml index 16b7ba22..1079ffee 100644 --- a/attr/Cargo.toml +++ b/attr/Cargo.toml @@ -15,13 +15,13 @@ doctest = false [features] [dependencies] -proc-macro2 = "1.0.34" -quote = "1.0.10" -syn = { version = "1.0.82", features = ["full", "extra-traits"] } -derive_builder = "0.12.0" -structmeta = "0.1.4" -convert_case = "0.6.0" -anyhow = "1.0.68" -ignore = "0.4.18" -sqlmo = "0.13" -tracing = "0.1.37" +proc-macro2 = "1.0" +quote = "1.0" +syn = { version = "2", features = ["full", "extra-traits"] } +derive_builder = "0.12" +structmeta = "0.2" +convert_case = "0.6" +anyhow = "1.0" +ignore = "0.4" +sqlmo = "0.14" +tracing = "0.1" diff --git a/attr/src/metadata.rs b/attr/src/metadata.rs index 16dd5b3f..f963adcd 100644 --- a/attr/src/metadata.rs +++ b/attr/src/metadata.rs @@ -311,7 +311,7 @@ impl ModelMetadata { )); let pkey = meta.columns.iter().find(|&c| c.column_name == pkey).unwrap().clone(); let mut insert_struct = None; - for attr in ast.attrs.iter().filter(|a| a.path.is_ident("ormlite")) { + for attr in ast.attrs.iter().filter(|a| a.path().is_ident("ormlite")) { let args: ModelAttributes = attr.parse_args() .map_err(|e| SyndecodeError(e.to_string()))?; if let Some(value) = args.insertable { @@ -346,7 +346,7 @@ impl TableMetadata { let mut databases = vec![]; let struct_name = Ident::from(&ast.ident); let mut table_name = None; - for attr in ast.attrs.iter().filter(|a| a.path.is_ident("ormlite")) { + for attr in ast.attrs.iter().filter(|a| a.path().is_ident("ormlite")) { let args: ModelAttributes = attr.parse_args() .map_err(|e| SyndecodeError(e.to_string()))?; if let Some(value) = args.table { @@ -529,7 +529,7 @@ impl TryFrom<&Field> for ColumnMetadata { .rust_default(None) ; let mut has_join_directive = false; - for attr in f.attrs.iter().filter(|&a| a.path.is_ident("ormlite")) { + for attr in f.attrs.iter().filter(|&a| a.path().is_ident("ormlite")) { let args: ColumnAttributes = attr.parse_args().unwrap(); if args.primary_key.value() { builder.marked_primary_key(true); diff --git a/attr/src/syndecode.rs b/attr/src/syndecode.rs index 0b0bd606..df6c63d7 100644 --- a/attr/src/syndecode.rs +++ b/attr/src/syndecode.rs @@ -74,14 +74,14 @@ impl From<&[syn::Attribute]> for Attributes { fn from(attrs: &[syn::Attribute]) -> Self { let mut attributes = Vec::new(); for attr in attrs.iter() { - if attr.path.is_ident("derive") { + if attr.path().is_ident("derive") { DeriveAttribute::decode_many_from_attr(attr) .into_iter() .map(Attribute::Derive) .for_each(|a| attributes.push(a)); } else { - let name = attr.path.segments.last().unwrap().ident.to_string(); - let attr = if attr.tokens.is_empty() { + let name = attr.path().segments.last().unwrap().ident.to_string(); + let attr = if attr.meta.require_list().unwrap().tokens.is_empty() { Attribute::Flag(name) } else { PropertiesAttribute::try_from(attr).map(Attribute::Properties) diff --git a/attr/src/syndecode/args.rs b/attr/src/syndecode/args.rs index 4c23f495..907e318a 100644 --- a/attr/src/syndecode/args.rs +++ b/attr/src/syndecode/args.rs @@ -11,35 +11,33 @@ impl TryFrom<&syn::Attribute> for ArgsAttribute { type Error = SyndecodeError; fn try_from(attr: &syn::Attribute) -> Result { - let name = attr.path.segments.first().ok_or_else(|| SyndecodeError("Must have a segment.".to_string()))?.ident.to_string(); - let group = attr.tokens.clone().into_iter().next().ok_or_else(|| SyndecodeError("ArgAttributes must have at least one token group.".to_string()))?; + let name = attr.path().segments.first().ok_or_else(|| SyndecodeError("Must have a segment.".to_string()))?.ident.to_string(); + let tokens = attr.meta.require_list().expect("ArgAttributes must have at least one token group.").clone().tokens; + let mut args = Vec::new(); - if let TokenTree::Group(group) = group { - let group = group.stream().into_iter(); - let mut current: Option = None; + let mut current: Option = None; - for tok in group { - match tok { - TokenTree::Punct(p) if p.as_char() == ',' => { - if let Some(current) = current.take() { - args.push(current) - } + for tok in tokens { + match tok { + TokenTree::Punct(p) if p.as_char() == ',' => { + if let Some(current) = current.take() { + args.push(current) } - _ => { - if let Some(ref mut current) = current { - current.push_str(&tok.to_string()); - } else { - current = Some(tok.to_string()); - } + } + _ => { + if let Some(ref mut current) = current { + current.push_str(&tok.to_string()); + } else { + current = Some(tok.to_string()); } } } + } - if let Some(current) = current { - args.push(current) - } - }; + if let Some(current) = current { + args.push(current) + } Ok(Self { name, diff --git a/attr/src/syndecode/derive.rs b/attr/src/syndecode/derive.rs index c2c1ef1b..566dd748 100644 --- a/attr/src/syndecode/derive.rs +++ b/attr/src/syndecode/derive.rs @@ -24,16 +24,11 @@ impl DeriveAttribute { } pub fn decode_many_from_attr(attr: &syn::Attribute) -> Vec { - let group = attr.tokens.clone().into_iter().next().expect("Derive attribute must have a token group"); - let TokenTree::Group(group) = group else { - panic!("Derive attribute must have a token group"); - }; - let group = group.stream().into_iter(); - + let tokens = attr.meta.require_list().expect("Derive attribute must have a token group").clone().tokens; let mut current: Option = None; let mut attributes = Vec::new(); - for tok in group { + for tok in tokens { match tok { TokenTree::Group(_) => {} TokenTree::Ident(i) => { diff --git a/attr/src/syndecode/properties.rs b/attr/src/syndecode/properties.rs index 329fd735..e15b485a 100644 --- a/attr/src/syndecode/properties.rs +++ b/attr/src/syndecode/properties.rs @@ -1,6 +1,7 @@ use std::collections::HashMap; use crate::SyndecodeError; use proc_macro2::TokenTree; +use quote::ToTokens; #[derive(Debug)] pub struct PropertiesAttribute { @@ -12,18 +13,14 @@ impl TryFrom<&syn::Attribute> for PropertiesAttribute { type Error = SyndecodeError; fn try_from(attr: &syn::Attribute) -> Result { - let name = attr.path.segments.first().ok_or_else(|| SyndecodeError("Must have a segment.".to_string()))?.ident.to_string(); - let group = attr.tokens.clone().into_iter().next().ok_or_else(|| SyndecodeError("Must have a token group.".to_string()))?; - let TokenTree::Group(group) = group else { - return Err(SyndecodeError("Must have a token group.".to_string())); - }; - let mut group = group.stream().into_iter(); + let name = attr.path().segments.first().ok_or_else(|| SyndecodeError("Must have a segment.".to_string()))?.ident.to_string(); + let mut tokens = attr.meta.require_list().expect("Must have a token group").clone().tokens.into_iter(); let mut current_key: Option = None; let mut current_value: Option = None; let mut properties = HashMap::new(); - while let Some(tok) = group.next() { + while let Some(tok) = tokens.next() { match tok { TokenTree::Punct(p) if p.as_char() == ',' => { if let Some((key, value)) = current_key.take().zip(current_value.take()) { @@ -32,7 +29,7 @@ impl TryFrom<&syn::Attribute> for PropertiesAttribute { } TokenTree::Ident(i) if current_key.is_none() => { current_key = Some(i.to_string()); - if !matches!(group.next(), Some(TokenTree::Punct(p)) if p.as_char() == '=') { + if !matches!(tokens.next(), Some(TokenTree::Punct(p)) if p.as_char() == '=') { return Err(SyndecodeError("Expected an equals sign.".to_string())); } } diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 5cd92d13..c084be32 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -20,23 +20,23 @@ default = ["ormlite/postgres", "ormlite/uuid", "ormlite/time", "ormlite/json", " experimental-sid = [] [dependencies] -anyhow = "1.0.68" -time = { version = "0.3.5", features = ["formatting"] } -clap = { version = "4.0.32", features = ["derive"] } -ormlite = { version = "0.16.0", path = "../ormlite" } -ormlite-core = { version = "0.16.0", path = "../core" } -ormlite-attr = { version = "0.16.0", path = "../attr" } +anyhow = "1" +time = { version = "0.3", features = ["formatting"] } +clap = { version = "4", features = ["derive"] } +ormlite = { version = "0.16", path = "../ormlite" } +ormlite-core = { version = "0.16", path = "../core" } +ormlite-attr = { version = "0.16", path = "../attr" } tokio = { version = "1", features = ["full"] } -sqlmo = { version = "0.13", features = ["tracing"] } -sqlmo_sqlx = "0.1" -syn = "1.0.107" -proc-macro2 = "1.0.49" -url = "2.3.1" -sha2 = "0.10.6" -regex = "1.7.0" -colored = "2.0.0" -tracing-subscriber = "0.3.17" -tracing = "0.1.37" +sqlmo = { version = "0.14", features = ["tracing"] } +sqlmo_sqlx = "0.14" +syn = "2" +proc-macro2 = "1" +url = "2" +sha2 = "0.10" +regex = "1" +colored = "2" +tracing-subscriber = "0.3" +tracing = "0.1" [dev-dependencies] -assert_matches = "1.5.0" +assert_matches = "1" diff --git a/core/Cargo.toml b/core/Cargo.toml index a71e7f5e..3c6d68e3 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -15,17 +15,17 @@ runtime-tokio-rustls = ["sqlx/runtime-tokio-rustls"] [dependencies] tokio = { version = "1", features = ["full"] } -futures = "0.3.25" -sqlx = "0.6.0" -sqlparser = "0.28.0" -thiserror = "1.0.30" -sqlmo = "0.13" +futures = "0.3" +sqlx = "0.7" +sqlparser = "0.35" +thiserror = "1" +sqlmo = "0.14" ormlite-attr = { path = "../attr" , version = "0.16"} -anyhow = "1.0.69" -async-trait = "0.1.68" -serde = { version = "1.0.130", features = ["derive"] } +anyhow = "1" +async-trait = "0.1" +serde = { version = "1", features = ["derive"] } [dev-dependencies] -syn = "1.0.108" -assert_matches = "1.5.0" -uuid = { version = "1.3.2", features = ["serde", "v4"] } \ No newline at end of file +syn = "2" +assert_matches = "1" +uuid = { version = "1", features = ["serde", "v4"] } \ No newline at end of file diff --git a/macro/Cargo.toml b/macro/Cargo.toml index cdb04557..f9e1f61c 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -21,12 +21,12 @@ default-postgres = ["postgres"] default-mysql = ["mysql"] [dependencies] -syn = { version = "1.0.82", features = ["derive", "parsing"] } -quote = "1.0.10" -proc-macro2 = "1.0.49" +syn = { version = "2", features = ["derive", "parsing"] } +quote = "1" +proc-macro2 = "1" ormlite-core = { path = "../core", version = "0.16.0" } ormlite-attr = { path = "../attr", version = "0.16" } -sqlx = "0.6.0" -lazy_static = "1.4.0" -once_cell = "1.17.1" -itertools = "0.10.5" +sqlx = "0.7" +lazy_static = "1" +once_cell = "1" +itertools = "0.11" diff --git a/ormlite/Cargo.toml b/ormlite/Cargo.toml index 9fad1db8..4a64f09e 100644 --- a/ormlite/Cargo.toml +++ b/ormlite/Cargo.toml @@ -32,7 +32,7 @@ sqlite = ["sqlx/sqlite", "ormlite-macro/sqlite", "ormlite-core/sqlite"] postgres = ["sqlx/postgres", "ormlite-macro/postgres", "ormlite-core/postgres"] runtime-tokio-rustls = ["ormlite-macro/runtime-tokio-rustls", "sqlx/runtime-tokio-rustls", "ormlite-core/runtime-tokio-rustls"] uuid = ["sqlx/uuid"] -decimal = ["sqlx/decimal"] +decimal = ["sqlx/rust_decimal"] chrono = ["sqlx/chrono"] time = ["sqlx/time"] json = ["sqlx/json"] @@ -47,12 +47,12 @@ default-sqlite = ["sqlite", "ormlite-macro/default-sqlite"] default-mysql = ["mysql", "ormlite-macro/default-mysql"] [dependencies] -sqlx = { version = "0.6.2" } +sqlx = { version = "0.7" } tokio = { version = "1.24.1", features = ["full"] } ormlite-macro = { path = "../macro" , version = "0.16.0"} ormlite-core = { path = "../core" , version = "0.16.0"} -sqlx-core = "0.6.2" -sqlmo = "0.13" +sqlx-core = "0.7" +sqlmo = "0.14" tokio-stream = "0.1.14" [dev-dependencies] From 135884666cbb2e0c5db425424dd9fb2e1eb189f2 Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Tue, 18 Jul 2023 07:22:44 +0200 Subject: [PATCH 04/12] use local sqlmo --- Cargo.lock | 316 ++++++--------------------------------------- attr/Cargo.toml | 2 +- cli/Cargo.toml | 4 +- core/Cargo.toml | 4 +- ormlite/Cargo.toml | 2 +- 5 files changed, 42 insertions(+), 286 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 862cebdf..6d10ba16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -148,15 +148,6 @@ dependencies = [ "syn 2.0.26", ] -[[package]] -name = "atoi" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e" -dependencies = [ - "num-traits", -] - [[package]] name = "atoi" version = "2.0.0" @@ -187,12 +178,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.2" @@ -375,9 +360,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.12" +version = "4.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eab9e8ceb9afdade1ab3f0fd8dbce5b1b2f468ad653baf10e771781b2b67b73" +checksum = "8f644d0dac522c8b05ddc39aaaccc5b136d5dc4ff216610c5641e3be5becf56c" dependencies = [ "clap_builder", "clap_derive", @@ -386,9 +371,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.12" +version = "4.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f2763db829349bf00cfc06251268865ed4363b93a943174f638daf3ecdba2cd" +checksum = "af410122b9778e024f9e0fb35682cc09cc3f85cad5e8d3ba8f47a9702df6e73d" dependencies = [ "anstream", "anstyle", @@ -594,26 +579,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "dissimilar" version = "1.0.7" @@ -776,17 +741,6 @@ dependencies = [ "futures-util", ] -[[package]] -name = "futures-intrusive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" -dependencies = [ - "futures-core", - "lock_api", - "parking_lot 0.11.2", -] - [[package]] name = "futures-intrusive" version = "0.5.0" @@ -795,7 +749,7 @@ checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -1038,16 +992,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.0.0" @@ -1337,8 +1281,8 @@ dependencies = [ "ormlite-macro", "serde", "sqlmo", - "sqlx 0.7.1", - "sqlx-core 0.7.1", + "sqlx", + "sqlx-core", "tokio", "tokio-stream", "trybuild", @@ -1397,7 +1341,7 @@ dependencies = [ "serde", "sqlmo", "sqlparser", - "sqlx 0.7.1", + "sqlx", "syn 2.0.26", "thiserror", "tokio", @@ -1415,7 +1359,7 @@ dependencies = [ "ormlite-core", "proc-macro2", "quote", - "sqlx 0.7.1", + "sqlx", "syn 2.0.26", ] @@ -1425,17 +1369,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -1443,21 +1376,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -1468,7 +1387,7 @@ checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", "windows-targets", ] @@ -1642,15 +1561,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -1660,17 +1570,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "thiserror", -] - [[package]] name = "regex" version = "1.9.1" @@ -1825,18 +1724,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "rustls" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - [[package]] name = "rustls" version = "0.21.5" @@ -1854,7 +1741,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.2", + "base64", ] [[package]] @@ -1884,9 +1771,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" @@ -2055,8 +1942,6 @@ dependencies = [ [[package]] name = "sqlmo" version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa64e26409e061ca3d6e0da7c0b295b735e2b3c86c75bc601d93b0d7d07f43b" dependencies = [ "anyhow", "tracing", @@ -2065,14 +1950,12 @@ dependencies = [ [[package]] name = "sqlmo_sqlx" version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e0ea0a8d69e5ce1231a6f1713b704fc6323593c579c26663b9e65d191b6ed" dependencies = [ "anyhow", "async-trait", - "itertools 0.10.5", + "itertools 0.11.0", "sqlmo", - "sqlx 0.6.3", + "sqlx", ] [[package]] @@ -2084,82 +1967,19 @@ dependencies = [ "log", ] -[[package]] -name = "sqlx" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8de3b03a925878ed54a954f621e64bf55a3c1bd29652d0d1a17830405350188" -dependencies = [ - "sqlx-core 0.6.3", - "sqlx-macros 0.6.3", -] - [[package]] name = "sqlx" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721" dependencies = [ - "sqlx-core 0.7.1", - "sqlx-macros 0.7.1", + "sqlx-core", + "sqlx-macros", "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", ] -[[package]] -name = "sqlx-core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" -dependencies = [ - "ahash 0.7.6", - "atoi 1.0.0", - "base64 0.13.1", - "bitflags 1.3.2", - "byteorder", - "bytes", - "crc", - "crossbeam-queue", - "dirs", - "dotenvy", - "either", - "event-listener", - "futures-channel", - "futures-core", - "futures-intrusive 0.4.2", - "futures-util", - "hashlink", - "hex", - "hkdf", - "hmac", - "indexmap 1.9.3", - "itoa", - "libc", - "log", - "md-5", - "memchr", - "once_cell", - "paste", - "percent-encoding", - "rand", - "rustls 0.20.8", - "rustls-pemfile", - "serde", - "serde_json", - "sha1", - "sha2", - "smallvec", - "sqlformat", - "sqlx-rt", - "stringprep", - "thiserror", - "tokio-stream", - "url", - "webpki-roots 0.22.6", - "whoami", -] - [[package]] name = "sqlx-core" version = "0.7.1" @@ -2167,7 +1987,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53" dependencies = [ "ahash 0.8.3", - "atoi 2.0.0", + "atoi", "byteorder", "bytes", "chrono", @@ -2178,19 +1998,19 @@ dependencies = [ "event-listener", "futures-channel", "futures-core", - "futures-intrusive 0.5.0", + "futures-intrusive", "futures-io", "futures-util", "hashlink", "hex", - "indexmap 2.0.0", + "indexmap", "log", "memchr", "once_cell", "paste", "percent-encoding", "rust_decimal", - "rustls 0.21.5", + "rustls", "rustls-pemfile", "serde", "serde_json", @@ -2204,26 +2024,7 @@ dependencies = [ "tracing", "url", "uuid", - "webpki-roots 0.24.0", -] - -[[package]] -name = "sqlx-macros" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9966e64ae989e7e575b19d7265cb79d7fc3cbbdf179835cb0d716f294c2049c9" -dependencies = [ - "dotenvy", - "either", - "heck", - "once_cell", - "proc-macro2", - "quote", - "sha2", - "sqlx-core 0.6.3", - "sqlx-rt", - "syn 1.0.109", - "url", + "webpki-roots", ] [[package]] @@ -2234,7 +2035,7 @@ checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2" dependencies = [ "proc-macro2", "quote", - "sqlx-core 0.7.1", + "sqlx-core", "sqlx-macros-core", "syn 1.0.109", ] @@ -2255,7 +2056,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "sqlx-core 0.7.1", + "sqlx-core", "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", @@ -2271,8 +2072,8 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ca69bf415b93b60b80dc8fda3cb4ef52b2336614d8da2de5456cc942a110482" dependencies = [ - "atoi 2.0.0", - "base64 0.21.2", + "atoi", + "base64", "bitflags 2.3.3", "byteorder", "bytes", @@ -2302,7 +2103,7 @@ dependencies = [ "sha1", "sha2", "smallvec", - "sqlx-core 0.7.1", + "sqlx-core", "stringprep", "thiserror", "time 0.3.23", @@ -2317,8 +2118,8 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0db2df1b8731c3651e204629dd55e52adbae0462fa1bdcbed56a2302c18181e" dependencies = [ - "atoi 2.0.0", - "base64 0.21.2", + "atoi", + "base64", "bitflags 2.3.3", "byteorder", "chrono", @@ -2346,7 +2147,7 @@ dependencies = [ "sha1", "sha2", "smallvec", - "sqlx-core 0.7.1", + "sqlx-core", "stringprep", "thiserror", "time 0.3.23", @@ -2355,36 +2156,25 @@ dependencies = [ "whoami", ] -[[package]] -name = "sqlx-rt" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024" -dependencies = [ - "once_cell", - "tokio", - "tokio-rustls", -] - [[package]] name = "sqlx-sqlite" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4c21bf34c7cae5b283efb3ac1bcc7670df7561124dc2f8bdc0b59be40f79a2" dependencies = [ - "atoi 2.0.0", + "atoi", "chrono", "flume", "futures-channel", "futures-core", "futures-executor", - "futures-intrusive 0.5.0", + "futures-intrusive", "futures-util", "libsqlite3-sys", "log", "percent-encoding", "serde", - "sqlx-core 0.7.1", + "sqlx-core", "time 0.3.23", "tracing", "url", @@ -2473,7 +2263,7 @@ dependencies = [ "autocfg", "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall", "rustix 0.37.23", "windows-sys", ] @@ -2582,7 +2372,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", @@ -2601,17 +2391,6 @@ dependencies = [ "syn 2.0.26", ] -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls 0.20.8", - "tokio", - "webpki", -] - [[package]] name = "tokio-stream" version = "0.1.14" @@ -2883,25 +2662,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] - [[package]] name = "webpki-roots" version = "0.24.0" @@ -2916,10 +2676,6 @@ name = "whoami" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" -dependencies = [ - "wasm-bindgen", - "web-sys", -] [[package]] name = "winapi" diff --git a/attr/Cargo.toml b/attr/Cargo.toml index 1079ffee..22e2d827 100644 --- a/attr/Cargo.toml +++ b/attr/Cargo.toml @@ -23,5 +23,5 @@ structmeta = "0.2" convert_case = "0.6" anyhow = "1.0" ignore = "0.4" -sqlmo = "0.14" +sqlmo = { path = "../../sqlmo" } tracing = "0.1" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index c084be32..e8268e45 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -27,8 +27,8 @@ ormlite = { version = "0.16", path = "../ormlite" } ormlite-core = { version = "0.16", path = "../core" } ormlite-attr = { version = "0.16", path = "../attr" } tokio = { version = "1", features = ["full"] } -sqlmo = { version = "0.14", features = ["tracing"] } -sqlmo_sqlx = "0.14" +sqlmo = { path = "../../sqlmo", features = ["tracing"] } +sqlmo_sqlx = { path = "../../sqlmo/sqlmo_sqlx" } syn = "2" proc-macro2 = "1" url = "2" diff --git a/core/Cargo.toml b/core/Cargo.toml index 3c6d68e3..bb8ec025 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -19,7 +19,7 @@ futures = "0.3" sqlx = "0.7" sqlparser = "0.35" thiserror = "1" -sqlmo = "0.14" +sqlmo = { path = "../../sqlmo" } ormlite-attr = { path = "../attr" , version = "0.16"} anyhow = "1" async-trait = "0.1" @@ -28,4 +28,4 @@ serde = { version = "1", features = ["derive"] } [dev-dependencies] syn = "2" assert_matches = "1" -uuid = { version = "1", features = ["serde", "v4"] } \ No newline at end of file +uuid = { version = "1", features = ["serde", "v4"] } diff --git a/ormlite/Cargo.toml b/ormlite/Cargo.toml index 4a64f09e..b4995784 100644 --- a/ormlite/Cargo.toml +++ b/ormlite/Cargo.toml @@ -52,7 +52,7 @@ tokio = { version = "1.24.1", features = ["full"] } ormlite-macro = { path = "../macro" , version = "0.16.0"} ormlite-core = { path = "../core" , version = "0.16.0"} sqlx-core = "0.7" -sqlmo = "0.14" +sqlmo = { path = "../../sqlmo" } tokio-stream = "0.1.14" [dev-dependencies] From 2fa7e1a45ddd99e9e754dfe42940f70f889ee83f Mon Sep 17 00:00:00 2001 From: Kurt Wolf Date: Thu, 20 Jul 2023 19:04:11 -0400 Subject: [PATCH 05/12] bump version 0.17. bump sqlx 0.7 --- Cargo.lock | 18 ++++++++++-------- attr/Cargo.toml | 4 ++-- attr/src/syndecode/properties.rs | 1 - cli/Cargo.toml | 12 ++++++------ core/Cargo.toml | 6 +++--- macro/Cargo.toml | 6 +++--- ormlite/Cargo.toml | 8 ++++---- 7 files changed, 28 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d10ba16..f77e2f4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1273,7 +1273,7 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "ormlite" -version = "0.16.0" +version = "0.17.0" dependencies = [ "chrono", "env_logger", @@ -1291,7 +1291,7 @@ dependencies = [ [[package]] name = "ormlite-attr" -version = "0.16.0" +version = "0.17.0" dependencies = [ "anyhow", "convert_case", @@ -1307,7 +1307,7 @@ dependencies = [ [[package]] name = "ormlite-cli" -version = "0.16.0" +version = "0.17.0" dependencies = [ "anyhow", "assert_matches", @@ -1331,7 +1331,7 @@ dependencies = [ [[package]] name = "ormlite-core" -version = "0.16.0" +version = "0.17.0" dependencies = [ "anyhow", "assert_matches", @@ -1350,7 +1350,7 @@ dependencies = [ [[package]] name = "ormlite-macro" -version = "0.16.0" +version = "0.17.0" dependencies = [ "itertools 0.11.0", "lazy_static", @@ -1941,7 +1941,7 @@ dependencies = [ [[package]] name = "sqlmo" -version = "0.14.0" +version = "0.15.0" dependencies = [ "anyhow", "tracing", @@ -1949,11 +1949,13 @@ dependencies = [ [[package]] name = "sqlmo_sqlx" -version = "0.14.0" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d30ecbaf581250d110768a8033c1ef3c88b5a0d8cd1caa5b955ba7b431a3509f" dependencies = [ "anyhow", "async-trait", - "itertools 0.11.0", + "itertools 0.10.5", "sqlmo", "sqlx", ] diff --git a/attr/Cargo.toml b/attr/Cargo.toml index 22e2d827..0db4fc26 100644 --- a/attr/Cargo.toml +++ b/attr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ormlite-attr" -version = "0.16.0" +version = "0.17.0" edition = "2021" description = "See `ormlite`." authors = ["Kurt Wolf "] @@ -23,5 +23,5 @@ structmeta = "0.2" convert_case = "0.6" anyhow = "1.0" ignore = "0.4" -sqlmo = { path = "../../sqlmo" } +sqlmo = "0.15" tracing = "0.1" diff --git a/attr/src/syndecode/properties.rs b/attr/src/syndecode/properties.rs index e15b485a..18217c6b 100644 --- a/attr/src/syndecode/properties.rs +++ b/attr/src/syndecode/properties.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use crate::SyndecodeError; use proc_macro2::TokenTree; -use quote::ToTokens; #[derive(Debug)] pub struct PropertiesAttribute { diff --git a/cli/Cargo.toml b/cli/Cargo.toml index e8268e45..a5af01ee 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ormlite-cli" -version = "0.16.0" +version = "0.17.0" edition = "2021" description = "An ORM for people who love SQL. Use the `ormlite` crate, not this one." authors = ["Kurt Wolf "] @@ -23,12 +23,12 @@ experimental-sid = [] anyhow = "1" time = { version = "0.3", features = ["formatting"] } clap = { version = "4", features = ["derive"] } -ormlite = { version = "0.16", path = "../ormlite" } -ormlite-core = { version = "0.16", path = "../core" } -ormlite-attr = { version = "0.16", path = "../attr" } +ormlite = { version = "0.17", path = "../ormlite" } +ormlite-core = { version = "0.17", path = "../core" } +ormlite-attr = { version = "0.17", path = "../attr" } tokio = { version = "1", features = ["full"] } -sqlmo = { path = "../../sqlmo", features = ["tracing"] } -sqlmo_sqlx = { path = "../../sqlmo/sqlmo_sqlx" } +sqlmo = { version = "0.15", features = ["tracing"] } +sqlmo_sqlx = "0.15" syn = "2" proc-macro2 = "1" url = "2" diff --git a/core/Cargo.toml b/core/Cargo.toml index bb8ec025..dc33d0ec 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ormlite-core" -version = "0.16.0" +version = "0.17.0" edition = "2021" description = "An ORM for people who love SQL. Use the `ormlite` crate, not this one." authors = ["Kurt Wolf "] @@ -19,8 +19,8 @@ futures = "0.3" sqlx = "0.7" sqlparser = "0.35" thiserror = "1" -sqlmo = { path = "../../sqlmo" } -ormlite-attr = { path = "../attr" , version = "0.16"} +sqlmo = "0.15" +ormlite-attr = { path = "../attr" , version = "0.17" } anyhow = "1" async-trait = "0.1" serde = { version = "1", features = ["derive"] } diff --git a/macro/Cargo.toml b/macro/Cargo.toml index f9e1f61c..d6ff53f7 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ormlite-macro" -version = "0.16.0" +version = "0.17.0" edition = "2021" description = "An ORM for people who love SQL. Use the `ormlite` crate, not this one." authors = ["Kurt Wolf "] @@ -24,8 +24,8 @@ default-mysql = ["mysql"] syn = { version = "2", features = ["derive", "parsing"] } quote = "1" proc-macro2 = "1" -ormlite-core = { path = "../core", version = "0.16.0" } -ormlite-attr = { path = "../attr", version = "0.16" } +ormlite-core = { path = "../core", version = "0.17.0" } +ormlite-attr = { path = "../attr", version = "0.17" } sqlx = "0.7" lazy_static = "1" once_cell = "1" diff --git a/ormlite/Cargo.toml b/ormlite/Cargo.toml index b4995784..3ffce93d 100644 --- a/ormlite/Cargo.toml +++ b/ormlite/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ormlite" -version = "0.16.0" +version = "0.17.0" edition = "2021" authors = ["Kurt Wolf "] description = "An ORM for people who love SQL" @@ -49,10 +49,10 @@ default-mysql = ["mysql", "ormlite-macro/default-mysql"] [dependencies] sqlx = { version = "0.7" } tokio = { version = "1.24.1", features = ["full"] } -ormlite-macro = { path = "../macro" , version = "0.16.0"} -ormlite-core = { path = "../core" , version = "0.16.0"} +ormlite-macro = { path = "../macro" , version = "0.17.0" } +ormlite-core = { path = "../core" , version = "0.17.0" } sqlx-core = "0.7" -sqlmo = { path = "../../sqlmo" } +sqlmo = "0.15" tokio-stream = "0.1.14" [dev-dependencies] From 15671d17130287d15479befd5ac48b954adc81d5 Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Mon, 24 Jul 2023 06:53:18 +0200 Subject: [PATCH 06/12] cli reflect command (WIP) --- Cargo.lock | 166 ++++++++---------- cli/Cargo.toml | 5 + cli/src/command.rs | 4 +- cli/src/command/reflect.rs | 345 +++++++++++++++++++++++++++++++++++++ cli/src/main.rs | 5 +- 5 files changed, 432 insertions(+), 93 deletions(-) create mode 100644 cli/src/command/reflect.rs diff --git a/Cargo.lock b/Cargo.lock index f77e2f4b..9768597f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -139,13 +139,13 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-trait" -version = "0.1.71" +version = "0.1.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -360,9 +360,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.15" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f644d0dac522c8b05ddc39aaaccc5b136d5dc4ff216610c5641e3be5becf56c" +checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" dependencies = [ "clap_builder", "clap_derive", @@ -371,9 +371,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.15" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af410122b9778e024f9e0fb35682cc09cc3f85cad5e8d3ba8f47a9702df6e73d" +checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" dependencies = [ "anstream", "anstyle", @@ -390,7 +390,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -593,9 +593,9 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" dependencies = [ "serde", ] @@ -659,12 +659,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "fastrand" -version = "1.9.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "flume" @@ -766,7 +763,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -1002,26 +999,6 @@ dependencies = [ "hashbrown 0.14.0", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys", -] - [[package]] name = "is-terminal" version = "0.4.9" @@ -1029,7 +1006,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.4", + "rustix", "windows-sys", ] @@ -1098,12 +1075,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.3" @@ -1238,9 +1209,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", "libm", @@ -1301,7 +1272,7 @@ dependencies = [ "quote", "sqlmo", "structmeta", - "syn 2.0.26", + "syn 2.0.27", "tracing", ] @@ -1313,15 +1284,20 @@ dependencies = [ "assert_matches", "clap", "colored", + "heck", + "itertools 0.11.0", "ormlite", "ormlite-attr", "ormlite-core", "proc-macro2", + "quote", "regex", + "rust-format", "sha2", "sqlmo", "sqlmo_sqlx", - "syn 2.0.26", + "sqlx", + "syn 2.0.27", "time 0.3.23", "tokio", "tracing", @@ -1342,7 +1318,7 @@ dependencies = [ "sqlmo", "sqlparser", "sqlx", - "syn 2.0.26", + "syn 2.0.27", "thiserror", "tokio", "uuid", @@ -1360,7 +1336,7 @@ dependencies = [ "proc-macro2", "quote", "sqlx", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -1430,7 +1406,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -1478,6 +1454,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "proc-macro-crate" version = "0.1.5" @@ -1518,9 +1504,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -1673,6 +1659,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rust-format" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60e7c00b6c3bf5e38a880eec01d7e829d12ca682079f8238a464def3c4b31627" +dependencies = [ + "prettyplease", + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "rust_decimal" version = "1.30.0" @@ -1697,20 +1694,6 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustix" -version = "0.37.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys", -] - [[package]] name = "rustix" version = "0.38.4" @@ -1720,7 +1703,7 @@ dependencies = [ "bitflags 2.3.3", "errno", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys", "windows-sys", ] @@ -1793,22 +1776,22 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "serde" -version = "1.0.171" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -1942,6 +1925,8 @@ dependencies = [ [[package]] name = "sqlmo" version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6681faef8b483f2c065cfb7a20bc4e4bebdfa3eba952f2a729e5be6852394dee" dependencies = [ "anyhow", "tracing", @@ -2208,7 +2193,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -2219,7 +2204,7 @@ checksum = "a60bcaff7397072dca0017d1db428e30d5002e00b6847703e2e42005c95fbe00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -2241,9 +2226,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.26" +version = "2.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" dependencies = [ "proc-macro2", "quote", @@ -2258,15 +2243,14 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" dependencies = [ - "autocfg", "cfg-if", "fastrand", "redox_syscall", - "rustix 0.37.23", + "rustix", "windows-sys", ] @@ -2281,22 +2265,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -2390,7 +2374,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -2434,7 +2418,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", ] [[package]] @@ -2474,9 +2458,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04366e99ff743345622cd00af2af01d711dc2d1ef59250d7347698d21b546729" +checksum = "a84e0202ea606ba5ebee8507ab2bfbe89b98551ed9b8f0be198109275cff284b" dependencies = [ "basic-toml", "dissimilar", @@ -2621,7 +2605,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", "wasm-bindgen-shared", ] @@ -2643,7 +2627,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.27", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index a5af01ee..b6668fc0 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -29,6 +29,7 @@ ormlite-attr = { version = "0.17", path = "../attr" } tokio = { version = "1", features = ["full"] } sqlmo = { version = "0.15", features = ["tracing"] } sqlmo_sqlx = "0.15" +sqlx = "0.7" syn = "2" proc-macro2 = "1" url = "2" @@ -37,6 +38,10 @@ regex = "1" colored = "2" tracing-subscriber = "0.3" tracing = "0.1" +itertools = "0.11" +heck = "0.4" +quote = "1" +rust-format = { version = "0.3", features = [ "token_stream", "pretty_please" ] } [dev-dependencies] assert_matches = "1" diff --git a/cli/src/command.rs b/cli/src/command.rs index 072bfc7f..b23797e8 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -2,8 +2,10 @@ mod migrate; mod up; mod down; mod init; +mod reflect; pub use migrate::*; pub use up::*; pub use down::*; -pub use init::*; \ No newline at end of file +pub use init::*; +pub use reflect::*; diff --git a/cli/src/command/reflect.rs b/cli/src/command/reflect.rs new file mode 100644 index 00000000..f3ecd1f3 --- /dev/null +++ b/cli/src/command/reflect.rs @@ -0,0 +1,345 @@ +use crate::util::{create_connection, create_runtime}; +use anyhow::Result; +use clap::Parser; +use colored::Colorize; +use heck::{ToPascalCase, ToSnakeCase}; +use itertools::Itertools; +use ormlite::Acquire; +use ormlite_core::config::get_var_database_url; +use proc_macro2::TokenStream; +use quote::{format_ident, quote}; +use rust_format::{Formatter, PrettyPlease}; +use sqlx::FromRow; +use std::fs; + +#[derive(Debug, FromRow)] +struct ColumnDef { + table_schema: String, + table_name: String, + column_name: String, + is_rev_fk: bool, + is_nullable: bool, + type_name: String, + is_array: bool, + domain_schema: Option, + domain_name: Option, + is_primary_key: bool, + fk_table_schema: Option, + fk_table_name: Option, + fk_column_name: Option, + is_updatable: bool, +} + +impl ColumnDef { + pub fn rust_type(&self) -> TokenStream { + let base_type = match self.type_name.as_str() { + "bool" /* B: 16, 1000 */ + => quote! { bool }, + "date" /* D: 1082, 1182 */ + => quote! { Date }, + "time" /* D: 1083, 1183 */ + | "timetz" /* D: 1266, 1270 */ + => quote! { Time }, + "timestamp" /* D: 1114, 1115 */ + => quote! { DateTime }, + "timestamptz" /* D: 1184, 1185 */ + => quote! { DateTimeTz }, + + //"box" /* G: 603, 1020 */ + //"circle" /* G: 718, 719 */ + //"line" /* G: 628, 629 */ + //"lseg" /* G: 601, 1018 */ + //"path" /* G: 602, 1019 */ + //"point" /* G: 600, 1017 */ + //"polygon" /* G: 604, 1027 */ + + //"cidr" /* I: 650, 651 */ + //"inet" /* I: 869, 1041 */ + //"macaddr" /* U: 829, 1040 */ + //"macaddr8" /* U: 774, 775 */ + + "float4" /* N: 700, 1021 */ + => quote! { f32 }, + "float8" /* N: 701, 1022 */ + => quote! { f64 }, + "int2" /* N: 21, 1005 */ + => quote! { i16 }, + "int4" /* N: 23, 1007 */ + | "xid" /* U: 28, 1011 */ + => quote! { i32 }, + "int8" /* N: 20, 1016 */ + | "xid8" /* U: 5069, 271 */ + => quote! { i64 }, + "money" /* N: 790, 791 */ + | "numeric" /* N: 1700, 1231 */ + => quote! { Decimal }, + "oid" /* N: 26, 1028 */ + => quote! { u32 }, + + //"regclass" /* N: 2205, 2210 */ + //"regcollation" /* N: 4191, 4192 */ + //"regconfig" /* N: 3734, 3735 */ + //"regdictionary" /* N: 3769, 3770 */ + //"regnamespace" /* N: 4089, 4090 */ + //"regoper" /* N: 2203, 2208 */ + //"regoperator" /* N: 2204, 2209 */ + //"regproc" /* N: 24, 1008 */ + //"regprocedure" /* N: 2202, 2207 */ + //"regrole" /* N: 4096, 4097 */ + //"regtype" /* N: 2206, 2211 */ + + //"datemultirange" /* R: 4535, 6155 */ + //"daterange" /* R: 3912, 3913 */ + //"int4multirange" /* R: 4451, 6150 */ + //"int4range" /* R: 3904, 3905 */ + //"int8multirange" /* R: 4536, 6157 */ + //"int8range" /* R: 3926, 3927 */ + //"nummultirange" /* R: 4532, 6151 */ + //"numrange" /* R: 3906, 3907 */ + //"tsmultirange" /* R: 4533, 6152 */ + //"tsrange" /* R: 3908, 3909 */ + //"tstzmultirange" /* R: 4534, 6153 */ + //"tstzrange" /* R: 3910, 3911 */ + + "bpchar" /* S: 1042, 1014 */ + | "name" /* S: 19, 1003 */ + | "text" /* S: 25, 1009 */ + | "varchar" /* S: 1043, 1015 */ + => quote! { String }, + //"interval" /* T: 1186, 1187 */ + //"aclitem" /* U: 1033, 1034 */ + "bytea" /* U: 17, 1001 */ + => quote! { Vec }, + //"cid" /* U: 29, 1012 */ + "json" /* U: 114, 199 */ + | "jsonb" /* U: 3802, 3807 */ + => quote! { Json }, + //"jsonpath" /* U: 4072, 4073 */ + + //"pg_lsn" /* U: 3220, 3221 */ + //"pg_snapshot" /* U: 5038, 5039 */ + //"refcursor" /* U: 1790, 2201 */ + //"tid" /* U: 27, 1010 */ + + //"gtsvector" /* U: 3642, 3644 */ + //"tsquery" /* U: 3615, 3645 */ + //"tsvector" /* U: 3614, 3643 */ + //"txid_snapshot" /* U: 2970, 2949 */ + "uuid" /* U: 2950, 2951 */ + => quote! { Uuid }, + + //"xml" /* U: 142, 143 */ + + //"bit" /* V: 1560, 1561 */ + //"varbit" /* V: 1562, 1563 */ + unknown + => quote! { Unknown<#unknown> }, + }; + let mut full_type = base_type; + if self.is_array { + full_type = quote! { Vec<#full_type> }; + } + if self.is_nullable { + full_type = quote! { Option<#full_type> }; + } + full_type + } +} + +const SCHEMA_QUERY: &str = r#"--sql + SELECT + nc.nspname AS table_schema, + c.relname AS table_name, + a.attname AS column_name, + false AS is_rev_fk, + a.attnum AS ordinal_position, + + NOT(CASE WHEN t.typtype = 'd' THEN t.typnotnull ELSE a.attnotnull END) AS is_nullable, + + REGEXP_REPLACE(CASE WHEN t.typtype = 'd' THEN bt.typname ELSE t.typname END, '^_', '') type_name, + + CASE + WHEN t.typtype = 'd' THEN + bt.typelem <> 0 AND bt.typlen = '-1'::integer + ELSE + t.typelem <> 0 AND t.typlen = '-1'::integer + END AS is_array, + + CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE NULL END AS domain_schema, + CASE WHEN t.typtype = 'd' THEN t.typname ELSE NULL END AS domain_name, + COALESCE(i.indisprimary, false) AS is_primary_key, + + fnc.nspname AS fk_table_schema, + fc.relname AS fk_table_name, + fa.attname AS fk_column_name, + + (c.relkind IN ('r', 'p')) OR (c.relkind IN ('v', 'f')) AND pg_column_is_updatable(c.oid, a.attnum, false) AS is_updatable + FROM pg_attribute a + JOIN (pg_class c JOIN pg_namespace nc ON c.relnamespace = nc.oid) ON a.attrelid = c.oid + JOIN (pg_type t JOIN pg_namespace nt ON t.typnamespace = nt.oid) ON a.atttypid = t.oid + LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON bt.typnamespace = nbt.oid) ON t.typbasetype = bt.oid AND t.typtype = 'd' + LEFT JOIN pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum + LEFT JOIN pg_index i ON a.attrelid = i.indrelid AND i.indisprimary AND a.attnum = ANY(i.indkey) + + LEFT JOIN pg_constraint n ON n.contype = 'f' AND n.conrelid = a.attrelid AND a.attnum = ANY(n.conkey) + LEFT JOIN pg_attribute fa ON n.confrelid = fa.attrelid AND fa.attnum = n.confkey[ARRAY_POSITION(n.conkey, a.attnum)] AND NOT fa.attisdropped + LEFT JOIN (pg_class fc JOIN pg_namespace fnc ON fc.relnamespace = fnc.oid) ON fa.attrelid = fc.oid + WHERE + NOT pg_is_other_temp_schema(nc.oid) + AND a.attnum > 0 + AND NOT a.attisdropped + AND (c.relkind IN ('r', 'v', 'f', 'p')) + AND (pg_has_role(c.relowner, 'USAGE') OR has_column_privilege(c.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES')) + AND nc.nspname = $1 + UNION + SELECT + nc.nspname AS table_schema, + c.relname AS table_name, + a.attname AS column_name, + true AS is_rev_fk, + a.attnum AS ordinal_position, + + true AS is_nullable, + + '' AS type_name, + + true AS is_array, + + NULL AS domain_schema, + NULL AS domain_name, + false AS is_primary_key, + + rfnc.nspname AS fk_table_schema, + rfc.relname AS fk_table_name, + rfa.attname AS fk_column_name, + + false AS is_updatable + FROM pg_attribute a + JOIN (pg_class c JOIN pg_namespace nc ON c.relnamespace = nc.oid) ON a.attrelid = c.oid + INNER JOIN pg_constraint rn ON rn.contype = 'f' AND rn.confrelid = a.attrelid AND a.attnum = ANY(rn.confkey) + INNER JOIN pg_attribute rfa ON rn.conrelid = rfa.attrelid AND rfa.attnum = rn.conkey[ARRAY_POSITION(rn.confkey, a.attnum)] AND NOT rfa.attisdropped + INNER JOIN (pg_class rfc JOIN pg_namespace rfnc ON rfc.relnamespace = rfnc.oid) ON rfa.attrelid = rfc.oid + WHERE + NOT pg_is_other_temp_schema(nc.oid) + AND a.attnum > 0 + AND NOT a.attisdropped + AND (pg_has_role(c.relowner, 'USAGE') OR has_column_privilege(c.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES')) + AND nc.nspname = $1 + ORDER BY + table_schema, table_name, is_rev_fk, ordinal_position; + "#; + +#[derive(Parser, Debug)] +pub struct Reflect { + /// Database schema name + #[clap(long, default_value = "public")] + schema: String, + /// Destination filename [default stdout] + #[clap(long, short)] + output: Option, +} + +impl Reflect { + pub fn run(self) -> Result<()> { + let runtime = create_runtime(); + let url = get_var_database_url(); + let mut conn = create_connection(&url, &runtime)?; + let conn = runtime.block_on(conn.acquire())?; + + let schema = + runtime.block_on(ormlite::query_as::<_, ColumnDef>(SCHEMA_QUERY).bind(self.schema).fetch_all(conn))?; + + let q_models = schema + .into_iter() + .group_by(|item| (item.table_schema.to_owned(), item.table_name.to_owned())) + .into_iter() + .map(|(key, items)| { + let table_name_sql = &key.1; + let table_name_rs = format_ident!("{}", table_name_sql.to_pascal_case()); + let q_table_alias = (table_name_rs != *table_name_sql).then_some(quote! { + #[ormlite(table=#table_name_sql)] + }); + let q_columns = items.into_iter().map(|col| { + let q_is_primary_key = col.is_primary_key.then_some(quote! { + #[ormlite(primary_key)] + }); + if let (Some(_fk_column_name), Some(fk_table_name)) = (&col.fk_column_name, &col.fk_table_name) { + let column_name_sql = &col.column_name.clone(); + let type_name_rs = format_ident!("{}", fk_table_name.to_pascal_case()); + if col.is_rev_fk { + let coulmn_name_rs = format_ident!("{}", fk_table_name.to_snake_case()); + quote! { + #[ormlite(skip)] + pub #coulmn_name_rs: KVec<#type_name_rs>, + } + } else { + let column_name_rs = format_ident!( + "{}", + col.column_name.strip_prefix("id_").unwrap_or(&col.column_name).to_snake_case() + ); + quote! { + #[ormlite(join_column = #column_name_sql)] + pub #column_name_rs: Join<#type_name_rs>, + } + } + } else { + let column_name_rs = format_ident!("{}", col.column_name.to_snake_case()); + let column_type_rs = col.rust_type(); + quote! { + #q_is_primary_key + pub #column_name_rs: #column_type_rs, + } + } + }); + quote! { + #[derive(Model, Debug, Serialize)] + #q_table_alias + struct #table_name_rs { + #(#q_columns)* + } + } + }) + .concat(); + + let q_output = quote! { + use ormlite::{Model, model::Join}; + use serde::Serialize; + pub use ormlite::types::{ + chrono::{ + NaiveDate as Date, + NaiveDateTime as DateTime, + NaiveTime as Time, + DateTime as ChronoDateTime, + FixedOffset, + Local, + Utc + }, + // BigDecimal, + Decimal, + Json, + Uuid + }; + pub type DateTimeTz = ChronoDateTime; + pub type DateTimeUtc = ChronoDateTime; + pub type DateTimeLocal = ChronoDateTime; + + /* + pub use time::Date as Date; + pub use time::Time as Time; + pub use time::PrimitiveDateTime as DateTime; + pub use time::OffsetDateTime as DateTimeTz; + */ + + #q_models + }; + + let output = PrettyPlease::default().format_tokens(q_output).unwrap(); + if let Some(filename) = self.output { + fs::write(filename, output)?; + } else { + println!("{output}"); + } + eprintln!("{} Reflected database at {}", "SUCCESS".green(), url); + Ok(()) + } +} diff --git a/cli/src/main.rs b/cli/src/main.rs index da04fff2..9344a635 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -30,6 +30,8 @@ pub enum Command { Down(Down), /// Initiailize the database for use with `ormlite`. Creates the migrations table. Init(Init), + /// Generate entities by reflecting database structure + Reflect(Reflect), } fn main() -> Result<()> { @@ -52,5 +54,6 @@ fn main() -> Result<()> { Up(up) => up.run(), Down(down) => down.run(), Init(init) => init.run(), + Reflect(r) => r.run(), } -} \ No newline at end of file +} From b8181ec5124ab2cf0dfd78a88833e20ed73ae098 Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Mon, 24 Jul 2023 07:11:28 +0200 Subject: [PATCH 07/12] reflect TODO --- cli/src/command/reflect.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cli/src/command/reflect.rs b/cli/src/command/reflect.rs index f3ecd1f3..e6c707a0 100644 --- a/cli/src/command/reflect.rs +++ b/cli/src/command/reflect.rs @@ -12,6 +12,17 @@ use rust_format::{Formatter, PrettyPlease}; use sqlx::FromRow; use std::fs; +/* TODO + * - Dynamically import required types + * - Reserved words `r#` quoting + * - Repeated field name detection + * - Integrate `KVec` one-to-many implementation + * - Properly support views + * - Provide a mechanism to skip unwanted fields and other settings (via doc-comments or custom directive) + * - `--split` option for generating one model per file + * - `--domains` option for domains as `type` aliases + */ + #[derive(Debug, FromRow)] struct ColumnDef { table_schema: String, From 9ce4f54e70ac9f5ae93a0c3931bf81070b0e232f Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Mon, 24 Jul 2023 18:49:04 +0200 Subject: [PATCH 08/12] KVec and fetch_linked! --- Cargo.lock | 5 ++-- core/Cargo.toml | 3 ++- core/src/join.rs | 23 +++++++++++++++++ core/src/kvec.rs | 62 ++++++++++++++++++++++++++++++++++++++++++++++ core/src/lib.rs | 3 ++- ormlite/src/lib.rs | 2 ++ 6 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 core/src/kvec.rs diff --git a/Cargo.lock b/Cargo.lock index 9768597f..c163c8a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1313,6 +1313,7 @@ dependencies = [ "assert_matches", "async-trait", "futures", + "indexmap", "ormlite-attr", "serde", "sqlmo", @@ -1947,9 +1948,9 @@ dependencies = [ [[package]] name = "sqlparser" -version = "0.35.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca597d77c98894be1f965f2e4e2d2a61575d4998088e655476c73715c54b2b43" +checksum = "2eaa1e88e78d2c2460d78b7dc3f0c08dbb606ab4222f9aff36f420d36e307d87" dependencies = [ "log", ] diff --git a/core/Cargo.toml b/core/Cargo.toml index dc33d0ec..75273c96 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -17,13 +17,14 @@ runtime-tokio-rustls = ["sqlx/runtime-tokio-rustls"] tokio = { version = "1", features = ["full"] } futures = "0.3" sqlx = "0.7" -sqlparser = "0.35" +sqlparser = "0.36" thiserror = "1" sqlmo = "0.15" ormlite-attr = { path = "../attr" , version = "0.17" } anyhow = "1" async-trait = "0.1" serde = { version = "1", features = ["derive"] } +indexmap = "2" [dev-dependencies] syn = "2" diff --git a/core/src/join.rs b/core/src/join.rs index 7f3100e0..0f93e1b4 100644 --- a/core/src/join.rs +++ b/core/src/join.rs @@ -220,4 +220,27 @@ impl Serialize for Join { JoinData::QueryResult(data) => data.serialize(serializer), } } +} + +#[macro_export] +macro_rules! fetch_linked { + ($conn:ident, $container:expr, $query:expr, $field:ident) => { + fetch_linked!($conn, $container, $query, $field, id) + }; + ($conn:ident, $container:expr, $query:expr, $field:ident, $key:ident) => { + fetch_linked!($conn, $container, $query, $field, $key, $key) + }; + ($conn:ident, $container:expr, $query:expr, $field:ident, $key:ident, $key_ref:ident) => { + $query + .where_bind(concat!(stringify!($key), " = ANY(?)"), $container.keys().copied().collect::>()) + .fetch_all(&mut $conn) + .await + .unwrap() + .into_iter() + .for_each(|row| { + $container.entry(row.$key_ref).and_modify(|item| { + item.$field.insert(row.$key, row); + }); + }); + }; } \ No newline at end of file diff --git a/core/src/kvec.rs b/core/src/kvec.rs new file mode 100644 index 00000000..58e0a3fc --- /dev/null +++ b/core/src/kvec.rs @@ -0,0 +1,62 @@ +use crate::join::JoinMeta; +use indexmap::{ + map::{Entry, Keys, Values, ValuesMut}, + IndexMap, +}; +use serde::{Serialize, Serializer}; +use std::fmt::Debug; +use std::fmt::Formatter; + +pub struct KVec(IndexMap); + +impl KVec { + pub fn insert(&mut self, key: T::IdType, value: T) -> Option { + self.0.insert(key, value) + } + pub fn keys(&self) -> Keys { + self.0.keys() + } + + pub fn values(&self) -> Values { + self.0.values() + } + + pub fn values_mut(&mut self) -> ValuesMut { + self.0.values_mut() + } + + pub fn entry(&mut self, key: T::IdType) -> Entry { + self.0.entry(key) + } + + pub fn iter_mut_cloned(&mut self) -> impl Iterator { + self.0.iter_mut().map(|v| (v.0.clone(), v.1)) + } +} + +impl From> for KVec { + fn from(value: Vec) -> Self { + Self(value.into_iter().map(|row| (row._id(), row)).collect::>()) + } +} + +impl Default for KVec { + fn default() -> Self { + Self(IndexMap::default()) + } +} + +impl Serialize for KVec { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.0.values().collect::>().serialize(serializer) + } +} + +impl Debug for KVec { + fn fmt(&self, f: &mut Formatter) -> core::fmt::Result { + f.debug_list().entries(self.0.values()).finish() + } +} diff --git a/core/src/lib.rs b/core/src/lib.rs index ab9bba9f..d48ec0c9 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -2,12 +2,13 @@ pub use self::error::{Error, Result}; pub use self::query_builder::SelectQueryBuilder; pub use futures::future::BoxFuture; pub use join::Join; +pub use kvec::KVec; mod error; pub mod config; pub mod model; pub mod query_builder; pub mod join; +pub mod kvec; pub mod insert; pub mod schema; - diff --git a/ormlite/src/lib.rs b/ormlite/src/lib.rs index 7bf92b10..243739cf 100644 --- a/ormlite/src/lib.rs +++ b/ormlite/src/lib.rs @@ -1,6 +1,8 @@ #![cfg_attr(docsrs, feature(doc_cfg))] pub use ormlite_core::BoxFuture; pub use ormlite_core::{Error, Result}; +pub use ormlite_core::fetch_linked; +pub use ormlite_core::KVec; pub use model::{Model, FromRow, TableMeta, IntoArguments}; pub use ::sqlx::{Row, ColumnIndex, Decode, Column, Database}; From c40f283babc6a2e8d7892cbd565a3ec66b4db308 Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Sat, 5 Aug 2023 10:26:16 +0200 Subject: [PATCH 09/12] cli: add missing sqlx dependency --- cli/Cargo.toml | 1 + cli/src/command/reflect.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 62bee28a..8d6366ba 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -29,6 +29,7 @@ ormlite-attr = { version = "0.17", path = "../attr" } tokio = { version = "1", features = ["full"] } sqlmo = { version = "0.16", features = ["tracing"] } sqlmo_sqlx = "0.16" +sqlx = "0.7" syn = "2" proc-macro2 = "1" url = "2" diff --git a/cli/src/command/reflect.rs b/cli/src/command/reflect.rs index e6c707a0..a975b2f1 100644 --- a/cli/src/command/reflect.rs +++ b/cli/src/command/reflect.rs @@ -23,6 +23,7 @@ use std::fs; * - `--domains` option for domains as `type` aliases */ +#[allow(dead_code)] #[derive(Debug, FromRow)] struct ColumnDef { table_schema: String, From 22d0825c5630b72e89f076fe6560df49ffc15b76 Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Sun, 5 Nov 2023 15:16:45 +0100 Subject: [PATCH 10/12] Move reflect code in sql files --- Cargo.lock | 710 ++++++++++---------- cli/src/command/reflect.rs | 83 +-- cli/src/command/reflect/schema.mysql.sql | 64 ++ cli/src/command/reflect/schema.postgres.sql | 82 +++ cli/src/command/reflect/schema.sqlite.sql | 2 + 5 files changed, 495 insertions(+), 446 deletions(-) create mode 100644 cli/src/command/reflect/schema.mysql.sql create mode 100644 cli/src/command/reflect/schema.postgres.sql create mode 100644 cli/src/command/reflect/schema.sqlite.sql diff --git a/Cargo.lock b/Cargo.lock index 37d0201e..80f82bd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ "getrandom", "once_cell", @@ -30,21 +30,22 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "getrandom", "once_cell", "version_check", + "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -72,30 +73,29 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys", @@ -121,9 +121,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arrayvec" @@ -139,13 +139,13 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-trait" -version = "0.1.72" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] @@ -165,9 +165,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -180,9 +180,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.2" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -192,9 +192,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basic-toml" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" +checksum = "2f2139706359229bfa8f19142ac1155b4b80beafb7a60471ac5dd109d4a19778" dependencies = [ "serde", ] @@ -207,9 +207,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" dependencies = [ "serde", ] @@ -282,9 +282,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" dependencies = [ "memchr", "serde", @@ -292,9 +292,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytecheck" @@ -320,21 +320,24 @@ dependencies = [ [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -344,36 +347,34 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", - "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets", ] [[package]] name = "clap" -version = "4.3.19" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.19" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstream", "anstyle", @@ -383,21 +384,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "colorchoice" @@ -418,9 +419,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "convert_case" @@ -439,9 +440,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -457,9 +458,9 @@ dependencies = [ [[package]] name = "crc-catalog" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crossbeam-queue" @@ -527,15 +528,24 @@ dependencies = [ [[package]] name = "der" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", "pem-rfc7468", "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + [[package]] name = "derive_builder" version = "0.12.0" @@ -621,25 +631,14 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "etcetera" version = "0.8.0" @@ -659,19 +658,24 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "finl_unicode" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" [[package]] name = "flume" -version = "0.10.14" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ "futures-core", "futures-sink", - "pin-project", "spin 0.9.8", ] @@ -698,9 +702,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -713,9 +717,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -723,15 +727,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -751,38 +755,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -814,14 +818,14 @@ checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "glob" @@ -831,9 +835,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aca8bbd8e0707c1887a8bbb7e6b40e228f251ff5d62c8220a4a7a53c73aff006" +checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" dependencies = [ "aho-corasick", "bstr", @@ -848,7 +852,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", ] [[package]] @@ -857,26 +861,26 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.6", ] [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.6", "allocator-api2", ] [[package]] name = "hashlink" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.0", + "hashbrown 0.14.2", ] [[package]] @@ -890,9 +894,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -935,16 +939,16 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -991,12 +995,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.2", ] [[package]] @@ -1036,9 +1040,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -1054,15 +1058,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.147" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libm" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libsqlite3-sys" @@ -1077,15 +1081,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -1093,24 +1097,25 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "md-5" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ + "cfg-if", "digest", ] [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "minimal-lexical" @@ -1129,12 +1134,12 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys", ] @@ -1160,9 +1165,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -1209,9 +1214,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", "libm", @@ -1229,9 +1234,9 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -1272,7 +1277,7 @@ dependencies = [ "quote", "sqlmo", "structmeta", - "syn 2.0.27", + "syn 2.0.38", "tracing", ] @@ -1296,8 +1301,9 @@ dependencies = [ "sha2", "sqlmo", "sqlmo_sqlx", - "syn 2.0.27", - "time 0.3.23", + "sqlx", + "syn 2.0.38", + "time", "tokio", "tracing", "tracing-subscriber", @@ -1318,7 +1324,7 @@ dependencies = [ "sqlmo", "sqlparser", "sqlx", - "syn 2.0.27", + "syn 2.0.38", "thiserror", "tokio", "uuid", @@ -1336,7 +1342,7 @@ dependencies = [ "proc-macro2", "quote", "sqlx", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] @@ -1357,9 +1363,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", @@ -1389,31 +1395,11 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" -[[package]] -name = "pin-project" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.27", -] - [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -1448,6 +1434,12 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1475,9 +1467,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -1504,9 +1496,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -1549,18 +1541,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "regex" -version = "1.9.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", @@ -1570,9 +1562,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -1581,32 +1573,31 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rend" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" dependencies = [ "bytecheck", ] [[package]] name = "ring" -version = "0.16.20" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", - "spin 0.5.2", + "spin 0.9.8", "untrusted", - "web-sys", - "winapi", + "windows-sys", ] [[package]] @@ -1639,16 +1630,14 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" +checksum = "86ef35bf3e7fe15a53c4ab08a998e42271eab13eb0db224126bc7bc4c4bad96d" dependencies = [ - "byteorder", "const-oid", "digest", "num-bigint-dig", "num-integer", - "num-iter", "num-traits", "pkcs1", "pkcs8", @@ -1672,13 +1661,12 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.31.0" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a2ab0025103a60ecaaf3abf24db1db240a4e1c15837090d2c32f625ac98abea" +checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd" dependencies = [ "arrayvec", "borsh", - "byteorder", "bytes", "num-traits", "rand", @@ -1695,11 +1683,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.4" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -1708,9 +1696,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.5" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "ring", "rustls-webpki", @@ -1728,9 +1716,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.2" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "513722fd73ad80a71f72b61009ea1b584bcfa1483ca93949c8f290298837fa59" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring", "untrusted", @@ -1759,9 +1747,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -1775,29 +1763,29 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "serde" -version = "1.0.178" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60363bdd39a7be0266a520dab25fdc9241d2f987b08a01e01f0ec6d06a981348" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.178" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28482318d6641454cb273da158647922d1be6b5a2fcc6165cd89ebdd7ed576b" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -1806,9 +1794,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -1817,9 +1805,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -1828,9 +1816,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -1862,27 +1850,27 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" -version = "0.4.9" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "winapi", + "windows-sys", ] [[package]] @@ -1912,11 +1900,11 @@ dependencies = [ [[package]] name = "sqlformat" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" dependencies = [ - "itertools 0.10.5", + "itertools 0.11.0", "nom", "unicode_categories", ] @@ -1955,9 +1943,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721" +checksum = "0e50c216e3624ec8e7ecd14c6a6a6370aad6ee5d8cfc3ab30b5162eeeef2ed33" dependencies = [ "sqlx-core", "sqlx-macros", @@ -1968,11 +1956,11 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53" +checksum = "8d6753e460c998bbd4cd8c6f0ed9a64346fcca0723d6e75e52fdc351c5d2169d" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.6", "atoi", "byteorder", "bytes", @@ -2004,7 +1992,7 @@ dependencies = [ "smallvec", "sqlformat", "thiserror", - "time 0.3.23", + "time", "tokio", "tokio-stream", "tracing", @@ -2015,9 +2003,9 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2" +checksum = "9a793bb3ba331ec8359c1853bd39eed32cdd7baaf22c35ccf5c92a7e8d1189ec" dependencies = [ "proc-macro2", "quote", @@ -2028,9 +2016,9 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc" +checksum = "0a4ee1e104e00dedb6aa5ffdd1343107b0a4702e862a84320ee7cc74782d96fc" dependencies = [ "dotenvy", "either", @@ -2054,13 +2042,13 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca69bf415b93b60b80dc8fda3cb4ef52b2336614d8da2de5456cc942a110482" +checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db" dependencies = [ "atoi", "base64", - "bitflags 2.3.3", + "bitflags 2.4.1", "byteorder", "bytes", "chrono", @@ -2092,7 +2080,7 @@ dependencies = [ "sqlx-core", "stringprep", "thiserror", - "time 0.3.23", + "time", "tracing", "uuid", "whoami", @@ -2100,13 +2088,13 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0db2df1b8731c3651e204629dd55e52adbae0462fa1bdcbed56a2302c18181e" +checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624" dependencies = [ "atoi", "base64", - "bitflags 2.3.3", + "bitflags 2.4.1", "byteorder", "chrono", "crc", @@ -2136,7 +2124,7 @@ dependencies = [ "sqlx-core", "stringprep", "thiserror", - "time 0.3.23", + "time", "tracing", "uuid", "whoami", @@ -2144,9 +2132,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4c21bf34c7cae5b283efb3ac1bcc7670df7561124dc2f8bdc0b59be40f79a2" +checksum = "d59dc83cf45d89c555a577694534fcd1b55c545a816c816ce51f20bbe56a4f3f" dependencies = [ "atoi", "chrono", @@ -2161,7 +2149,7 @@ dependencies = [ "percent-encoding", "serde", "sqlx-core", - "time 0.3.23", + "time", "tracing", "url", "uuid", @@ -2169,10 +2157,11 @@ dependencies = [ [[package]] name = "stringprep" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3737bde7edce97102e0e2b15365bf7a20bfdb5f60f4f9e8d7004258a51a8da" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" dependencies = [ + "finl_unicode", "unicode-bidi", "unicode-normalization", ] @@ -2192,7 +2181,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] @@ -2203,7 +2192,7 @@ checksum = "a60bcaff7397072dca0017d1db428e30d5002e00b6847703e2e42005c95fbe00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] @@ -2225,9 +2214,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.27" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -2242,9 +2231,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.7.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", @@ -2255,31 +2244,31 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] @@ -2294,22 +2283,13 @@ dependencies = [ [[package]] name = "time" -version = "0.1.45" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ + "deranged", "itoa", + "powerfmt", "serde", "time-core", "time-macros", @@ -2317,15 +2297,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -2347,11 +2327,10 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ - "autocfg", "backtrace", "bytes", "libc", @@ -2373,7 +2352,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] @@ -2398,11 +2377,10 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -2411,20 +2389,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -2432,12 +2410,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -2457,9 +2435,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.82" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84e0202ea606ba5ebee8507ab2bfbe89b98551ed9b8f0be198109275cff284b" +checksum = "196a58260a906cedb9bf6d8034b6379d0c11f552416960452f267402ceeddff1" dependencies = [ "basic-toml", "dissimilar", @@ -2473,9 +2451,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" @@ -2485,9 +2463,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -2512,15 +2490,15 @@ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -2535,9 +2513,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" dependencies = [ "getrandom", "serde", @@ -2563,20 +2541,14 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2585,9 +2557,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2595,24 +2567,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2620,32 +2592,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "web-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "webpki-roots" @@ -2680,9 +2642,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -2694,10 +2656,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ "windows-targets", ] @@ -2713,9 +2675,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -2728,45 +2690,45 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "wyz" @@ -2777,6 +2739,26 @@ dependencies = [ "tap", ] +[[package]] +name = "zerocopy" +version = "0.7.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "zeroize" version = "1.6.0" diff --git a/cli/src/command/reflect.rs b/cli/src/command/reflect.rs index a975b2f1..2394182d 100644 --- a/cli/src/command/reflect.rs +++ b/cli/src/command/reflect.rs @@ -158,88 +158,7 @@ impl ColumnDef { } } -const SCHEMA_QUERY: &str = r#"--sql - SELECT - nc.nspname AS table_schema, - c.relname AS table_name, - a.attname AS column_name, - false AS is_rev_fk, - a.attnum AS ordinal_position, - - NOT(CASE WHEN t.typtype = 'd' THEN t.typnotnull ELSE a.attnotnull END) AS is_nullable, - - REGEXP_REPLACE(CASE WHEN t.typtype = 'd' THEN bt.typname ELSE t.typname END, '^_', '') type_name, - - CASE - WHEN t.typtype = 'd' THEN - bt.typelem <> 0 AND bt.typlen = '-1'::integer - ELSE - t.typelem <> 0 AND t.typlen = '-1'::integer - END AS is_array, - - CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE NULL END AS domain_schema, - CASE WHEN t.typtype = 'd' THEN t.typname ELSE NULL END AS domain_name, - COALESCE(i.indisprimary, false) AS is_primary_key, - - fnc.nspname AS fk_table_schema, - fc.relname AS fk_table_name, - fa.attname AS fk_column_name, - - (c.relkind IN ('r', 'p')) OR (c.relkind IN ('v', 'f')) AND pg_column_is_updatable(c.oid, a.attnum, false) AS is_updatable - FROM pg_attribute a - JOIN (pg_class c JOIN pg_namespace nc ON c.relnamespace = nc.oid) ON a.attrelid = c.oid - JOIN (pg_type t JOIN pg_namespace nt ON t.typnamespace = nt.oid) ON a.atttypid = t.oid - LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON bt.typnamespace = nbt.oid) ON t.typbasetype = bt.oid AND t.typtype = 'd' - LEFT JOIN pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum - LEFT JOIN pg_index i ON a.attrelid = i.indrelid AND i.indisprimary AND a.attnum = ANY(i.indkey) - - LEFT JOIN pg_constraint n ON n.contype = 'f' AND n.conrelid = a.attrelid AND a.attnum = ANY(n.conkey) - LEFT JOIN pg_attribute fa ON n.confrelid = fa.attrelid AND fa.attnum = n.confkey[ARRAY_POSITION(n.conkey, a.attnum)] AND NOT fa.attisdropped - LEFT JOIN (pg_class fc JOIN pg_namespace fnc ON fc.relnamespace = fnc.oid) ON fa.attrelid = fc.oid - WHERE - NOT pg_is_other_temp_schema(nc.oid) - AND a.attnum > 0 - AND NOT a.attisdropped - AND (c.relkind IN ('r', 'v', 'f', 'p')) - AND (pg_has_role(c.relowner, 'USAGE') OR has_column_privilege(c.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES')) - AND nc.nspname = $1 - UNION - SELECT - nc.nspname AS table_schema, - c.relname AS table_name, - a.attname AS column_name, - true AS is_rev_fk, - a.attnum AS ordinal_position, - - true AS is_nullable, - - '' AS type_name, - - true AS is_array, - - NULL AS domain_schema, - NULL AS domain_name, - false AS is_primary_key, - - rfnc.nspname AS fk_table_schema, - rfc.relname AS fk_table_name, - rfa.attname AS fk_column_name, - - false AS is_updatable - FROM pg_attribute a - JOIN (pg_class c JOIN pg_namespace nc ON c.relnamespace = nc.oid) ON a.attrelid = c.oid - INNER JOIN pg_constraint rn ON rn.contype = 'f' AND rn.confrelid = a.attrelid AND a.attnum = ANY(rn.confkey) - INNER JOIN pg_attribute rfa ON rn.conrelid = rfa.attrelid AND rfa.attnum = rn.conkey[ARRAY_POSITION(rn.confkey, a.attnum)] AND NOT rfa.attisdropped - INNER JOIN (pg_class rfc JOIN pg_namespace rfnc ON rfc.relnamespace = rfnc.oid) ON rfa.attrelid = rfc.oid - WHERE - NOT pg_is_other_temp_schema(nc.oid) - AND a.attnum > 0 - AND NOT a.attisdropped - AND (pg_has_role(c.relowner, 'USAGE') OR has_column_privilege(c.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES')) - AND nc.nspname = $1 - ORDER BY - table_schema, table_name, is_rev_fk, ordinal_position; - "#; +const SCHEMA_QUERY: &str = include_str!("reflect/schema.postgres.sql"); #[derive(Parser, Debug)] pub struct Reflect { diff --git a/cli/src/command/reflect/schema.mysql.sql b/cli/src/command/reflect/schema.mysql.sql new file mode 100644 index 00000000..03ac7071 --- /dev/null +++ b/cli/src/command/reflect/schema.mysql.sql @@ -0,0 +1,64 @@ + SELECT + c.table_schema, + c.table_name, + c.column_name, + false AS is_rev_fk, + c.ordinal_position, + + c.is_nullable = 'YES' AS is_nullable, + + c.data_type AS type_name, + + false AS is_array, + + NULL AS domain_schema, + NULL AS domain_name, + c.column_key = 'PRI' AS is_primary_key, + + k.referenced_table_schema AS fk_table_schema, + k.referenced_table_name AS fk_table_name, + k.referenced_column_name AS fk_column_name, + + true AS is_updatable + + FROM information_schema.columns c + LEFT JOIN information_schema.key_column_usage k + ON c.table_schema = k.table_schema + AND c.table_name = k.table_name + AND c.column_name = k.column_name + WHERE + c.table_schema = $1 + +UNION + + SELECT + k.referenced_table_schema AS table_schema, + k.referenced_table_name AS table_name, + k.referenced_column_name AS column_name, + true AS is_rev_fk, + k.position_in_unique_constraint AS ordinal_position, + + true AS is_nullable, + + '' AS type_name, + + true AS is_array, + + NULL AS domain_schema, + NULL AS domain_name, + false AS is_primary_key, + + k.table_schema AS fk_table_schema, + k.table_name AS fk_table_name, + k.column_name AS fk_column_name, + + false AS is_updatable + + FROM information_schema.key_column_usage k + + WHERE + k.referenced_table_schema IS NOT NULL + AND k.constraint_schema = $1 + +ORDER BY + table_schema, table_name, is_rev_fk, ordinal_position; diff --git a/cli/src/command/reflect/schema.postgres.sql b/cli/src/command/reflect/schema.postgres.sql new file mode 100644 index 00000000..cc3b7e0a --- /dev/null +++ b/cli/src/command/reflect/schema.postgres.sql @@ -0,0 +1,82 @@ + SELECT + nc.nspname AS table_schema, + c.relname AS table_name, + a.attname AS column_name, + false AS is_rev_fk, + a.attnum AS ordinal_position, + + NOT(CASE WHEN t.typtype = 'd' THEN t.typnotnull ELSE a.attnotnull END) AS is_nullable, + + REGEXP_REPLACE(CASE WHEN t.typtype = 'd' THEN bt.typname ELSE t.typname END, '^_', '') type_name, + + CASE + WHEN t.typtype = 'd' THEN + bt.typelem <> 0 AND bt.typlen = '-1'::integer + ELSE + t.typelem <> 0 AND t.typlen = '-1'::integer + END AS is_array, + + CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE NULL END AS domain_schema, + CASE WHEN t.typtype = 'd' THEN t.typname ELSE NULL END AS domain_name, + COALESCE(i.indisprimary, false) AS is_primary_key, + + fnc.nspname AS fk_table_schema, + fc.relname AS fk_table_name, + fa.attname AS fk_column_name, + + (c.relkind IN ('r', 'p')) OR (c.relkind IN ('v', 'f')) AND pg_column_is_updatable(c.oid, a.attnum, false) AS is_updatable + FROM pg_attribute a + JOIN (pg_class c JOIN pg_namespace nc ON c.relnamespace = nc.oid) ON a.attrelid = c.oid + JOIN (pg_type t JOIN pg_namespace nt ON t.typnamespace = nt.oid) ON a.atttypid = t.oid + LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON bt.typnamespace = nbt.oid) ON t.typbasetype = bt.oid AND t.typtype = 'd' + LEFT JOIN pg_attrdef ad ON a.attrelid = ad.adrelid AND a.attnum = ad.adnum + LEFT JOIN pg_index i ON a.attrelid = i.indrelid AND i.indisprimary AND a.attnum = ANY(i.indkey) + LEFT JOIN pg_constraint n ON n.contype = 'f' AND n.conrelid = a.attrelid AND a.attnum = ANY(n.conkey) + LEFT JOIN pg_attribute fa ON n.confrelid = fa.attrelid AND fa.attnum = n.confkey[ARRAY_POSITION(n.conkey, a.attnum)] AND NOT fa.attisdropped + LEFT JOIN (pg_class fc JOIN pg_namespace fnc ON fc.relnamespace = fnc.oid) ON fa.attrelid = fc.oid + WHERE + NOT pg_is_other_temp_schema(nc.oid) + AND a.attnum > 0 + AND NOT a.attisdropped + AND (c.relkind IN ('r', 'v', 'f', 'p')) + AND (pg_has_role(c.relowner, 'USAGE') OR has_column_privilege(c.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES')) + AND nc.nspname = $1 + +UNION + + SELECT + nc.nspname AS table_schema, + c.relname AS table_name, + a.attname AS column_name, + true AS is_rev_fk, + a.attnum AS ordinal_position, + + true AS is_nullable, + + '' AS type_name, + + true AS is_array, + + NULL AS domain_schema, + NULL AS domain_name, + false AS is_primary_key, + + rfnc.nspname AS fk_table_schema, + rfc.relname AS fk_table_name, + rfa.attname AS fk_column_name, + + false AS is_updatable + FROM pg_attribute a + JOIN (pg_class c JOIN pg_namespace nc ON c.relnamespace = nc.oid) ON a.attrelid = c.oid + INNER JOIN pg_constraint rn ON rn.contype = 'f' AND rn.confrelid = a.attrelid AND a.attnum = ANY(rn.confkey) + INNER JOIN pg_attribute rfa ON rn.conrelid = rfa.attrelid AND rfa.attnum = rn.conkey[ARRAY_POSITION(rn.confkey, a.attnum)] AND NOT rfa.attisdropped + INNER JOIN (pg_class rfc JOIN pg_namespace rfnc ON rfc.relnamespace = rfnc.oid) ON rfa.attrelid = rfc.oid + WHERE + NOT pg_is_other_temp_schema(nc.oid) + AND a.attnum > 0 + AND NOT a.attisdropped + AND (pg_has_role(c.relowner, 'USAGE') OR has_column_privilege(c.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES')) + AND nc.nspname = $1 + +ORDER BY + table_schema, table_name, is_rev_fk, ordinal_position; diff --git a/cli/src/command/reflect/schema.sqlite.sql b/cli/src/command/reflect/schema.sqlite.sql new file mode 100644 index 00000000..7442f360 --- /dev/null +++ b/cli/src/command/reflect/schema.sqlite.sql @@ -0,0 +1,2 @@ +PRAGMA table_list; +PRAGMA table_info($table); From db151bbed67df32ca4ab142a54116de658b0e87d Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Sun, 19 Nov 2023 09:25:29 +0100 Subject: [PATCH 11/12] cli-migrate: Use PgConnection::connect --- cli/src/command/reflect.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/src/command/reflect.rs b/cli/src/command/reflect.rs index 2394182d..49f5b19b 100644 --- a/cli/src/command/reflect.rs +++ b/cli/src/command/reflect.rs @@ -1,4 +1,4 @@ -use crate::util::{create_connection, create_runtime}; +use crate::util::create_runtime; use anyhow::Result; use clap::Parser; use colored::Colorize; @@ -9,7 +9,7 @@ use ormlite_core::config::get_var_database_url; use proc_macro2::TokenStream; use quote::{format_ident, quote}; use rust_format::{Formatter, PrettyPlease}; -use sqlx::FromRow; +use sqlx::{FromRow, PgConnection, Connection}; use std::fs; /* TODO @@ -158,7 +158,7 @@ impl ColumnDef { } } -const SCHEMA_QUERY: &str = include_str!("reflect/schema.postgres.sql"); +const SCHEMA_QUERY: &str = include_str!("reflect/schema.postgres.sql"); #[derive(Parser, Debug)] pub struct Reflect { @@ -174,7 +174,7 @@ impl Reflect { pub fn run(self) -> Result<()> { let runtime = create_runtime(); let url = get_var_database_url(); - let mut conn = create_connection(&url, &runtime)?; + let mut conn = runtime.block_on(PgConnection::connect(&url))?; let conn = runtime.block_on(conn.acquire())?; let schema = From efbbb7794116da66d82697d171421beb20869124 Mon Sep 17 00:00:00 2001 From: Franco Lucchini Date: Thu, 20 Jun 2024 08:24:28 +0200 Subject: [PATCH 12/12] checkpoint --- Cargo.lock | 392 +++++++++++++++++----------------- cli/src/command/reflect.rs | 72 ++++--- core/src/config.rs | 2 +- core/src/query_builder/mod.rs | 2 +- macro/src/codegen/update.rs | 54 ++++- ormlite/src/lib.rs | 3 +- 6 files changed, 300 insertions(+), 225 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 53cb44bc..886a99cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ "getrandom", "once_cell", @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" dependencies = [ "cfg-if", "getrandom", @@ -73,9 +73,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -87,9 +87,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -121,9 +121,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.77" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "arrayvec" @@ -139,13 +139,13 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-trait" -version = "0.1.75" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -202,9 +202,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basic-toml" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f2139706359229bfa8f19142ac1155b4b80beafb7a60471ac5dd109d4a19778" +checksum = "2db21524cad41c5591204d22d75e1970a2d1f71060214ca931dc7d5afe2c14e5" dependencies = [ "serde", ] @@ -217,9 +217,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" dependencies = [ "serde", ] @@ -247,9 +247,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" +checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" dependencies = [ "borsh-derive", "cfg_aliases", @@ -257,15 +257,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" +checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" dependencies = [ "once_cell", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", "syn_derive", ] @@ -281,15 +281,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" [[package]] name = "bytecheck" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -298,9 +298,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" dependencies = [ "proc-macro2", "quote", @@ -342,9 +342,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", @@ -352,14 +352,14 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] name = "clap" -version = "4.4.12" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -367,9 +367,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.12" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", @@ -379,21 +379,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -434,9 +434,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -458,44 +458,37 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.17" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-queue" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc6598521bb5a83d491e8c1fe51db7296019d2ca3cb93cc6c2a20369a4d78a2" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-common" @@ -520,9 +513,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] @@ -553,18 +546,18 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" dependencies = [ "serde", ] [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -711,7 +704,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] @@ -756,9 +749,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -796,7 +789,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] @@ -805,7 +798,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.8", "allocator-api2", ] @@ -829,9 +822,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -874,9 +867,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -907,9 +900,9 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747ad1b4ae841a78e8aba0d63adbfbeaea26b517b63705d47856b73015d27060" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" dependencies = [ "crossbeam-deque", "globset", @@ -923,9 +916,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -933,12 +926,12 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", + "libc", "windows-sys 0.52.0", ] @@ -962,9 +955,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -977,9 +970,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -995,9 +988,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.151" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libm" @@ -1018,9 +1011,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -1062,9 +1055,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -1086,7 +1079,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if", "libc", ] @@ -1128,21 +1121,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg", "num-integer", @@ -1151,9 +1149,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", "libm", @@ -1213,7 +1211,7 @@ dependencies = [ "quote", "sqlmo", "structmeta", - "syn 2.0.43", + "syn 2.0.49", "tracing", ] @@ -1238,7 +1236,7 @@ dependencies = [ "sqlmo", "sqlmo_sqlx", "sqlx", - "syn 2.0.43", + "syn 2.0.49", "time", "tokio", "tracing", @@ -1260,7 +1258,7 @@ dependencies = [ "sqlmo", "sqlparser", "sqlx", - "syn 2.0.43", + "syn 2.0.49", "thiserror", "tokio", "uuid", @@ -1278,7 +1276,7 @@ dependencies = [ "proc-macro2", "quote", "sqlx", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] @@ -1366,9 +1364,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "powerfmt" @@ -1394,11 +1392,10 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_datetime", "toml_edit", ] @@ -1427,9 +1424,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.71" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1456,9 +1453,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1510,9 +1507,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -1522,9 +1519,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -1539,9 +1536,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rend" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" dependencies = [ "bytecheck", ] @@ -1562,9 +1559,9 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.43" +version = "0.7.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" +checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" dependencies = [ "bitvec", "bytecheck", @@ -1580,9 +1577,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.43" +version = "0.7.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" dependencies = [ "proc-macro2", "quote", @@ -1622,9 +1619,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.33.1" +version = "1.34.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06676aec5ccb8fc1da723cc8c0f9a46549f21ebb8753d3915c6c41db1e7f1dc4" +checksum = "b39449a79f45e8da28c57c341891b69a183044b29518bb8f86dbac9df60bb7df" dependencies = [ "arrayvec", "borsh", @@ -1644,11 +1641,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", @@ -1724,29 +1721,29 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -1820,9 +1817,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" @@ -1865,7 +1862,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" dependencies = [ - "itertools 0.12.0", + "itertools 0.12.1", "nom", "unicode_categories", ] @@ -1921,7 +1918,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.8", "atoi", "byteorder", "bytes", @@ -2010,7 +2007,7 @@ checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" dependencies = [ "atoi", "base64", - "bitflags 2.4.1", + "bitflags 2.4.2", "byteorder", "bytes", "chrono", @@ -2056,7 +2053,7 @@ checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" dependencies = [ "atoi", "base64", - "bitflags 2.4.1", + "bitflags 2.4.2", "byteorder", "chrono", "crc", @@ -2130,9 +2127,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "structmeta" @@ -2143,7 +2140,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] @@ -2154,7 +2151,7 @@ checksum = "a60bcaff7397072dca0017d1db428e30d5002e00b6847703e2e42005c95fbe00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] @@ -2176,9 +2173,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.43" +version = "2.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" dependencies = [ "proc-macro2", "quote", @@ -2194,7 +2191,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] @@ -2205,44 +2202,43 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.52" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.52" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] @@ -2257,12 +2253,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -2277,10 +2274,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -2301,9 +2299,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -2326,7 +2324,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] @@ -2342,15 +2340,15 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ "indexmap", "toml_datetime", @@ -2377,7 +2375,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] @@ -2417,9 +2415,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419ecd263363827c5730386f418715766f584e2f874d32c23c5b00bd9727e7e" +checksum = "9a9d3ba662913483d6722303f619e75ea10b7855b0f8e0d72799cf8621bb488f" dependencies = [ "basic-toml", "dissimilar", @@ -2439,9 +2437,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -2460,9 +2458,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode_categories" @@ -2501,9 +2499,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom", "serde", @@ -2545,9 +2543,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2555,24 +2553,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2580,28 +2578,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "webpki-roots" -version = "0.25.3" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "whoami" @@ -2642,11 +2640,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -2783,9 +2781,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.31" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] @@ -2816,7 +2814,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.49", ] [[package]] diff --git a/cli/src/command/reflect.rs b/cli/src/command/reflect.rs index 49f5b19b..cc1a167b 100644 --- a/cli/src/command/reflect.rs +++ b/cli/src/command/reflect.rs @@ -6,21 +6,21 @@ use heck::{ToPascalCase, ToSnakeCase}; use itertools::Itertools; use ormlite::Acquire; use ormlite_core::config::get_var_database_url; -use proc_macro2::TokenStream; +use proc_macro2::{Ident, TokenStream}; use quote::{format_ident, quote}; use rust_format::{Formatter, PrettyPlease}; -use sqlx::{FromRow, PgConnection, Connection}; -use std::fs; +use sqlx::{Connection, FromRow, PgConnection}; +use std::{collections::HashMap, fs}; /* TODO - * - Dynamically import required types - * - Reserved words `r#` quoting - * - Repeated field name detection - * - Integrate `KVec` one-to-many implementation - * - Properly support views - * - Provide a mechanism to skip unwanted fields and other settings (via doc-comments or custom directive) - * - `--split` option for generating one model per file - * - `--domains` option for domains as `type` aliases + * [ ] Dynamically import required types + * [ ] Reserved words `r#` quoting + * [X] Repeated field name detection + * [ ] Integrate `KVec` one-to-many implementation + * [ ] Properly support views + * [ ] Provide a mechanism to skip unwanted fields and other settings (via doc-comments or custom directive) + * [ ] `--split` option for generating one model per file + * [ ] `--domains` option for domains as `type` aliases */ #[allow(dead_code)] @@ -125,7 +125,7 @@ impl ColumnDef { //"cid" /* U: 29, 1012 */ "json" /* U: 114, 199 */ | "jsonb" /* U: 3802, 3807 */ - => quote! { Json }, + => quote! { JsonValue }, //"jsonpath" /* U: 4072, 4073 */ //"pg_lsn" /* U: 3220, 3221 */ @@ -160,6 +160,25 @@ impl ColumnDef { const SCHEMA_QUERY: &str = include_str!("reflect/schema.postgres.sql"); +struct Namer { + names: HashMap, +} + +impl Namer { + pub fn new() -> Self { + Self { names: HashMap::new() } + } + pub fn mk_name(&mut self, name: &str) -> Ident { + let column_name = name.to_snake_case(); + let idx = *self.names.entry(column_name.clone()).and_modify(|cnt| *cnt += 1).or_insert(0); + if idx > 0 { + format_ident!("{column_name}_{idx}") + } else { + format_ident!("{column_name}") + } + } +} + #[derive(Parser, Debug)] pub struct Reflect { /// Database schema name @@ -185,6 +204,7 @@ impl Reflect { .group_by(|item| (item.table_schema.to_owned(), item.table_name.to_owned())) .into_iter() .map(|(key, items)| { + let mut namer = Namer::new(); let table_name_sql = &key.1; let table_name_rs = format_ident!("{}", table_name_sql.to_pascal_case()); let q_table_alias = (table_name_rs != *table_name_sql).then_some(quote! { @@ -194,47 +214,51 @@ impl Reflect { let q_is_primary_key = col.is_primary_key.then_some(quote! { #[ormlite(primary_key)] }); + /* if let (Some(_fk_column_name), Some(fk_table_name)) = (&col.fk_column_name, &col.fk_table_name) { let column_name_sql = &col.column_name.clone(); let type_name_rs = format_ident!("{}", fk_table_name.to_pascal_case()); if col.is_rev_fk { - let coulmn_name_rs = format_ident!("{}", fk_table_name.to_snake_case()); + let coulmn_name_rs = namer.mk_name(fk_table_name); quote! { #[ormlite(skip)] pub #coulmn_name_rs: KVec<#type_name_rs>, } } else { - let column_name_rs = format_ident!( - "{}", - col.column_name.strip_prefix("id_").unwrap_or(&col.column_name).to_snake_case() - ); + let column_name_rs = + namer.mk_name(col.column_name.strip_prefix("id_").strip_suffix("_id").unwrap_or(&col.column_name)); quote! { #[ormlite(join_column = #column_name_sql)] pub #column_name_rs: Join<#type_name_rs>, } } - } else { - let column_name_rs = format_ident!("{}", col.column_name.to_snake_case()); + } else */ + if !col.is_rev_fk { + let column_name_rs = namer.mk_name(&col.column_name); let column_type_rs = col.rust_type(); quote! { #q_is_primary_key pub #column_name_rs: #column_type_rs, } + } else { + quote! {} } }); quote! { - #[derive(Model, Debug, Serialize)] + #[derive(Model, Debug, Serialize, Deserialize, JsonSchema)] #q_table_alias - struct #table_name_rs { + pub struct #table_name_rs { #(#q_columns)* } } }) .concat(); + //use ormlite::{Model, model::Join, KVec}; let q_output = quote! { - use ormlite::{Model, model::Join}; - use serde::Serialize; + use ormlite::Model; + use serde::{Serialize, Deserialize}; + use schemars::JsonSchema; pub use ormlite::types::{ chrono::{ NaiveDate as Date, @@ -247,7 +271,7 @@ impl Reflect { }, // BigDecimal, Decimal, - Json, + JsonValue, Uuid }; pub type DateTimeTz = ChronoDateTime; diff --git a/core/src/config.rs b/core/src/config.rs index cb8526d3..10a8f705 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -5,7 +5,7 @@ use std::str::FromStr; const MIGRATION_FOLDER: &str = "migrations"; pub const MIGRATION_TABLE: &str = "_sqlx_migrations"; const MIGRATION_SNAPSHOT_FOLDER: &str = "migrations/snapshot"; -pub const MODEL_FOLDERS: &str = "."; +pub const MODEL_FOLDERS: &str = "src/_"; pub fn get_var_migration_folder() -> PathBuf { let folder = var("MIGRATION_FOLDER").unwrap_or_else(|_| MIGRATION_FOLDER.to_string()); diff --git a/core/src/query_builder/mod.rs b/core/src/query_builder/mod.rs index 6e05b7eb..60bd2dba 100644 --- a/core/src/query_builder/mod.rs +++ b/core/src/query_builder/mod.rs @@ -1,6 +1,6 @@ pub mod args; pub mod placeholder; -mod select; +pub mod select; mod util; pub use placeholder::Placeholder; pub use select::SelectQueryBuilder; diff --git a/macro/src/codegen/update.rs b/macro/src/codegen/update.rs index c558cfdd..eee258d0 100644 --- a/macro/src/codegen/update.rs +++ b/macro/src/codegen/update.rs @@ -54,6 +54,59 @@ pub fn impl_Model__update_all_fields(db: &dyn OrmliteCodegen, attr: &ModelMetada } +pub fn impl_Model__update_all_fields_by_id(db: &dyn OrmliteCodegen, attr: &ModelMetadata) -> TokenStream { + let box_future = crate::util::box_fut_ts(); + let mut placeholder = db.placeholder(); + let db = db.database_ts(); + let mut query = "UPDATE \"".to_string(); + query.push_str(&attr.inner.table_name); + query.push_str("\" SET "); + for c in attr.database_columns_except_pkey() { + query.push_str(&c.column_name); + query.push_str(" = "); + query.push_str(&placeholder.next().unwrap()); + query.push_str(", "); + } + // remove the final ", " + query.truncate(query.len() - 2); + query.push_str(" WHERE "); + query.push_str(&attr.pkey.column_name); + query.push_str(" = "); + query.push_str(&placeholder.next().unwrap()); + query.push_str(" RETURNING *"); + + let id = &attr.pkey.identifier; + let query_bindings = attr.database_columns_except_pkey().map(|c| insertion_binding(c)); + + let unwind_joins = attr.many_to_one_joins().map(|c| { + let id = &c.identifier; + quote! { + let #id = &model.#id; + } + }); + + quote! { + fn update_all_fields_by_id<'e, 'a, Arg, E>(self, db: E) -> #box_future<'e, ::ormlite::Result> + where + 'a: 'e, + Arg: 'a + Send + ::ormlite::Encode<'a, #db> + ::ormlite::types::Type<#db>, + E: 'e +::ormlite::Executor<'e, Database = #db>, + { + Box::pin(async move { + let mut q =::ormlite::query_as::<_, Self>(#query); + let model = self; + #(#unwind_joins)* + #(#query_bindings)* + q.bind(model.#id) + .fetch_one(db) + .await + .map_err(::ormlite::Error::from) + }) + } + } +} + + pub fn impl_ModelBuilder__update(db: &dyn OrmliteCodegen, attr: &ModelMetadata) -> TokenStream { let box_future = crate::util::box_fut_ts(); let placeholder = db.placeholder_ts(); @@ -98,4 +151,3 @@ pub fn impl_ModelBuilder__update(db: &dyn OrmliteCodegen, attr: &ModelMetadata) } } } - diff --git a/ormlite/src/lib.rs b/ormlite/src/lib.rs index 243739cf..1f9f7830 100644 --- a/ormlite/src/lib.rs +++ b/ormlite/src/lib.rs @@ -4,6 +4,7 @@ pub use ormlite_core::{Error, Result}; pub use ormlite_core::fetch_linked; pub use ormlite_core::KVec; pub use model::{Model, FromRow, TableMeta, IntoArguments}; +pub use ormlite_core::query_builder::select::DatabaseMetadata; pub use ::sqlx::{Row, ColumnIndex, Decode, Column, Database}; pub use ::sqlx::{query, query_as, query_as_with, Connection, Executor, Pool, Acquire, ConnectOptions, Encode, Arguments, query_with}; @@ -50,4 +51,4 @@ pub mod postgres { #[cfg_attr(docsrs, doc(cfg(feature = "sqlite")))] pub mod sqlite { pub use sqlx::sqlite::*; -} \ No newline at end of file +}