diff --git a/Cargo.lock b/Cargo.lock index 2a08b84..1606594 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" - [[package]] name = "addr2line" version = "0.21.0" @@ -45,21 +39,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "aho-corasick" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" -dependencies = [ - "memchr", -] - -[[package]] -name = "aliasable" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" - [[package]] name = "allocator-api2" version = "0.2.16" @@ -144,152 +123,6 @@ dependencies = [ "wait-timeout", ] -[[package]] -name = "async-attributes" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "async-channel" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" -dependencies = [ - "async-lock", - "async-task", - "concurrent-queue", - "fastrand 1.9.0", - "futures-lite", - "slab", -] - -[[package]] -name = "async-global-executor" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" -dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-lock", - "blocking", - "futures-lite", - "once_cell", - "tokio", -] - -[[package]] -name = "async-io" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" -dependencies = [ - "async-lock", - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-lite", - "log", - "parking", - "polling", - "rustix 0.37.23", - "slab", - "socket2 0.4.9", - "waker-fn", -] - -[[package]] -name = "async-lock" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-std" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" -dependencies = [ - "async-attributes", - "async-channel", - "async-global-executor", - "async-io", - "async-lock", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "once_cell", - "pin-project-lite", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.29", -] - -[[package]] -name = "async-task" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" - -[[package]] -name = "async-trait" -version = "0.1.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.29", -] - [[package]] name = "atoi" version = "1.0.0" @@ -299,12 +132,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "atomic-waker" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" - [[package]] name = "autocfg" version = "1.1.0" @@ -326,19 +153,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "bae" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b8de67cc41132507eeece2584804efcb15f85ba516e34c944b7667f480397a" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "base64" version = "0.21.3" @@ -366,21 +180,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "blocking" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" -dependencies = [ - "async-channel", - "async-lock", - "async-task", - "atomic-waker", - "fastrand 1.9.0", - "futures-lite", - "log", -] - [[package]] name = "bstr" version = "1.6.0" @@ -388,7 +187,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", - "regex-automata 0.3.7", + "regex-automata", "serde", ] @@ -440,20 +239,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "bitflags 1.3.2", - "clap_derive 3.2.25", - "clap_lex 0.2.4", - "indexmap", - "once_cell", - "textwrap", -] - [[package]] name = "clap" version = "4.4.0" @@ -461,7 +246,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" dependencies = [ "clap_builder", - "clap_derive 4.4.0", + "clap_derive", "once_cell", ] @@ -473,44 +258,22 @@ checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" dependencies = [ "anstream", "anstyle", - "clap_lex 0.5.1", + "clap_lex", "strsim", ] -[[package]] -name = "clap_derive" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" -dependencies = [ - "heck 0.4.1", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "clap_derive" version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "syn 2.0.29", ] -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - [[package]] name = "clap_lex" version = "0.5.1" @@ -523,15 +286,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" -[[package]] -name = "concurrent-queue" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "console" version = "0.15.7" @@ -782,20 +536,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "futures" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" version = "0.3.28" @@ -840,21 +580,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" -[[package]] -name = "futures-lite" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand 1.9.0", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-sink" version = "0.3.28" @@ -873,7 +598,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ - "futures-channel", "futures-core", "futures-io", "futures-sink", @@ -920,18 +644,6 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -957,15 +669,6 @@ dependencies = [ "hashbrown 0.14.0", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.4.1" @@ -1098,17 +801,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "itertools" version = "0.10.5" @@ -1133,15 +825,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -1188,12 +871,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.5" @@ -1215,9 +892,6 @@ name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -dependencies = [ - "value-bag", -] [[package]] name = "match_cfg" @@ -1225,29 +899,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "migration" -version = "0.1.0" -dependencies = [ - "async-std", - "sea-orm-migration", -] - [[package]] name = "mime" version = "0.3.17" @@ -1398,41 +1055,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" -[[package]] -name = "os_str_bytes" -version = "6.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" - -[[package]] -name = "ouroboros" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db" -dependencies = [ - "aliasable", - "ouroboros_macro", -] - -[[package]] -name = "ouroboros_macro" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" -dependencies = [ - "Inflector", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "parking" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" - [[package]] name = "parking_lot" version = "0.11.2" @@ -1508,22 +1130,6 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" -[[package]] -name = "polling" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" -dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if", - "concurrent-queue", - "libc", - "log", - "pin-project-lite", - "windows-sys 0.48.0", -] - [[package]] name = "portable-atomic" version = "1.4.3" @@ -1564,30 +1170,6 @@ dependencies = [ "termtree", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.66" @@ -1671,49 +1253,11 @@ dependencies = [ "thiserror", ] -[[package]] -name = "regex" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.3.7", - "regex-syntax 0.7.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - [[package]] name = "regex-automata" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.7.5", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rustc-demangle" @@ -1721,20 +1265,6 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustix" -version = "0.37.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - [[package]] name = "rustix" version = "0.38.9" @@ -1744,16 +1274,10 @@ dependencies = [ "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys 0.4.5", + "linux-raw-sys", "windows-sys 0.48.0", ] -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - [[package]] name = "schannel" version = "0.1.22" @@ -1769,139 +1293,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sea-orm" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fade86e8d41fd1a4721f84cb834f4ca2783f973cc30e6212b7fafc134f169214" -dependencies = [ - "async-stream", - "async-trait", - "futures", - "log", - "ouroboros", - "sea-orm-macros", - "sea-query", - "sea-strum", - "serde", - "thiserror", - "tracing", - "url", -] - -[[package]] -name = "sea-orm-cli" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbf34a2caf70c2e3be9bb1e674e9540f6dfd7c8f40f6f05daf3b9740e476005" -dependencies = [ - "chrono", - "clap 3.2.25", - "dotenvy", - "regex", - "sea-schema", - "tracing", - "tracing-subscriber", - "url", -] - -[[package]] -name = "sea-orm-macros" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28936f26d62234ff0be16f80115dbdeb3237fe9c25cf18fbcd1e3b3592360f20" -dependencies = [ - "bae", - "heck 0.3.3", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "sea-orm-migration" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "278d3adfd0832b6ffc17d3cfbc574d3695a5c1b38814e0bc8ac238d33f3d87cf" -dependencies = [ - "async-trait", - "clap 3.2.25", - "dotenvy", - "futures", - "sea-orm", - "sea-orm-cli", - "sea-schema", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "sea-query" -version = "0.28.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbab99b8cd878ab7786157b7eb8df96333a6807cc6e45e8888c85b51534b401a" -dependencies = [ - "sea-query-derive", -] - -[[package]] -name = "sea-query-derive" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63f62030c60f3a691f5fe251713b4e220b306e50a71e1d6f9cce1f24bb781978" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "syn 1.0.109", - "thiserror", -] - -[[package]] -name = "sea-schema" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb2940bb5a10bc6cd05b450ce6cd3993e27fddd7eface2becb97fc5af3a040e" -dependencies = [ - "futures", - "sea-query", - "sea-schema-derive", -] - -[[package]] -name = "sea-schema-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56821b7076f5096b8f726e2791ad255a99c82498e08ec477a65a96c461ff1927" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "sea-strum" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391d06a6007842cfe79ac6f7f53911b76dfd69fc9a6769f1cf6569d12ce20e1b" -dependencies = [ - "sea-strum_macros", -] - -[[package]] -name = "sea-strum_macros" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b4397b825df6ccf1e98bcdabef3bbcfc47ff5853983467850eeab878384f21" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - [[package]] name = "security-framework" version = "2.9.2" @@ -1956,15 +1347,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - [[package]] name = "shell-words" version = "1.1.0" @@ -2087,7 +1469,7 @@ checksum = "9966e64ae989e7e575b19d7265cb79d7fc3cbbdf179835cb0d716f294c2049c9" dependencies = [ "dotenvy", "either", - "heck 0.4.1", + "heck", "once_cell", "proc-macro2", "quote", @@ -2157,7 +1539,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.0", "redox_syscall 0.3.5", - "rustix 0.38.9", + "rustix", "windows-sys 0.48.0", ] @@ -2167,12 +1549,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - [[package]] name = "thiserror" version = "1.0.47" @@ -2278,54 +1654,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.29", -] - -[[package]] -name = "tracing-core" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" -dependencies = [ - "matchers", - "once_cell", - "regex", - "sharded-slab", - "thread_local", - "tracing", - "tracing-core", -] - [[package]] name = "typenum" version = "1.16.0" @@ -2394,7 +1722,7 @@ version = "0.1.0" dependencies = [ "assert_cmd", "chrono", - "clap 4.4.0", + "clap", "console", "dialoguer", "dirs", @@ -2430,12 +1758,6 @@ dependencies = [ "syn 2.0.29", ] -[[package]] -name = "value-bag" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" - [[package]] name = "vcpkg" version = "0.2.15" @@ -2457,12 +1779,6 @@ dependencies = [ "libc", ] -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -2500,18 +1816,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -2541,16 +1845,6 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" -[[package]] -name = "web-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 72182d9..d2ad292 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,11 +18,7 @@ include_dir = "0.7.3" indicatif = "0.17.6" lazy_static = "1.4.0" lettre = "0.10.4" -# migration = {path = "migration"}# depends on your needs serde = {versio = "1.0.185", features = ["derive"]} sqlx = {version = "0.6.2", features = ["runtime-tokio-native-tls", "sqlite"]} tokio = {version = "1.20.0", features = ["macros"]} uuid = {version = "1.4.1", features = ["v4", "fast-rng", "macro-diagnostics"]} - -[workspace] -members = ["migration"] diff --git a/migration/Cargo.toml b/migration/Cargo.toml deleted file mode 100644 index 22cdf3e..0000000 --- a/migration/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "migration" -version = "0.1.0" -edition = "2021" -publish = false - -[lib] -name = "migration" -path = "src/lib.rs" - -[dependencies] -async-std = { version = "1", features = ["attributes", "tokio1"] } - -[dependencies.sea-orm-migration] -version = "0.11.0" -features = [ - # Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI. - # View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime. - # e.g. - # "runtime-tokio-rustls", # `ASYNC_RUNTIME` feature - # "sqlx-postgres", # `DATABASE_DRIVER` feature -] diff --git a/migration/README.md b/migration/README.md deleted file mode 100644 index b3ea53e..0000000 --- a/migration/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Running Migrator CLI - -- Generate a new migration file - ```sh - cargo run -- migrate generate MIGRATION_NAME - ``` -- Apply all pending migrations - ```sh - cargo run - ``` - ```sh - cargo run -- up - ``` -- Apply first 10 pending migrations - ```sh - cargo run -- up -n 10 - ``` -- Rollback last applied migrations - ```sh - cargo run -- down - ``` -- Rollback last 10 applied migrations - ```sh - cargo run -- down -n 10 - ``` -- Drop all tables from the database, then reapply all migrations - ```sh - cargo run -- fresh - ``` -- Rollback all applied migrations, then reapply all migrations - ```sh - cargo run -- refresh - ``` -- Rollback all applied migrations - ```sh - cargo run -- reset - ``` -- Check the status of all migrations - ```sh - cargo run -- status - ``` diff --git a/src/commands/gitignore.rs b/src/commands/gitignore.rs index 33f3956..a63e009 100644 --- a/src/commands/gitignore.rs +++ b/src/commands/gitignore.rs @@ -208,10 +208,8 @@ impl GitIgnoreCommands { if let Some(file_content) = file_path { let mut file = File::create(path).unwrap(); file.write_all(file_content.contents()).unwrap(); - } else { - } - } else { - } + } + } } } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index a0fc3ff..783561e 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -4,4 +4,3 @@ pub mod email; pub mod gitignore; pub mod readme; pub mod sms; -pub mod store; diff --git a/src/commands/store.rs b/src/commands/store.rs deleted file mode 100644 index 1518381..0000000 --- a/src/commands/store.rs +++ /dev/null @@ -1,55 +0,0 @@ -use crate::{database::StoreModel, style::PrintColoredText}; -use clap::{Args, Subcommand}; -use serde::{Deserialize, Serialize}; - -#[derive(Args, Debug, Serialize)] -pub struct StoreCommands { - /// sub commands - #[command(subcommand)] - pub subcommands: StoreSubCommand, -} - -#[derive(Debug, Subcommand, Serialize, Deserialize, Clone)] -pub enum StoreSubCommand { - /// list stored k-v pairs - List, - /// update value - Set { key: String, value: String }, - /// save new value - Add { key: String, value: String }, - /// remove value - Remove { key: String }, -} - -impl StoreCommands { - pub async fn parse(&self) { - match &self.subcommands { - StoreSubCommand::List => Self::list().await, - StoreSubCommand::Set { key, value } => Self::set(key, value), - StoreSubCommand::Remove { key } => Self::remove(key).await, - StoreSubCommand::Add { key, value } => Self::add(key, value).await, - } - } - - /* list all the stored k-v pairs */ - async fn list() { - let data = StoreModel::find().await; - //TODO: render this in human readable TUI - println!("{:#?}", data); - } - /*store the key value pair in the database after checking that the key does not exist, if the key exist prompt use to overwrite */ - async fn add(key: &str, value: &str) { - StoreModel::new(key, value).save().await.unwrap(); - let message = format!("{key} successfully stored"); - PrintColoredText::success(&message); - } - /* accept a key and update the value of the key */ - fn set(key: &str, value: &str) { - StoreModel::set(key, value); - } - - /// remove data - async fn remove(key: &str) { - StoreModel::remove(key).await; - } -} diff --git a/src/database.rs b/src/database.rs index f0311b2..bf1337d 100644 --- a/src/database.rs +++ b/src/database.rs @@ -1,15 +1,26 @@ -use std::collections::HashMap; +use std::{collections::HashMap, fmt::Display}; use chrono::Local; use serde::{Deserialize, Serialize}; -use sqlx::{migrate::MigrateDatabase, FromRow, Pool, Row, Sqlite, SqlitePool}; +use sqlx::{ + migrate::MigrateDatabase, sqlite::SqliteQueryResult, FromRow, Pool, Row, Sqlite, SqlitePool, +}; use uuid::Uuid; use crate::{style::PrintColoredText, DB_URL}; -pub struct Database; +pub struct Database(pub Vec); +impl std::fmt::Display for Database { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.iter().try_fold((), |_, data| write!(f, "{}", data)) + } +} #[allow(unused)] impl Database { + /* + initialize the database connection + this will create a new sqlite database in the OS home directory + */ pub async fn init() { if !Sqlite::database_exists(&DB_URL).await.unwrap_or(false) { match Sqlite::create_database(&DB_URL).await { @@ -28,20 +39,6 @@ impl Database { let db = SqlitePool::connect(&DB_URL).await.unwrap(); let _ = sqlx::query(store_create_table).execute(&db).await.unwrap(); let _ = sqlx::query(email_create_table).execute(&db).await.unwrap(); - - /* let result = sqlx::query("INSERT INTO store (id, key, value, date) VALUES (?,?,?,?)") - .bind("bobby") - .execute(&db) - .await - .unwrap(); - println!("Query result: {:?}", result); - let user_results = sqlx::query_as::<_, User>("SELECT id, name FROM users") - .fetch_all(&db) - .await - .unwrap(); - for user in user_results { - println!("[{}] name: {}", user.id, &user.name); - } */ } // return connection to the database; @@ -49,12 +46,10 @@ impl Database { SqlitePool::connect(&DB_URL).await.unwrap() } + // get the tables in the database pub async fn tables() -> HashMap { let db = Self::conn().await; - // tell us the available tables - let result = sqlx::query("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY NOT NULL, name VARCHAR(250) NOT NULL);").execute(&db).await.unwrap(); - println!("Create user table result: {:?}", result); - let result = sqlx::query( + let result: Vec = sqlx::query( "SELECT name FROM sqlite_schema WHERE type ='table' @@ -69,22 +64,15 @@ impl Database { let key = idx; let value = row.get::("name"); tables.insert(key, value.to_owned()); - // println!("[{}]: {:?}", idx, row.get::("name")); } tables } } -#[derive(Clone, FromRow, Debug)] -pub struct User { - pub id: i64, - pub name: String, -} - /// for deserializing data from the database #[derive(Clone, FromRow, Debug, Serialize, Deserialize)] -pub struct StoreModel { +pub struct Store { pub id: String, pub key: String, pub value: String, @@ -93,7 +81,7 @@ pub struct StoreModel { } /// auto generate the date and Id -impl Default for StoreModel { +impl Default for Store { fn default() -> Self { Self { id: Uuid::new_v4().to_string(), //6971184f-7ae0-4bbf-ab3c-5ff6712eb8f9 @@ -104,8 +92,17 @@ impl Default for StoreModel { } } } +impl Display for Store { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "\nKEY: {:30}\nVALUE: {}\nDATE ADDED: {}\nLAST UPDATED: {}\n", + self.key, self.value, self.date_added, self.last_updated + ) + } +} -impl StoreModel { +impl Store { /// create a new key-value pair pub fn new(key: &str, value: &str) -> Self { let data = Self { @@ -162,23 +159,43 @@ impl StoreModel { Ok(Self { ..self.clone() }) } - ///TODO: update the key - pub fn set(key: &str, value: &str) -> Self { - let data = Self { - key: key.to_string(), - value: value.to_string(), - ..Default::default() - }; - Self { ..data } + /// update the key value pair + pub async fn update(key: &str, value: &str) -> Result { + // see if the data exist + let exist = Self::try_exist(key).await; + if !exist { + PrintColoredText::error("the provided key does not exist or has been removed"); + return Err(()); + } + + let db = Database::conn().await; + let last_updated = Local::now().to_rfc2822(); + let data = + sqlx::query("UPDATE store SET value =?, last_updated =? WHERE key = ? RETURNING *") + .bind(value.clone()) + .bind(last_updated.clone()) + .bind(key.clone()) + .execute(&db) + .await + .unwrap(); + + Ok(data) } /// remove pub async fn remove(key: &str) { + let key_exists = Self::try_exist(key).await; + if !key_exists { + PrintColoredText::error("the provided key does not exist or has been removed"); + return; + } let db = Database::conn().await; - let _ = sqlx::query_as::<_, Self>("DELETE * FROM store WHERE key = ?") + let _ = sqlx::query_as::<_, Self>("DELETE FROM store WHERE key = ?") .bind(key) .fetch_all(&db) .await .unwrap(); + let message = format!("{key} removed successfully"); + PrintColoredText::success(&message); } } diff --git a/src/main.rs b/src/main.rs index 9ba746d..2ba3365 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,6 @@ use include_dir::{include_dir, Dir}; pub const SOURCE_DIR: Dir = include_dir!("src/templates"); lazy_static! { pub static ref DB_URL: std::string::String = { - // create the database in the home directory of the system //create "utils" directory in the home dir and / save files to $HOME/utils; let os_default_home_dir = dirs::home_dir().unwrap(); let db_path = format!( diff --git a/src/parser.rs b/src/parser.rs index 01de6ca..7b834e4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -5,13 +5,14 @@ use commands::{ }; use crate::{ - commands::{self, store::StoreCommands}, - + commands::{self}, + database::Store, style::PrintColoredText, }; +//acf #[derive(Parser)] -#[command(author, version, about, long_about = None)] +#[command(author, version, about ="Compilation of utility scripts for everyday use", long_about = None)] #[command(propagate_version = true)] pub struct Utils { #[command(subcommand)] @@ -22,10 +23,33 @@ impl Utils { pub async fn run() { let utils = Utils::parse(); match utils.command { - Commands::GitIgnore(git_ignore) => git_ignore.parse(), + Commands::Ignore(git_ignore) => git_ignore.parse(), Commands::Mailto(email) => email.parse(), Commands::Readme(readme) => readme.parse(), - Commands::Store(store) => store.parse().await, + Commands::Store { key, value } => { + // TODO: handle conflict + Store::new(&key, &value).save().await.unwrap(); + let message = format!("{key} successfully stored"); + PrintColoredText::success(&message); + } + Commands::List => { + let data = crate::database::Store::find().await; + if data.is_empty() { + PrintColoredText::error("no data found"); + return; + } + let data = crate::database::Database(data); + println!("{}", data); + } + Commands::Remove { key } => { + crate::database::Store::remove(&key).await; + } + Commands::Update { key, value } => { + let _ = crate::database::Store::update(&key, &value).await.ok(); + + let message = format!("{key} successfully updated"); + PrintColoredText::success(&message); + } _ => PrintColoredText::error("invalid command"), } } @@ -33,6 +57,16 @@ impl Utils { #[derive(Subcommand)] pub enum Commands { + /// list stored data + List, + /// remove remove stored data + Remove { key: String }, + /// store data as key value pair + Store { key: String, value: String }, + /// update data in the store + Update { key: String, value: String }, + /// include .gitignore in a git repo + Ignore(GitIgnoreCommands), /// download files, videos, etc Download(DownloadCommands), /// send email from the command line @@ -41,8 +75,4 @@ pub enum Commands { Readme(ReadmeCommands), ///send SMS to people from the command line Sms(SmsCommands), - /// include .gitignore in a git repo - GitIgnore(GitIgnoreCommands), - /// store data in the database - Store(StoreCommands), }