From 87dcd9abd8efb92d83b6977c93516065ba620c18 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Thu, 2 Nov 2023 18:24:39 +0100 Subject: [PATCH 01/11] test: change "simple_table" to be compile-able needed to be split per backend, because original file types were not compatible --- Cargo.lock | 518 +++++++++++++++++- Cargo.toml | 9 + test/simple_table/test.sh | 7 - test/simple_table_mysql/Cargo.toml | 18 + test/simple_table_mysql/lib.rs | 6 + .../models/mod.rs | 0 .../models/todos/generated.rs | 74 +++ .../models/todos/mod.rs | 0 .../schema.rs | 6 +- test/simple_table_mysql/test.sh | 8 + test/simple_table_pg/Cargo.toml | 18 + test/simple_table_pg/lib.rs | 6 + test/simple_table_pg/models/mod.rs | 1 + .../models/todos/generated.rs | 30 +- test/simple_table_pg/models/todos/mod.rs | 2 + test/simple_table_pg/schema.rs | 14 + test/simple_table_pg/test.sh | 8 + test/simple_table_sqlite/Cargo.toml | 19 + test/simple_table_sqlite/lib.rs | 6 + test/simple_table_sqlite/models/mod.rs | 1 + .../models/todos/generated.rs | 109 ++++ test/simple_table_sqlite/models/todos/mod.rs | 2 + test/simple_table_sqlite/schema.rs | 16 + test/simple_table_sqlite/test.sh | 8 + 24 files changed, 861 insertions(+), 25 deletions(-) delete mode 100755 test/simple_table/test.sh create mode 100644 test/simple_table_mysql/Cargo.toml create mode 100644 test/simple_table_mysql/lib.rs rename test/{simple_table => simple_table_mysql}/models/mod.rs (100%) create mode 100644 test/simple_table_mysql/models/todos/generated.rs rename test/{simple_table => simple_table_mysql}/models/todos/mod.rs (100%) rename test/{simple_table => simple_table_mysql}/schema.rs (71%) create mode 100755 test/simple_table_mysql/test.sh create mode 100644 test/simple_table_pg/Cargo.toml create mode 100644 test/simple_table_pg/lib.rs create mode 100644 test/simple_table_pg/models/mod.rs rename test/{simple_table => simple_table_pg}/models/todos/generated.rs (84%) create mode 100644 test/simple_table_pg/models/todos/mod.rs create mode 100644 test/simple_table_pg/schema.rs create mode 100755 test/simple_table_pg/test.sh create mode 100644 test/simple_table_sqlite/Cargo.toml create mode 100644 test/simple_table_sqlite/lib.rs create mode 100644 test/simple_table_sqlite/models/mod.rs create mode 100644 test/simple_table_sqlite/models/todos/generated.rs create mode 100644 test/simple_table_sqlite/models/todos/mod.rs create mode 100644 test/simple_table_sqlite/schema.rs create mode 100755 test/simple_table_sqlite/test.sh diff --git a/Cargo.lock b/Cargo.lock index 0dd4197c..a1db464e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "0.6.4" @@ -50,12 +65,66 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-targets", +] + [[package]] name = "clap" version = "4.4.6" @@ -112,6 +181,62 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "diesel" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2268a214a6f118fce1838edba3d1561cf0e78d8de785475957a580a7f8c69d33" +dependencies = [ + "bitflags 2.4.0", + "byteorder", + "chrono", + "diesel_derives", + "itoa", + "libsqlite3-sys", + "mysqlclient-sys", + "percent-encoding", + "pq-sys", + "r2d2", + "time", + "url", +] + +[[package]] +name = "diesel_derives" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8337737574f55a468005a83499da720f20c65586241ffea339db9ecdfd2b44" +dependencies = [ + "diesel_table_macro_syntax", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diesel_table_macro_syntax" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" +dependencies = [ + "syn", +] + [[package]] name = "dsync" version = "0.0.17-beta" @@ -135,30 +260,188 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "iana-time-zone" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indoc" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "libc" version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +[[package]] +name = "libsqlite3-sys" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +dependencies = [ + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "mysqlclient-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f61b381528ba293005c42a409dd73d034508e273bf90481f17ec2e964a6e969b" +dependencies = [ + "pkg-config", + "vcpkg", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pkg-config" +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 = "pq-sys" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c0052426df997c0cbd30789eb44ca097e3541717a7b8fa36b1c464ee7edebd" +dependencies = [ + "vcpkg", +] + [[package]] name = "proc-macro2" version = "1.0.69" @@ -177,19 +460,113 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r2d2" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" +dependencies = [ + "log", + "parking_lot", + "scheduled-thread-pool", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "rustix" version = "0.38.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a74ee2d7c2581cd139b42447d7d9389b889bdaad3a73f1ebb16f2a3237bb19c" dependencies = [ - "bitflags", + "bitflags 2.4.0", "errno", "libc", "linux-raw-sys", "windows-sys", ] +[[package]] +name = "scheduled-thread-pool" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" +dependencies = [ + "parking_lot", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "simple_table_mysql" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "r2d2", + "serde", +] + +[[package]] +name = "simple_table_pg" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "r2d2", + "serde", +] + +[[package]] +name = "simple_table_sqlite" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "r2d2", + "serde", +] + +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + [[package]] name = "strsim" version = "0.10.0" @@ -237,18 +614,157 @@ dependencies = [ "syn", ] +[[package]] +name = "time" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "wasm-bindgen" +version = "0.2.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index d7719beb..b85bd085 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,3 +47,12 @@ path = "src/lib.rs" name = "dsync" test = false path = "src/bin/main.rs" + +[workspace] +# only some tests are currently compile-able +members = [ + "test/simple_table_pg", + "test/simple_table_mysql", + "test/simple_table_sqlite", +] +resolver = "2" diff --git a/test/simple_table/test.sh b/test/simple_table/test.sh deleted file mode 100755 index 9f7f0d51..00000000 --- a/test/simple_table/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" - -cd $SCRIPT_DIR - -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file diff --git a/test/simple_table_mysql/Cargo.toml b/test/simple_table_mysql/Cargo.toml new file mode 100644 index 00000000..724d887f --- /dev/null +++ b/test/simple_table_mysql/Cargo.toml @@ -0,0 +1,18 @@ +[lib] +path = "lib.rs" + +[package] +name = "simple_table_mysql" +version = "0.1.0" +edition = "2021" + +[dependencies] +diesel = { version = "*", default-features = false, features = [ + "mysql", + "r2d2", + "chrono", +] } +r2d2 = "*" +dsync = { path = "../../" } +chrono = { version = "*", features = ["serde"] } +serde = { version = "*", features = ["derive"] } diff --git a/test/simple_table_mysql/lib.rs b/test/simple_table_mysql/lib.rs new file mode 100644 index 00000000..fdea3f51 --- /dev/null +++ b/test/simple_table_mysql/lib.rs @@ -0,0 +1,6 @@ +pub mod models; +pub mod schema; + +pub mod diesel { + pub use diesel::*; +} diff --git a/test/simple_table/models/mod.rs b/test/simple_table_mysql/models/mod.rs similarity index 100% rename from test/simple_table/models/mod.rs rename to test/simple_table_mysql/models/mod.rs diff --git a/test/simple_table_mysql/models/todos/generated.rs b/test/simple_table_mysql/models/todos/generated.rs new file mode 100644 index 00000000..5a8672b7 --- /dev/null +++ b/test/simple_table_mysql/models/todos/generated.rs @@ -0,0 +1,74 @@ +/* @generated and managed by dsync */ + +use crate::diesel::*; +use crate::schema::*; + +/// Struct representing a row in table `todos` +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] +#[diesel(table_name=todos, primary_key(id))] +pub struct Todos { + /// Field representing column `id` + pub id: i32, + /// Field representing column `unsigned` + pub unsigned: u32, + /// Field representing column `unsigned_nullable` + pub unsigned_nullable: Option, + /// Field representing column `text` + pub text: String, + /// Field representing column `completed` + pub completed: bool, + /// Field representing column `type` + pub type_: String, + /// Field representing column `smallint` + pub smallint: i16, + /// Field representing column `bigint` + pub bigint: i64, + /// Field representing column `created_at` + pub created_at: chrono::NaiveDateTime, + /// Field representing column `updated_at` + pub updated_at: chrono::NaiveDateTime, +} + +/// Create Struct for a row in table `todos` for [`Todos`] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] +#[diesel(table_name=todos)] +pub struct CreateTodos { + /// Field representing column `unsigned` + pub unsigned: u32, + /// Field representing column `unsigned_nullable` + pub unsigned_nullable: Option, + /// Field representing column `text` + pub text: String, + /// Field representing column `completed` + pub completed: bool, + /// Field representing column `type` + pub type_: String, + /// Field representing column `smallint` + pub smallint: i16, + /// Field representing column `bigint` + pub bigint: i64, +} + +/// Update Struct for a row in table `todos` for [`Todos`] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] +#[diesel(table_name=todos)] +pub struct UpdateTodos { + /// Field representing column `unsigned` + pub unsigned: Option, + /// Field representing column `unsigned_nullable` + pub unsigned_nullable: Option>, + /// Field representing column `text` + pub text: Option, + /// Field representing column `completed` + pub completed: Option, + /// Field representing column `type` + pub type_: Option, + /// Field representing column `smallint` + pub smallint: Option, + /// Field representing column `bigint` + pub bigint: Option, + /// Field representing column `created_at` + pub created_at: Option, + /// Field representing column `updated_at` + pub updated_at: Option, +} diff --git a/test/simple_table/models/todos/mod.rs b/test/simple_table_mysql/models/todos/mod.rs similarity index 100% rename from test/simple_table/models/todos/mod.rs rename to test/simple_table_mysql/models/todos/mod.rs diff --git a/test/simple_table/schema.rs b/test/simple_table_mysql/schema.rs similarity index 71% rename from test/simple_table/schema.rs rename to test/simple_table_mysql/schema.rs index dc033baf..7084caba 100644 --- a/test/simple_table/schema.rs +++ b/test/simple_table_mysql/schema.rs @@ -8,7 +8,9 @@ diesel::table! { #[sql_name = "type"] #[max_length = 255] type_ -> Varchar, - created_at -> Timestamptz, - updated_at -> Timestamptz, + smallint -> Int2, + bigint -> Int8, + created_at -> Timestamp, + updated_at -> Timestamp, } } diff --git a/test/simple_table_mysql/test.sh b/test/simple_table_mysql/test.sh new file mode 100755 index 00000000..9e2a1ab5 --- /dev/null +++ b/test/simple_table_mysql/test.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +cd $SCRIPT_DIR + +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --no-crud diff --git a/test/simple_table_pg/Cargo.toml b/test/simple_table_pg/Cargo.toml new file mode 100644 index 00000000..a4d258c0 --- /dev/null +++ b/test/simple_table_pg/Cargo.toml @@ -0,0 +1,18 @@ +[lib] +path = "lib.rs" + +[package] +name = "simple_table_pg" +version = "0.1.0" +edition = "2021" + +[dependencies] +diesel = { version = "*", default-features = false, features = [ + "postgres", + "r2d2", + "chrono", +] } +r2d2 = "*" +dsync = { path = "../../" } +chrono = { version = "*", features = ["serde"] } +serde = { version = "*", features = ["derive"] } diff --git a/test/simple_table_pg/lib.rs b/test/simple_table_pg/lib.rs new file mode 100644 index 00000000..fdea3f51 --- /dev/null +++ b/test/simple_table_pg/lib.rs @@ -0,0 +1,6 @@ +pub mod models; +pub mod schema; + +pub mod diesel { + pub use diesel::*; +} diff --git a/test/simple_table_pg/models/mod.rs b/test/simple_table_pg/models/mod.rs new file mode 100644 index 00000000..015a6a2b --- /dev/null +++ b/test/simple_table_pg/models/mod.rs @@ -0,0 +1 @@ +pub mod todos; diff --git a/test/simple_table/models/todos/generated.rs b/test/simple_table_pg/models/todos/generated.rs similarity index 84% rename from test/simple_table/models/todos/generated.rs rename to test/simple_table_pg/models/todos/generated.rs index 64aa5752..166b38ab 100644 --- a/test/simple_table/models/todos/generated.rs +++ b/test/simple_table_pg/models/todos/generated.rs @@ -3,7 +3,7 @@ use crate::diesel::*; use crate::schema::*; -pub type ConnectionType = diesel::r2d2::PooledConnection>; +pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] @@ -11,56 +11,56 @@ pub type ConnectionType = diesel::r2d2::PooledConnection, /// Field representing column `text` pub text: String, /// Field representing column `completed` pub completed: bool, /// Field representing column `type` pub type_: String, + /// Field representing column `smallint` + pub smallint: i16, + /// Field representing column `bigint` + pub bigint: i64, /// Field representing column `created_at` pub created_at: chrono::DateTime, /// Field representing column `updated_at` - pub updated_at: chrono::DateTime, + pub updated_at: chrono::NaiveDateTime, } /// Create Struct for a row in table `todos` for [`Todos`] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { - /// Field representing column `unsigned` - pub unsigned: u32, - /// Field representing column `unsigned_nullable` - pub unsigned_nullable: Option, /// Field representing column `text` pub text: String, /// Field representing column `completed` pub completed: bool, /// Field representing column `type` pub type_: String, + /// Field representing column `smallint` + pub smallint: i16, + /// Field representing column `bigint` + pub bigint: i64, } /// Update Struct for a row in table `todos` for [`Todos`] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { - /// Field representing column `unsigned` - pub unsigned: Option, - /// Field representing column `unsigned_nullable` - pub unsigned_nullable: Option>, /// Field representing column `text` pub text: Option, /// Field representing column `completed` pub completed: Option, /// Field representing column `type` pub type_: Option, + /// Field representing column `smallint` + pub smallint: Option, + /// Field representing column `bigint` + pub bigint: Option, /// Field representing column `created_at` pub created_at: Option>, /// Field representing column `updated_at` - pub updated_at: Option>, + pub updated_at: Option, } /// Result of a `.paginate` function diff --git a/test/simple_table_pg/models/todos/mod.rs b/test/simple_table_pg/models/todos/mod.rs new file mode 100644 index 00000000..a5bb9b90 --- /dev/null +++ b/test/simple_table_pg/models/todos/mod.rs @@ -0,0 +1,2 @@ +pub use generated::*; +pub mod generated; diff --git a/test/simple_table_pg/schema.rs b/test/simple_table_pg/schema.rs new file mode 100644 index 00000000..c66e8219 --- /dev/null +++ b/test/simple_table_pg/schema.rs @@ -0,0 +1,14 @@ +diesel::table! { + todos (id) { + id -> Int4, + text -> Text, + completed -> Bool, + #[sql_name = "type"] + #[max_length = 255] + type_ -> Varchar, + smallint -> Int2, + bigint -> Int8, + created_at -> Timestamptz, + updated_at -> Timestamp, + } +} diff --git a/test/simple_table_pg/test.sh b/test/simple_table_pg/test.sh new file mode 100755 index 00000000..bd818028 --- /dev/null +++ b/test/simple_table_pg/test.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +cd $SCRIPT_DIR + +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" diff --git a/test/simple_table_sqlite/Cargo.toml b/test/simple_table_sqlite/Cargo.toml new file mode 100644 index 00000000..b14735dc --- /dev/null +++ b/test/simple_table_sqlite/Cargo.toml @@ -0,0 +1,19 @@ +[lib] +path = "lib.rs" + +[package] +name = "simple_table_sqlite" +version = "0.1.0" +edition = "2021" + +[dependencies] +diesel = { version = "*", default-features = false, features = [ + "sqlite", + "r2d2", + "chrono", + "returning_clauses_for_sqlite_3_35", +] } +r2d2 = "*" +dsync = { path = "../../" } +chrono = { version = "*", features = ["serde"] } +serde = { version = "*", features = ["derive"] } diff --git a/test/simple_table_sqlite/lib.rs b/test/simple_table_sqlite/lib.rs new file mode 100644 index 00000000..fdea3f51 --- /dev/null +++ b/test/simple_table_sqlite/lib.rs @@ -0,0 +1,6 @@ +pub mod models; +pub mod schema; + +pub mod diesel { + pub use diesel::*; +} diff --git a/test/simple_table_sqlite/models/mod.rs b/test/simple_table_sqlite/models/mod.rs new file mode 100644 index 00000000..015a6a2b --- /dev/null +++ b/test/simple_table_sqlite/models/mod.rs @@ -0,0 +1 @@ +pub mod todos; diff --git a/test/simple_table_sqlite/models/todos/generated.rs b/test/simple_table_sqlite/models/todos/generated.rs new file mode 100644 index 00000000..1cd75bea --- /dev/null +++ b/test/simple_table_sqlite/models/todos/generated.rs @@ -0,0 +1,109 @@ +/* @generated and managed by dsync */ + +use crate::diesel::*; +use crate::schema::*; + +pub type ConnectionType = diesel::r2d2::PooledConnection>; + +/// Struct representing a row in table `todos` +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] +#[diesel(table_name=todos, primary_key(id))] +pub struct Todos { + /// Field representing column `id` + pub id: i32, + /// Field representing column `text` + pub text: String, + /// Field representing column `completed` + pub completed: bool, + /// Field representing column `type` + pub type_: String, + /// Field representing column `smallint` + pub smallint: i16, + /// Field representing column `bigint` + pub bigint: i64, + /// Field representing column `created_at` + pub created_at: chrono::NaiveDateTime, + /// Field representing column `updated_at` + pub updated_at: chrono::NaiveDateTime, +} + +/// Create Struct for a row in table `todos` for [`Todos`] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] +#[diesel(table_name=todos)] +pub struct CreateTodos { + /// Field representing column `text` + pub text: String, + /// Field representing column `completed` + pub completed: bool, + /// Field representing column `type` + pub type_: String, + /// Field representing column `smallint` + pub smallint: i16, + /// Field representing column `bigint` + pub bigint: i64, +} + +/// Update Struct for a row in table `todos` for [`Todos`] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] +#[diesel(table_name=todos)] +pub struct UpdateTodos { + /// Field representing column `text` + pub text: Option, + /// Field representing column `completed` + pub completed: Option, + /// Field representing column `type` + pub type_: Option, + /// Field representing column `smallint` + pub smallint: Option, + /// Field representing column `bigint` + pub bigint: Option, + /// Field representing column `created_at` + pub created_at: Option, + /// Field representing column `updated_at` + pub updated_at: Option, +} + +/// Result of a `.paginate` function +#[derive(Debug, serde::Serialize)] +pub struct PaginationResult { + /// Resulting items that are from the current page + pub items: Vec, + /// The count of total items there are + pub total_items: i64, + /// Current page, 0-based index + pub page: i64, + /// Size of a page + pub page_size: i64, + /// Number of total possible pages, given the `page_size` and `total_items` + pub num_pages: i64, +} + +impl Todos { + /// Insert a new row into `todos` with a given [`CreateTodos`] + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { + use crate::schema::todos::dsl::*; + + diesel::insert_into(todos).values(item).get_result::(db) + } + + /// Get a row from `todos`, identified by the primary key + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { + use crate::schema::todos::dsl::*; + + todos.filter(id.eq(param_id)).first::(db) + } + + /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { + use crate::schema::todos::dsl::*; + + diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db) + } + + /// Delete a row in `todos`, identified by the primary key + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { + use crate::schema::todos::dsl::*; + + diesel::delete(todos.filter(id.eq(param_id))).execute(db) + } +} diff --git a/test/simple_table_sqlite/models/todos/mod.rs b/test/simple_table_sqlite/models/todos/mod.rs new file mode 100644 index 00000000..a5bb9b90 --- /dev/null +++ b/test/simple_table_sqlite/models/todos/mod.rs @@ -0,0 +1,2 @@ +pub use generated::*; +pub mod generated; diff --git a/test/simple_table_sqlite/schema.rs b/test/simple_table_sqlite/schema.rs new file mode 100644 index 00000000..c91a5c4f --- /dev/null +++ b/test/simple_table_sqlite/schema.rs @@ -0,0 +1,16 @@ +diesel::table! { + todos (id) { + id -> Int4, + // unsigned -> Unsigned, + // unsigned_nullable -> Nullable>, + text -> Text, + completed -> Bool, + #[sql_name = "type"] + #[max_length = 255] + type_ -> Varchar, + smallint -> Int2, + bigint -> Int8, + created_at -> Timestamp, + updated_at -> Timestamp, + } +} diff --git a/test/simple_table_sqlite/test.sh b/test/simple_table_sqlite/test.sh new file mode 100755 index 00000000..43259a4e --- /dev/null +++ b/test/simple_table_sqlite/test.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +cd $SCRIPT_DIR + +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" From b476ae243897cbcab303d0318c6a041a8b813e75 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Thu, 2 Nov 2023 18:49:06 +0100 Subject: [PATCH 02/11] test: change "custom_model_and_schema_path" to be compile-able --- Cargo.lock | 10 ++++++++++ Cargo.toml | 1 + test/custom_model_and_schema_path/Cargo.toml | 16 ++++++++++++++++ test/custom_model_and_schema_path/data/mod.rs | 2 ++ .../data/models/mod.rs | 2 +- test/custom_model_and_schema_path/lib.rs | 6 ++++++ test/custom_model_and_schema_path/test.sh | 3 ++- 7 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 test/custom_model_and_schema_path/Cargo.toml create mode 100644 test/custom_model_and_schema_path/data/mod.rs create mode 100644 test/custom_model_and_schema_path/lib.rs diff --git a/Cargo.lock b/Cargo.lock index a1db464e..0567df46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -187,6 +187,16 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "custom_model_and_schema_path" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "serde", +] + [[package]] name = "deranged" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index b85bd085..7f5e518c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,5 +54,6 @@ members = [ "test/simple_table_pg", "test/simple_table_mysql", "test/simple_table_sqlite", + "test/custom_model_and_schema_path", ] resolver = "2" diff --git a/test/custom_model_and_schema_path/Cargo.toml b/test/custom_model_and_schema_path/Cargo.toml new file mode 100644 index 00000000..403367d6 --- /dev/null +++ b/test/custom_model_and_schema_path/Cargo.toml @@ -0,0 +1,16 @@ +[lib] +path = "lib.rs" + +[package] +name = "custom_model_and_schema_path" +version = "0.1.0" +edition = "2021" + +[dependencies] +diesel = { version = "*", default-features = false, features = [ + "postgres", + "chrono", +] } +dsync = { path = "../../" } +chrono = { version = "*", features = ["serde"] } +serde = { version = "*", features = ["derive"] } diff --git a/test/custom_model_and_schema_path/data/mod.rs b/test/custom_model_and_schema_path/data/mod.rs new file mode 100644 index 00000000..d5cbad7e --- /dev/null +++ b/test/custom_model_and_schema_path/data/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod schema; diff --git a/test/custom_model_and_schema_path/data/models/mod.rs b/test/custom_model_and_schema_path/data/models/mod.rs index 9379294b..99661ae2 100644 --- a/test/custom_model_and_schema_path/data/models/mod.rs +++ b/test/custom_model_and_schema_path/data/models/mod.rs @@ -1,2 +1,2 @@ pub mod table_a; -pub mod table_b; \ No newline at end of file +pub mod table_b; diff --git a/test/custom_model_and_schema_path/lib.rs b/test/custom_model_and_schema_path/lib.rs new file mode 100644 index 00000000..73157bb2 --- /dev/null +++ b/test/custom_model_and_schema_path/lib.rs @@ -0,0 +1,6 @@ +#![allow(non_snake_case)] +pub mod data; + +pub mod diesel { + pub use diesel::*; +} diff --git a/test/custom_model_and_schema_path/test.sh b/test/custom_model_and_schema_path/test.sh index 3dab2963..a3286282 100755 --- a/test/custom_model_and_schema_path/test.sh +++ b/test/custom_model_and_schema_path/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i data/schema.rs -o data/models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --schema-path "crate::data::schema::" --model-path "crate::data::models::" +cargo run --manifest-path ../../Cargo.toml -- \ +-i data/schema.rs -o data/models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --schema-path "crate::data::schema::" --model-path "crate::data::models::" From 21d92c13ab223f7450c3ed951026377c871db527 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Thu, 2 Nov 2023 18:51:49 +0100 Subject: [PATCH 03/11] test: change "single_model_file" to be compile-able --- Cargo.lock | 10 ++++++++++ Cargo.toml | 1 + test/single_model_file/Cargo.toml | 16 ++++++++++++++++ test/single_model_file/lib.rs | 6 ++++++ test/single_model_file/test.sh | 3 ++- 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/single_model_file/Cargo.toml create mode 100644 test/single_model_file/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 0567df46..ae2fef31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -571,6 +571,16 @@ dependencies = [ "serde", ] +[[package]] +name = "single_model_file" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "serde", +] + [[package]] name = "smallvec" version = "1.11.1" diff --git a/Cargo.toml b/Cargo.toml index 7f5e518c..37c8c295 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,5 +55,6 @@ members = [ "test/simple_table_mysql", "test/simple_table_sqlite", "test/custom_model_and_schema_path", + "test/single_model_file", ] resolver = "2" diff --git a/test/single_model_file/Cargo.toml b/test/single_model_file/Cargo.toml new file mode 100644 index 00000000..85c86728 --- /dev/null +++ b/test/single_model_file/Cargo.toml @@ -0,0 +1,16 @@ +[lib] +path = "lib.rs" + +[package] +name = "single_model_file" +version = "0.1.0" +edition = "2021" + +[dependencies] +diesel = { version = "*", default-features = false, features = [ + "postgres", + "chrono", +] } +dsync = { path = "../../" } +chrono = { version = "*", features = ["serde"] } +serde = { version = "*", features = ["derive"] } diff --git a/test/single_model_file/lib.rs b/test/single_model_file/lib.rs new file mode 100644 index 00000000..fdea3f51 --- /dev/null +++ b/test/single_model_file/lib.rs @@ -0,0 +1,6 @@ +pub mod models; +pub mod schema; + +pub mod diesel { + pub use diesel::*; +} diff --git a/test/single_model_file/test.sh b/test/single_model_file/test.sh index aaf327ad..3c53ff7d 100755 --- a/test/single_model_file/test.sh +++ b/test/single_model_file/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --single-model-file +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --single-model-file From 385650b4c3cb4b5bdb7db0253b8ce6b2deec129d Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 2 Jan 2024 17:00:54 +0100 Subject: [PATCH 04/11] chore(test): move test workspace to separate file this will break some tooling at the moment (like rust-analyzer for vscode) or top-level cargo build and requires them to be execute in the new "root" --- Cargo.lock | 538 +--------- Cargo.toml | 11 - test/Cargo.lock | 918 ++++++++++++++++++ test/Cargo.toml | 10 + test/advanced_queries/test.sh | 3 +- test/autogenerated_all/test.sh | 3 +- test/autogenerated_attributes/test.sh | 3 +- test/autogenerated_primary_keys/test.sh | 3 +- test/cleanup_generated_content/test.sh | 6 +- test/create_update_bytes_cow/test.sh | 3 +- test/create_update_bytes_slice/test.sh | 3 +- test/create_update_str_cow/test.sh | 3 +- test/create_update_str_str/test.sh | 3 +- test/custom_model_path/test.sh | 3 +- test/manual_primary_keys/test.sh | 3 +- test/multiple_primary_keys/test.sh | 3 +- test/no_default_features/test.sh | 3 +- test/once_common_structs/test.sh | 3 +- .../test.sh | 3 +- .../test.sh | 3 +- test/once_connection_type/test.sh | 3 +- test/postgres_array_column/test.sh | 3 +- test/readonly/test.sh | 3 +- test/simple_table_async/test.sh | 3 +- test/simple_table_custom_schema_path/test.sh | 3 +- test/simple_table_no_crud/test.sh | 3 +- test/simple_table_no_serde/test.sh | 3 +- test/test_all.sh | 5 +- test/use_statements/test.sh | 3 +- 29 files changed, 982 insertions(+), 575 deletions(-) create mode 100644 test/Cargo.lock create mode 100644 test/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index ae2fef31..0dd4197c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anstream" version = "0.6.4" @@ -65,66 +50,12 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-targets", -] - [[package]] name = "clap" version = "4.4.6" @@ -181,72 +112,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "custom_model_and_schema_path" -version = "0.1.0" -dependencies = [ - "chrono", - "diesel", - "dsync", - "serde", -] - -[[package]] -name = "deranged" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "diesel" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2268a214a6f118fce1838edba3d1561cf0e78d8de785475957a580a7f8c69d33" -dependencies = [ - "bitflags 2.4.0", - "byteorder", - "chrono", - "diesel_derives", - "itoa", - "libsqlite3-sys", - "mysqlclient-sys", - "percent-encoding", - "pq-sys", - "r2d2", - "time", - "url", -] - -[[package]] -name = "diesel_derives" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8337737574f55a468005a83499da720f20c65586241ffea339db9ecdfd2b44" -dependencies = [ - "diesel_table_macro_syntax", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "diesel_table_macro_syntax" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" -dependencies = [ - "syn", -] - [[package]] name = "dsync" version = "0.0.17-beta" @@ -270,188 +135,30 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "form_urlencoded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" -dependencies = [ - "percent-encoding", -] - [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "iana-time-zone" -version = "0.1.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "indoc" version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "js-sys" -version = "0.3.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "libc" version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" -[[package]] -name = "libsqlite3-sys" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" -dependencies = [ - "pkg-config", - "vcpkg", -] - [[package]] name = "linux-raw-sys" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "mysqlclient-sys" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61b381528ba293005c42a409dd73d034508e273bf90481f17ec2e964a6e969b" -dependencies = [ - "pkg-config", - "vcpkg", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - -[[package]] -name = "percent-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" - -[[package]] -name = "pkg-config" -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 = "pq-sys" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0052426df997c0cbd30789eb44ca097e3541717a7b8fa36b1c464ee7edebd" -dependencies = [ - "vcpkg", -] - [[package]] name = "proc-macro2" version = "1.0.69" @@ -470,123 +177,19 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "r2d2" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" -dependencies = [ - "log", - "parking_lot", - "scheduled-thread-pool", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "rustix" version = "0.38.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a74ee2d7c2581cd139b42447d7d9389b889bdaad3a73f1ebb16f2a3237bb19c" dependencies = [ - "bitflags 2.4.0", + "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys", ] -[[package]] -name = "scheduled-thread-pool" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "serde" -version = "1.0.190" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.190" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "simple_table_mysql" -version = "0.1.0" -dependencies = [ - "chrono", - "diesel", - "dsync", - "r2d2", - "serde", -] - -[[package]] -name = "simple_table_pg" -version = "0.1.0" -dependencies = [ - "chrono", - "diesel", - "dsync", - "r2d2", - "serde", -] - -[[package]] -name = "simple_table_sqlite" -version = "0.1.0" -dependencies = [ - "chrono", - "diesel", - "dsync", - "r2d2", - "serde", -] - -[[package]] -name = "single_model_file" -version = "0.1.0" -dependencies = [ - "chrono", - "diesel", - "dsync", - "serde", -] - -[[package]] -name = "smallvec" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" - [[package]] name = "strsim" version = "0.10.0" @@ -634,157 +237,18 @@ dependencies = [ "syn", ] -[[package]] -name = "time" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" -dependencies = [ - "deranged", - "itoa", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" -dependencies = [ - "time-core", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "url" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "wasm-bindgen" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" - -[[package]] -name = "windows-core" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index 37c8c295..d7719beb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,14 +47,3 @@ path = "src/lib.rs" name = "dsync" test = false path = "src/bin/main.rs" - -[workspace] -# only some tests are currently compile-able -members = [ - "test/simple_table_pg", - "test/simple_table_mysql", - "test/simple_table_sqlite", - "test/custom_model_and_schema_path", - "test/single_model_file", -] -resolver = "2" diff --git a/test/Cargo.lock b/test/Cargo.lock new file mode 100644 index 00000000..2d2021b1 --- /dev/null +++ b/test/Cargo.lock @@ -0,0 +1,918 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-targets 0.48.5", +] + +[[package]] +name = "clap" +version = "4.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", + "terminal_size", +] + +[[package]] +name = "clap_complete" +version = "4.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a51919c5608a32e34ea1d6be321ad070065e17613e168c5b6977024290f2630b" +dependencies = [ + "clap", +] + +[[package]] +name = "clap_derive" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "custom_model_and_schema_path" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "serde", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "diesel" +version = "2.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62c6fcf842f17f8c78ecf7c81d75c5ce84436b41ee07e03f490fbb5f5a8731d8" +dependencies = [ + "bitflags 2.4.1", + "byteorder", + "chrono", + "diesel_derives", + "itoa", + "libsqlite3-sys", + "mysqlclient-sys", + "percent-encoding", + "pq-sys", + "r2d2", + "time", + "url", +] + +[[package]] +name = "diesel_derives" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8337737574f55a468005a83499da720f20c65586241ffea339db9ecdfd2b44" +dependencies = [ + "diesel_table_macro_syntax", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diesel_table_macro_syntax" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" +dependencies = [ + "syn", +] + +[[package]] +name = "dsync" +version = "0.0.17-beta" +dependencies = [ + "clap", + "clap_complete", + "heck", + "indoc", + "proc-macro2", + "syn", + "thiserror", +] + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "iana-time-zone" +version = "0.1.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indoc" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "js-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" + +[[package]] +name = "libsqlite3-sys" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +dependencies = [ + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "mysqlclient-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f61b381528ba293005c42a409dd73d034508e273bf90481f17ec2e964a6e969b" +dependencies = [ + "pkg-config", + "vcpkg", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pkg-config" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "pq-sys" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c0052426df997c0cbd30789eb44ca097e3541717a7b8fa36b1c464ee7edebd" +dependencies = [ + "vcpkg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r2d2" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" +dependencies = [ + "log", + "parking_lot", + "scheduled-thread-pool", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "rustix" +version = "0.38.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "scheduled-thread-pool" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" +dependencies = [ + "parking_lot", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.194" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.194" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "simple_table_mysql" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "r2d2", + "serde", +] + +[[package]] +name = "simple_table_pg" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "r2d2", + "serde", +] + +[[package]] +name = "simple_table_sqlite" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "r2d2", + "serde", +] + +[[package]] +name = "single_model_file" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "dsync", + "serde", +] + +[[package]] +name = "smallvec" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "2.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "thiserror" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "unicode-bidi" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "wasm-bindgen" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/test/Cargo.toml b/test/Cargo.toml new file mode 100644 index 00000000..abe7f15d --- /dev/null +++ b/test/Cargo.toml @@ -0,0 +1,10 @@ +[workspace] +# only some tests are currently compile-able +members = [ + "simple_table_pg", + "simple_table_mysql", + "simple_table_sqlite", + "custom_model_and_schema_path", + "single_model_file", +] +resolver = "2" diff --git a/test/advanced_queries/test.sh b/test/advanced_queries/test.sh index b843c869..4d7e0e41 100755 --- a/test/advanced_queries/test.sh +++ b/test/advanced_queries/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -F advanced-queries -- --diesel-backend diesel::pg::Pg -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file +cargo run -F advanced-queries --manifest-path ../../Cargo.toml -- \ +--diesel-backend diesel::pg::Pg -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" diff --git a/test/autogenerated_all/test.sh b/test/autogenerated_all/test.sh index 4602f622..959ccfec 100755 --- a/test/autogenerated_all/test.sh +++ b/test/autogenerated_all/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file diff --git a/test/autogenerated_attributes/test.sh b/test/autogenerated_attributes/test.sh index af773253..848165e7 100755 --- a/test/autogenerated_attributes/test.sh +++ b/test/autogenerated_attributes/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g created_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g created_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file diff --git a/test/autogenerated_primary_keys/test.sh b/test/autogenerated_primary_keys/test.sh index f9be906a..96babe61 100755 --- a/test/autogenerated_primary_keys/test.sh +++ b/test/autogenerated_primary_keys/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -c "diesel::r2d2::PooledConnection>" +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -c "diesel::r2d2::PooledConnection>" diff --git a/test/cleanup_generated_content/test.sh b/test/cleanup_generated_content/test.sh index a8099e7d..76367701 100755 --- a/test/cleanup_generated_content/test.sh +++ b/test/cleanup_generated_content/test.sh @@ -4,5 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema1.rs -o models -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" -cargo run -- -i schema2.rs -o models -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema1.rs -o models -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema2.rs -o models -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file diff --git a/test/create_update_bytes_cow/test.sh b/test/create_update_bytes_cow/test.sh index ab894ead..7fca70ca 100755 --- a/test/create_update_bytes_cow/test.sh +++ b/test/create_update_bytes_cow/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --create-bytes=cow --update-bytes=cow +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --create-bytes=cow --update-bytes=cow diff --git a/test/create_update_bytes_slice/test.sh b/test/create_update_bytes_slice/test.sh index 97f5688d..88fe027f 100755 --- a/test/create_update_bytes_slice/test.sh +++ b/test/create_update_bytes_slice/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --create-bytes=slice --update-bytes=slice +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --create-bytes=slice --update-bytes=slice diff --git a/test/create_update_str_cow/test.sh b/test/create_update_str_cow/test.sh index 73ab95ec..f08db665 100755 --- a/test/create_update_str_cow/test.sh +++ b/test/create_update_str_cow/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --create-str=cow --update-str=cow +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --create-str=cow --update-str=cow diff --git a/test/create_update_str_str/test.sh b/test/create_update_str_str/test.sh index e10fe55e..a42444ff 100755 --- a/test/create_update_str_str/test.sh +++ b/test/create_update_str_str/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --create-str=str --update-str=str +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --create-str=str --update-str=str diff --git a/test/custom_model_path/test.sh b/test/custom_model_path/test.sh index 762ee789..5625d17c 100755 --- a/test/custom_model_path/test.sh +++ b/test/custom_model_path/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --model-path "crate::data::models::" +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --model-path "crate::data::models::" diff --git a/test/manual_primary_keys/test.sh b/test/manual_primary_keys/test.sh index d49cdd23..87b5d7e8 100755 --- a/test/manual_primary_keys/test.sh +++ b/test/manual_primary_keys/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -c "diesel::r2d2::PooledConnection>" \ No newline at end of file +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -c "diesel::r2d2::PooledConnection>" \ No newline at end of file diff --git a/test/multiple_primary_keys/test.sh b/test/multiple_primary_keys/test.sh index d49cdd23..87b5d7e8 100755 --- a/test/multiple_primary_keys/test.sh +++ b/test/multiple_primary_keys/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -c "diesel::r2d2::PooledConnection>" \ No newline at end of file +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -c "diesel::r2d2::PooledConnection>" \ No newline at end of file diff --git a/test/no_default_features/test.sh b/test/no_default_features/test.sh index 2f9f0cde..5f5198e0 100755 --- a/test/no_default_features/test.sh +++ b/test/no_default_features/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run --no-default-features -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" +cargo run --no-default-features --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" diff --git a/test/once_common_structs/test.sh b/test/once_common_structs/test.sh index c98e9917..030a44eb 100755 --- a/test/once_common_structs/test.sh +++ b/test/once_common_structs/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --once-common-structs +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --once-common-structs diff --git a/test/once_common_structs_once_connection_type/test.sh b/test/once_common_structs_once_connection_type/test.sh index d18bbc68..01cdd7fd 100755 --- a/test/once_common_structs_once_connection_type/test.sh +++ b/test/once_common_structs_once_connection_type/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --once-common-structs --once-connection-type +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --once-common-structs --once-connection-type diff --git a/test/once_common_structs_once_connection_type_single_file/test.sh b/test/once_common_structs_once_connection_type_single_file/test.sh index 95a120b9..44d44510 100755 --- a/test/once_common_structs_once_connection_type_single_file/test.sh +++ b/test/once_common_structs_once_connection_type_single_file/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --once-common-structs --once-connection-type --single-model-file +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --once-common-structs --once-connection-type --single-model-file diff --git a/test/once_connection_type/test.sh b/test/once_connection_type/test.sh index 44b42841..630b8384 100755 --- a/test/once_connection_type/test.sh +++ b/test/once_connection_type/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --once-connection-type +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --once-connection-type diff --git a/test/postgres_array_column/test.sh b/test/postgres_array_column/test.sh index 9f7f0d51..7af45024 100755 --- a/test/postgres_array_column/test.sh +++ b/test/postgres_array_column/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" diff --git a/test/readonly/test.sh b/test/readonly/test.sh index 895965f2..5fb29f43 100755 --- a/test/readonly/test.sh +++ b/test/readonly/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --readonly-prefix prefix --readonly-suffix Suffix +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --readonly-prefix prefix --readonly-suffix Suffix diff --git a/test/simple_table_async/test.sh b/test/simple_table_async/test.sh index 220d311e..73e15b56 100755 --- a/test/simple_table_async/test.sh +++ b/test/simple_table_async/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run --features async -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel_async::pooled_connection::deadpool::Object" --async \ No newline at end of file +cargo run --features async --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel_async::pooled_connection::deadpool::Object" --async diff --git a/test/simple_table_custom_schema_path/test.sh b/test/simple_table_custom_schema_path/test.sh index 2c1cd11e..63d57bb4 100755 --- a/test/simple_table_custom_schema_path/test.sh +++ b/test/simple_table_custom_schema_path/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i data/schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --schema-path "crate::data::schema::" +cargo run --manifest-path ../../Cargo.toml -- \ +-i data/schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --schema-path "crate::data::schema::" diff --git a/test/simple_table_no_crud/test.sh b/test/simple_table_no_crud/test.sh index a450db07..95f57870 100755 --- a/test/simple_table_no_crud/test.sh +++ b/test/simple_table_no_crud/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --no-crud +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --no-crud diff --git a/test/simple_table_no_serde/test.sh b/test/simple_table_no_serde/test.sh index b1b94b9f..29ea2824 100755 --- a/test/simple_table_no_serde/test.sh +++ b/test/simple_table_no_serde/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --no-serde +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --no-serde diff --git a/test/test_all.sh b/test/test_all.sh index 21a8029b..40780efd 100755 --- a/test/test_all.sh +++ b/test/test_all.sh @@ -7,8 +7,9 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -for D in *; do - if [ -d "${D}" ]; then +for D in *; do + # ignore the test's "target" directory + if [ -d "${D}" ] && [ "${D}" != "target" ]; then echo "Testing $D" ${D}/test.sh # output separator diff --git a/test/use_statements/test.sh b/test/use_statements/test.sh index d49cdd23..87b5d7e8 100755 --- a/test/use_statements/test.sh +++ b/test/use_statements/test.sh @@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -c "diesel::r2d2::PooledConnection>" \ No newline at end of file +cargo run --manifest-path ../../Cargo.toml -- \ +-i schema.rs -o models -c "diesel::r2d2::PooledConnection>" \ No newline at end of file From b344c9e6b9e9248283b7f9b51d851a2e93156dff Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 2 Jan 2024 17:05:22 +0100 Subject: [PATCH 05/11] chore(test): use workspace dependency version for shared dependencies also remove "dsync" dependency, because it has no effect there (and only increases the test's target directory) --- test/Cargo.lock | 223 ------------------- test/Cargo.toml | 4 + test/custom_model_and_schema_path/Cargo.toml | 5 +- test/simple_table_mysql/Cargo.toml | 5 +- test/simple_table_pg/Cargo.toml | 5 +- test/simple_table_sqlite/Cargo.toml | 5 +- test/single_model_file/Cargo.toml | 5 +- 7 files changed, 14 insertions(+), 238 deletions(-) diff --git a/test/Cargo.lock b/test/Cargo.lock index 2d2021b1..70e9777a 100644 --- a/test/Cargo.lock +++ b/test/Cargo.lock @@ -17,54 +17,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anstream" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" - -[[package]] -name = "anstyle-parse" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -125,62 +77,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "clap" -version = "4.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", - "terminal_size", -] - -[[package]] -name = "clap_complete" -version = "4.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a51919c5608a32e34ea1d6be321ad070065e17613e168c5b6977024290f2630b" -dependencies = [ - "clap", -] - -[[package]] -name = "clap_derive" -version = "4.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -193,7 +89,6 @@ version = "0.1.0" dependencies = [ "chrono", "diesel", - "dsync", "serde", ] @@ -247,29 +142,6 @@ dependencies = [ "syn", ] -[[package]] -name = "dsync" -version = "0.0.17-beta" -dependencies = [ - "clap", - "clap_complete", - "heck", - "indoc", - "proc-macro2", - "syn", - "thiserror", -] - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -279,12 +151,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "iana-time-zone" version = "0.1.59" @@ -318,12 +184,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "indoc" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" - [[package]] name = "itoa" version = "1.0.10" @@ -355,12 +215,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" - [[package]] name = "lock_api" version = "0.4.11" @@ -490,19 +344,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "rustix" -version = "0.38.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" -dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - [[package]] name = "scheduled-thread-pool" version = "0.2.7" @@ -544,7 +385,6 @@ version = "0.1.0" dependencies = [ "chrono", "diesel", - "dsync", "r2d2", "serde", ] @@ -555,7 +395,6 @@ version = "0.1.0" dependencies = [ "chrono", "diesel", - "dsync", "r2d2", "serde", ] @@ -566,7 +405,6 @@ version = "0.1.0" dependencies = [ "chrono", "diesel", - "dsync", "r2d2", "serde", ] @@ -577,7 +415,6 @@ version = "0.1.0" dependencies = [ "chrono", "diesel", - "dsync", "serde", ] @@ -587,12 +424,6 @@ version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "syn" version = "2.0.46" @@ -604,36 +435,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "terminal_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" -dependencies = [ - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "thiserror" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "time" version = "0.3.31" @@ -710,12 +511,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - [[package]] name = "vcpkg" version = "0.2.15" @@ -785,24 +580,6 @@ dependencies = [ "windows-targets 0.52.0", ] -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - [[package]] name = "windows-targets" version = "0.48.5" diff --git a/test/Cargo.toml b/test/Cargo.toml index abe7f15d..b3c43926 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -8,3 +8,7 @@ members = [ "single_model_file", ] resolver = "2" + +[workspace.dependencies] +chrono = { version = "*", features = ["serde"] } +serde = { version = "*", features = ["derive"] } diff --git a/test/custom_model_and_schema_path/Cargo.toml b/test/custom_model_and_schema_path/Cargo.toml index 403367d6..e15967cf 100644 --- a/test/custom_model_and_schema_path/Cargo.toml +++ b/test/custom_model_and_schema_path/Cargo.toml @@ -11,6 +11,5 @@ diesel = { version = "*", default-features = false, features = [ "postgres", "chrono", ] } -dsync = { path = "../../" } -chrono = { version = "*", features = ["serde"] } -serde = { version = "*", features = ["derive"] } +chrono.workspace = true +serde.workspace = true diff --git a/test/simple_table_mysql/Cargo.toml b/test/simple_table_mysql/Cargo.toml index 724d887f..80b4e9b2 100644 --- a/test/simple_table_mysql/Cargo.toml +++ b/test/simple_table_mysql/Cargo.toml @@ -13,6 +13,5 @@ diesel = { version = "*", default-features = false, features = [ "chrono", ] } r2d2 = "*" -dsync = { path = "../../" } -chrono = { version = "*", features = ["serde"] } -serde = { version = "*", features = ["derive"] } +chrono.workspace = true +serde.workspace = true diff --git a/test/simple_table_pg/Cargo.toml b/test/simple_table_pg/Cargo.toml index a4d258c0..10016c97 100644 --- a/test/simple_table_pg/Cargo.toml +++ b/test/simple_table_pg/Cargo.toml @@ -13,6 +13,5 @@ diesel = { version = "*", default-features = false, features = [ "chrono", ] } r2d2 = "*" -dsync = { path = "../../" } -chrono = { version = "*", features = ["serde"] } -serde = { version = "*", features = ["derive"] } +chrono.workspace = true +serde.workspace = true diff --git a/test/simple_table_sqlite/Cargo.toml b/test/simple_table_sqlite/Cargo.toml index b14735dc..992c8292 100644 --- a/test/simple_table_sqlite/Cargo.toml +++ b/test/simple_table_sqlite/Cargo.toml @@ -14,6 +14,5 @@ diesel = { version = "*", default-features = false, features = [ "returning_clauses_for_sqlite_3_35", ] } r2d2 = "*" -dsync = { path = "../../" } -chrono = { version = "*", features = ["serde"] } -serde = { version = "*", features = ["derive"] } +chrono.workspace = true +serde.workspace = true diff --git a/test/single_model_file/Cargo.toml b/test/single_model_file/Cargo.toml index 85c86728..8d213c01 100644 --- a/test/single_model_file/Cargo.toml +++ b/test/single_model_file/Cargo.toml @@ -11,6 +11,5 @@ diesel = { version = "*", default-features = false, features = [ "postgres", "chrono", ] } -dsync = { path = "../../" } -chrono = { version = "*", features = ["serde"] } -serde = { version = "*", features = ["derive"] } +chrono.workspace = true +serde.workspace = true From 75c64c1a6991548a8a8521f299f2df23ac04e966 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 2 Jan 2024 17:10:46 +0100 Subject: [PATCH 06/11] chore(test): rename "test_all" to "test_generate" and add "test_compile" --- test/test_compile.sh | 12 ++++++++++++ test/{test_all.sh => test_generate.sh} | 0 2 files changed, 12 insertions(+) create mode 100755 test/test_compile.sh rename test/{test_all.sh => test_generate.sh} (100%) diff --git a/test/test_compile.sh b/test/test_compile.sh new file mode 100755 index 00000000..a61ddcd3 --- /dev/null +++ b/test/test_compile.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# This script is to compile all compile-able tests to see if they are correct + +# fail on non-0 exit codes, which makes it more obvious if a test has failed +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +cd $SCRIPT_DIR + +cargo build --all diff --git a/test/test_all.sh b/test/test_generate.sh similarity index 100% rename from test/test_all.sh rename to test/test_generate.sh From cb01abe3ecd2c72bf8e44111a70a858b51701e86 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 2 Jan 2024 17:11:40 +0100 Subject: [PATCH 07/11] chore(test): add new "test_all" to execute all "test_*" files in order --- test/test_all.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 test/test_all.sh diff --git a/test/test_all.sh b/test/test_all.sh new file mode 100755 index 00000000..ece659d3 --- /dev/null +++ b/test/test_all.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# This script is to run "dsync" generation on all test-cases + +# fail on non-0 exit codes, which makes it more obvious if a test has failed +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +cd $SCRIPT_DIR + +echo "Testing Generation" +./test_generate.sh + +# extra separator +echo "" + +echo "Testing Compiliation" +./test_compile.sh From 0bf435d50eca1849eb38527137b99f051dd3ba6d Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 2 Jan 2024 17:25:01 +0100 Subject: [PATCH 08/11] chore(test): change "diesel::prelude::" to "diesel::TYPE::" for connection-types --- test/simple_table_mysql/test.sh | 2 +- test/simple_table_pg/models/todos/generated.rs | 2 +- test/simple_table_pg/test.sh | 2 +- test/simple_table_sqlite/models/todos/generated.rs | 2 +- test/simple_table_sqlite/test.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/simple_table_mysql/test.sh b/test/simple_table_mysql/test.sh index 9e2a1ab5..2e056cea 100755 --- a/test/simple_table_mysql/test.sh +++ b/test/simple_table_mysql/test.sh @@ -5,4 +5,4 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR cargo run --manifest-path ../../Cargo.toml -- \ --i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --no-crud +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" --no-crud diff --git a/test/simple_table_pg/models/todos/generated.rs b/test/simple_table_pg/models/todos/generated.rs index 166b38ab..2e777ec2 100644 --- a/test/simple_table_pg/models/todos/generated.rs +++ b/test/simple_table_pg/models/todos/generated.rs @@ -3,7 +3,7 @@ use crate::diesel::*; use crate::schema::*; -pub type ConnectionType = diesel::r2d2::PooledConnection>; +pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] diff --git a/test/simple_table_pg/test.sh b/test/simple_table_pg/test.sh index bd818028..7af45024 100755 --- a/test/simple_table_pg/test.sh +++ b/test/simple_table_pg/test.sh @@ -5,4 +5,4 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR cargo run --manifest-path ../../Cargo.toml -- \ --i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" diff --git a/test/simple_table_sqlite/models/todos/generated.rs b/test/simple_table_sqlite/models/todos/generated.rs index 1cd75bea..7d596a5f 100644 --- a/test/simple_table_sqlite/models/todos/generated.rs +++ b/test/simple_table_sqlite/models/todos/generated.rs @@ -3,7 +3,7 @@ use crate::diesel::*; use crate::schema::*; -pub type ConnectionType = diesel::r2d2::PooledConnection>; +pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] diff --git a/test/simple_table_sqlite/test.sh b/test/simple_table_sqlite/test.sh index 43259a4e..0953e7d7 100755 --- a/test/simple_table_sqlite/test.sh +++ b/test/simple_table_sqlite/test.sh @@ -5,4 +5,4 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR cargo run --manifest-path ../../Cargo.toml -- \ --i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" +-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" From 19eb3f89a2c0313a7b4515952ee80be4a7a08d42 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 2 Jan 2024 17:27:37 +0100 Subject: [PATCH 09/11] chore(test): change "r2d2" to also be a workspace dependency --- test/Cargo.toml | 1 + test/simple_table_mysql/Cargo.toml | 2 +- test/simple_table_pg/Cargo.toml | 2 +- test/simple_table_sqlite/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/Cargo.toml b/test/Cargo.toml index b3c43926..963d4059 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -12,3 +12,4 @@ resolver = "2" [workspace.dependencies] chrono = { version = "*", features = ["serde"] } serde = { version = "*", features = ["derive"] } +r2d2 = "*" diff --git a/test/simple_table_mysql/Cargo.toml b/test/simple_table_mysql/Cargo.toml index 80b4e9b2..1eeccd9a 100644 --- a/test/simple_table_mysql/Cargo.toml +++ b/test/simple_table_mysql/Cargo.toml @@ -12,6 +12,6 @@ diesel = { version = "*", default-features = false, features = [ "r2d2", "chrono", ] } -r2d2 = "*" +r2d2.workspace = true chrono.workspace = true serde.workspace = true diff --git a/test/simple_table_pg/Cargo.toml b/test/simple_table_pg/Cargo.toml index 10016c97..d3ed3cfb 100644 --- a/test/simple_table_pg/Cargo.toml +++ b/test/simple_table_pg/Cargo.toml @@ -12,6 +12,6 @@ diesel = { version = "*", default-features = false, features = [ "r2d2", "chrono", ] } -r2d2 = "*" +r2d2.workspace = true chrono.workspace = true serde.workspace = true diff --git a/test/simple_table_sqlite/Cargo.toml b/test/simple_table_sqlite/Cargo.toml index 992c8292..6f29b3cb 100644 --- a/test/simple_table_sqlite/Cargo.toml +++ b/test/simple_table_sqlite/Cargo.toml @@ -13,6 +13,6 @@ diesel = { version = "*", default-features = false, features = [ "chrono", "returning_clauses_for_sqlite_3_35", ] } -r2d2 = "*" +r2d2.workspace = true chrono.workspace = true serde.workspace = true From 82ddae514165c09aebdf4cb5d4b4c6f0d77a55e8 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 16 Jan 2024 14:34:28 +0100 Subject: [PATCH 10/11] test: change "advanced_queries" to be compile-able --- test/Cargo.lock | 10 ++++ test/Cargo.toml | 1 + test/advanced_queries/Cargo.toml | 17 +++++++ test/advanced_queries/lib.rs | 6 +++ .../models/todos/generated.rs | 50 +++++++++---------- test/advanced_queries/schema.rs | 6 +-- 6 files changed, 60 insertions(+), 30 deletions(-) create mode 100644 test/advanced_queries/Cargo.toml create mode 100644 test/advanced_queries/lib.rs diff --git a/test/Cargo.lock b/test/Cargo.lock index 70e9777a..033ab97f 100644 --- a/test/Cargo.lock +++ b/test/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "advanced_queries" +version = "0.1.0" +dependencies = [ + "chrono", + "diesel", + "r2d2", + "serde", +] + [[package]] name = "android-tzdata" version = "0.1.1" diff --git a/test/Cargo.toml b/test/Cargo.toml index 963d4059..b0ddb7c2 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -6,6 +6,7 @@ members = [ "simple_table_sqlite", "custom_model_and_schema_path", "single_model_file", + "advanced_queries", ] resolver = "2" diff --git a/test/advanced_queries/Cargo.toml b/test/advanced_queries/Cargo.toml new file mode 100644 index 00000000..7b61ac04 --- /dev/null +++ b/test/advanced_queries/Cargo.toml @@ -0,0 +1,17 @@ +[lib] +path = "lib.rs" + +[package] +name = "advanced_queries" +version = "0.1.0" +edition = "2021" + +[dependencies] +diesel = { version = "*", default-features = false, features = [ + "postgres", + "r2d2", + "chrono", +] } +r2d2.workspace = true +chrono.workspace = true +serde.workspace = true diff --git a/test/advanced_queries/lib.rs b/test/advanced_queries/lib.rs new file mode 100644 index 00000000..fdea3f51 --- /dev/null +++ b/test/advanced_queries/lib.rs @@ -0,0 +1,6 @@ +pub mod models; +pub mod schema; + +pub mod diesel { + pub use diesel::*; +} diff --git a/test/advanced_queries/models/todos/generated.rs b/test/advanced_queries/models/todos/generated.rs index 7341b7d3..a445d212 100644 --- a/test/advanced_queries/models/todos/generated.rs +++ b/test/advanced_queries/models/todos/generated.rs @@ -11,56 +11,56 @@ pub type ConnectionType = diesel::r2d2::PooledConnection, /// Field representing column `text` pub text: String, /// Field representing column `completed` pub completed: bool, /// Field representing column `type` pub type_: String, + /// Field representing column `smallint` + pub smallint: i16, + /// Field representing column `bigint` + pub bigint: i64, /// Field representing column `created_at` pub created_at: chrono::DateTime, /// Field representing column `updated_at` - pub updated_at: chrono::DateTime, + pub updated_at: chrono::NaiveDateTime, } /// Create Struct for a row in table `todos` for [`Todos`] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { - /// Field representing column `unsigned` - pub unsigned: u32, - /// Field representing column `unsigned_nullable` - pub unsigned_nullable: Option, /// Field representing column `text` pub text: String, /// Field representing column `completed` pub completed: bool, /// Field representing column `type` pub type_: String, + /// Field representing column `smallint` + pub smallint: i16, + /// Field representing column `bigint` + pub bigint: i64, } /// Update Struct for a row in table `todos` for [`Todos`] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { - /// Field representing column `unsigned` - pub unsigned: Option, - /// Field representing column `unsigned_nullable` - pub unsigned_nullable: Option>, /// Field representing column `text` pub text: Option, /// Field representing column `completed` pub completed: Option, /// Field representing column `type` pub type_: Option, + /// Field representing column `smallint` + pub smallint: Option, + /// Field representing column `bigint` + pub bigint: Option, /// Field representing column `created_at` pub created_at: Option>, /// Field representing column `updated_at` - pub updated_at: Option>, + pub updated_at: Option, } /// Result of a `.paginate` function @@ -134,16 +134,6 @@ impl Todos { if let Some(filter_id) = filter.id.clone() { query = query.filter(crate::schema::todos::id.eq(filter_id)); } - if let Some(filter_unsigned) = filter.unsigned.clone() { - query = query.filter(crate::schema::todos::unsigned.eq(filter_unsigned)); - } - if let Some(filter_unsigned_nullable) = filter.unsigned_nullable.clone() { - query = if filter_unsigned_nullable.is_some() { - query.filter(crate::schema::todos::unsigned_nullable.eq(filter_unsigned_nullable)) - } else { - query.filter(crate::schema::todos::unsigned_nullable.is_null()) - }; - } if let Some(filter_text) = filter.text.clone() { query = query.filter(crate::schema::todos::text.eq(filter_text)); } @@ -153,6 +143,12 @@ impl Todos { if let Some(filter_type_) = filter.type_.clone() { query = query.filter(crate::schema::todos::type_.eq(filter_type_)); } + if let Some(filter_smallint) = filter.smallint.clone() { + query = query.filter(crate::schema::todos::smallint.eq(filter_smallint)); + } + if let Some(filter_bigint) = filter.bigint.clone() { + query = query.filter(crate::schema::todos::bigint.eq(filter_bigint)); + } if let Some(filter_created_at) = filter.created_at.clone() { query = query.filter(crate::schema::todos::created_at.eq(filter_created_at)); } @@ -180,11 +176,11 @@ impl Todos { #[derive(Debug, Default, Clone)] pub struct TodosFilter { pub id: Option, - pub unsigned: Option, - pub unsigned_nullable: Option>, pub text: Option, pub completed: Option, pub type_: Option, + pub smallint: Option, + pub bigint: Option, pub created_at: Option>, - pub updated_at: Option>, + pub updated_at: Option, } diff --git a/test/advanced_queries/schema.rs b/test/advanced_queries/schema.rs index dc033baf..c66e8219 100644 --- a/test/advanced_queries/schema.rs +++ b/test/advanced_queries/schema.rs @@ -1,14 +1,14 @@ diesel::table! { todos (id) { id -> Int4, - unsigned -> Unsigned, - unsigned_nullable -> Nullable>, text -> Text, completed -> Bool, #[sql_name = "type"] #[max_length = 255] type_ -> Varchar, + smallint -> Int2, + bigint -> Int8, created_at -> Timestamptz, - updated_at -> Timestamptz, + updated_at -> Timestamp, } } From a44afdd08f4447e367aa47ecb91fae88b57f8944 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 16 Jan 2024 14:38:01 +0100 Subject: [PATCH 11/11] fix(code): remove ".clone" from "if let" statement fixes #130 --- src/code.rs | 4 ++-- test/advanced_queries/models/todos/generated.rs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/code.rs b/src/code.rs index 280bb35c..d6dc65f6 100644 --- a/src/code.rs +++ b/src/code.rs @@ -569,7 +569,7 @@ fn build_table_fns( // "Option::None" will never match anything, and "is_null" is required to be used, see https://docs.diesel.rs/master/diesel/expression_methods/trait.ExpressionMethods.html#method.eq format!( r##" - if let Some(filter_{column_name}) = filter.{column_name}.clone() {{ + if let Some(filter_{column_name}) = filter.{column_name} {{ query = if filter_{column_name}.is_some() {{ query.filter({schema_path}{table_name}::{column_name}.eq(filter_{column_name})) }} else {{ @@ -580,7 +580,7 @@ fn build_table_fns( } else { format!( r##" - if let Some(filter_{column_name}) = filter.{column_name}.clone() {{ + if let Some(filter_{column_name}) = filter.{column_name} {{ query = query.filter({schema_path}{table_name}::{column_name}.eq(filter_{column_name})); }}"## ) diff --git a/test/advanced_queries/models/todos/generated.rs b/test/advanced_queries/models/todos/generated.rs index a445d212..cd2c9c80 100644 --- a/test/advanced_queries/models/todos/generated.rs +++ b/test/advanced_queries/models/todos/generated.rs @@ -131,28 +131,28 @@ impl Todos { ) -> crate::schema::todos::BoxedQuery<'a, diesel::pg::Pg> { let mut query = crate::schema::todos::table.into_boxed(); - if let Some(filter_id) = filter.id.clone() { + if let Some(filter_id) = filter.id { query = query.filter(crate::schema::todos::id.eq(filter_id)); } - if let Some(filter_text) = filter.text.clone() { + if let Some(filter_text) = filter.text { query = query.filter(crate::schema::todos::text.eq(filter_text)); } - if let Some(filter_completed) = filter.completed.clone() { + if let Some(filter_completed) = filter.completed { query = query.filter(crate::schema::todos::completed.eq(filter_completed)); } - if let Some(filter_type_) = filter.type_.clone() { + if let Some(filter_type_) = filter.type_ { query = query.filter(crate::schema::todos::type_.eq(filter_type_)); } - if let Some(filter_smallint) = filter.smallint.clone() { + if let Some(filter_smallint) = filter.smallint { query = query.filter(crate::schema::todos::smallint.eq(filter_smallint)); } - if let Some(filter_bigint) = filter.bigint.clone() { + if let Some(filter_bigint) = filter.bigint { query = query.filter(crate::schema::todos::bigint.eq(filter_bigint)); } - if let Some(filter_created_at) = filter.created_at.clone() { + if let Some(filter_created_at) = filter.created_at { query = query.filter(crate::schema::todos::created_at.eq(filter_created_at)); } - if let Some(filter_updated_at) = filter.updated_at.clone() { + if let Some(filter_updated_at) = filter.updated_at { query = query.filter(crate::schema::todos::updated_at.eq(filter_updated_at)); }