From 1ca11e70e86cb68281228f797a228ea6bbba3c16 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 9 Jul 2023 02:05:10 +0100 Subject: [PATCH] update sqlx dep to 0.7 --- .gitignore | 4 + ...eaadab903468b8e4fbd39e465f581c7189272.json | 12 + ...f01044647d95caf8efc61df7bf333b6a2149d.json | 12 + ...26c337a88f4e29ae3bb170c4b687208aba20d.json | 32 ++ ...f33214619f8aa3080bc27f88bd5b9212b8c0f.json | 12 + Cargo.lock | 471 ++++++++++++++++-- Cargo.toml | 2 +- basics/todo/Cargo.toml | 2 +- basics/todo/README.md | 13 +- basics/todo/sqlx-data.json | 63 --- databases/sqlite/Cargo.toml | 4 +- 11 files changed, 524 insertions(+), 103 deletions(-) create mode 100644 .sqlx/query-2f4086eab47b13298a107ed8c0feaadab903468b8e4fbd39e465f581c7189272.json create mode 100644 .sqlx/query-37443376215969e31bc6bc1ee00f01044647d95caf8efc61df7bf333b6a2149d.json create mode 100644 .sqlx/query-3a5b2a81088aa91ade3106165f926c337a88f4e29ae3bb170c4b687208aba20d.json create mode 100644 .sqlx/query-ab058898a8a1b13174d03c9972af33214619f8aa3080bc27f88bd5b9212b8c0f.json delete mode 100644 basics/todo/sqlx-data.json diff --git a/.gitignore b/.gitignore index 5c95bf4..459f4a5 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,7 @@ upload.png # file uploads /tmp + +# todo example database +todo.db +todo.db-* diff --git a/.sqlx/query-2f4086eab47b13298a107ed8c0feaadab903468b8e4fbd39e465f581c7189272.json b/.sqlx/query-2f4086eab47b13298a107ed8c0feaadab903468b8e4fbd39e465f581c7189272.json new file mode 100644 index 0000000..f81cc55 --- /dev/null +++ b/.sqlx/query-2f4086eab47b13298a107ed8c0feaadab903468b8e4fbd39e465f581c7189272.json @@ -0,0 +1,12 @@ +{ + "db_name": "SQLite", + "query": "\n DELETE FROM tasks\n WHERE id = $1\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 1 + }, + "nullable": [] + }, + "hash": "2f4086eab47b13298a107ed8c0feaadab903468b8e4fbd39e465f581c7189272" +} diff --git a/.sqlx/query-37443376215969e31bc6bc1ee00f01044647d95caf8efc61df7bf333b6a2149d.json b/.sqlx/query-37443376215969e31bc6bc1ee00f01044647d95caf8efc61df7bf333b6a2149d.json new file mode 100644 index 0000000..422b111 --- /dev/null +++ b/.sqlx/query-37443376215969e31bc6bc1ee00f01044647d95caf8efc61df7bf333b6a2149d.json @@ -0,0 +1,12 @@ +{ + "db_name": "SQLite", + "query": "\n UPDATE tasks\n SET completed = NOT completed\n WHERE id = $1\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 1 + }, + "nullable": [] + }, + "hash": "37443376215969e31bc6bc1ee00f01044647d95caf8efc61df7bf333b6a2149d" +} diff --git a/.sqlx/query-3a5b2a81088aa91ade3106165f926c337a88f4e29ae3bb170c4b687208aba20d.json b/.sqlx/query-3a5b2a81088aa91ade3106165f926c337a88f4e29ae3bb170c4b687208aba20d.json new file mode 100644 index 0000000..2782007 --- /dev/null +++ b/.sqlx/query-3a5b2a81088aa91ade3106165f926c337a88f4e29ae3bb170c4b687208aba20d.json @@ -0,0 +1,32 @@ +{ + "db_name": "SQLite", + "query": "\n SELECT *\n FROM tasks\n ", + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int64" + }, + { + "name": "description", + "ordinal": 1, + "type_info": "Text" + }, + { + "name": "completed", + "ordinal": 2, + "type_info": "Bool" + } + ], + "parameters": { + "Right": 0 + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "3a5b2a81088aa91ade3106165f926c337a88f4e29ae3bb170c4b687208aba20d" +} diff --git a/.sqlx/query-ab058898a8a1b13174d03c9972af33214619f8aa3080bc27f88bd5b9212b8c0f.json b/.sqlx/query-ab058898a8a1b13174d03c9972af33214619f8aa3080bc27f88bd5b9212b8c0f.json new file mode 100644 index 0000000..ee5f43b --- /dev/null +++ b/.sqlx/query-ab058898a8a1b13174d03c9972af33214619f8aa3080bc27f88bd5b9212b8c0f.json @@ -0,0 +1,12 @@ +{ + "db_name": "SQLite", + "query": "\n INSERT INTO tasks (description)\n VALUES ($1)\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 1 + }, + "nullable": [] + }, + "hash": "ab058898a8a1b13174d03c9972af33214619f8aa3080bc27f88bd5b9212b8c0f" +} diff --git a/Cargo.lock b/Cargo.lock index b06630d..46820e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -866,7 +866,7 @@ dependencies = [ "futures-lite", "serde", "serde_json", - "sqlx", + "sqlx 0.6.3", "tokio 1.29.1", ] @@ -1118,6 +1118,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -1611,6 +1620,12 @@ dependencies = [ "vsimd", ] +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "basic-toml" version = "0.1.3" @@ -1673,6 +1688,9 @@ name = "bitflags" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -2142,6 +2160,12 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "const-oid" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6340df57935414636969091153f35f68d9f00bbc8fb4a9c6054706c213e6c6bc" + [[package]] name = "const-random" version = "0.1.15" @@ -2636,6 +2660,17 @@ dependencies = [ "futures-util", ] +[[package]] +name = "der" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + [[package]] name = "derivative" version = "2.2.0" @@ -2748,6 +2783,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] @@ -2813,6 +2849,9 @@ name = "either" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +dependencies = [ + "serde", +] [[package]] name = "encoding_rs" @@ -2886,6 +2925,17 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if 1.0.0", + "home", + "windows-sys 0.48.0", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -3035,6 +3085,9 @@ version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" dependencies = [ + "futures-core", + "futures-sink", + "pin-project", "spin 0.9.8", ] @@ -3239,6 +3292,17 @@ dependencies = [ "parking_lot 0.11.2", ] +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api 0.4.10", + "parking_lot 0.12.1", +] + [[package]] name = "futures-io" version = "0.3.28" @@ -3504,15 +3568,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "hashlink" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" -dependencies = [ - "hashbrown 0.11.2", -] - [[package]] name = "hashlink" version = "0.8.3" @@ -4219,6 +4274,9 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] [[package]] name = "lazycell" @@ -4323,10 +4381,11 @@ checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libsqlite3-sys" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" dependencies = [ + "cc", "pkg-config", "vcpkg", ] @@ -4924,6 +4983,23 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.8.5", + "smallvec 1.11.0", + "zeroize", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -4934,6 +5010,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -4941,6 +5028,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -5179,6 +5267,15 @@ dependencies = [ "base64 0.13.1", ] +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.0" @@ -5344,6 +5441,27 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.27" @@ -5592,12 +5710,13 @@ dependencies = [ [[package]] name = "r2d2_sqlite" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fdc8e4da70586127893be32b7adf21326a4c6b1aba907611edf467d13ffe895" +checksum = "99f31323d6161385f385046738df520e0e8694fa74852d35891fc0be08348ddc" dependencies = [ "r2d2", "rusqlite", + "uuid 1.4.0", ] [[package]] @@ -5972,6 +6091,28 @@ dependencies = [ "serde", ] +[[package]] +name = "rsa" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" +dependencies = [ + "byteorder", + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-iter", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core 0.6.4", + "signature", + "spki", + "subtle", + "zeroize", +] + [[package]] name = "run-in-thread" version = "1.0.0" @@ -5983,16 +6124,15 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.27.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85127183a999f7db96d1a976a309eebbfb6ea3b0b400ddd8340190129de6eb7a" +checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.3.3", "fallible-iterator", "fallible-streaming-iterator", - "hashlink 0.7.0", + "hashlink", "libsqlite3-sys", - "memchr", "smallvec 1.11.0", ] @@ -6128,6 +6268,17 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "rustls" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b19faa85ecb5197342b54f987b142fb3e30d0c90da40f80ef4fa9a726e6676ed" +dependencies = [ + "ring", + "rustls-webpki 0.101.1", + "sct 0.7.0", +] + [[package]] name = "rustls-client-cert" version = "1.0.0" @@ -6174,6 +6325,16 @@ dependencies = [ "base64 0.21.2", ] +[[package]] +name = "rustls-webpki" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustls-webpki" version = "0.101.1" @@ -6367,9 +6528,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.167" +version = "1.0.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daf513456463b42aa1d94cff7e0c24d682b429f020b9afa4f5ba5c40a22b237" +checksum = "d614f89548720367ded108b3c843be93f3a341e22d5674ca0dd5cd57f34926af" dependencies = [ "serde_derive", ] @@ -6385,9 +6546,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.167" +version = "1.0.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69b106b68bc8054f0e974e70d19984040f8a5cf9215ca82626ea4853f82c4b9" +checksum = "d4fe589678c688e44177da4f27152ee2d190757271dc7f1d5b6b9f68d869d641" dependencies = [ "proc-macro2", "quote", @@ -6560,6 +6721,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "simdutf8" version = "0.1.4" @@ -6724,6 +6895,16 @@ dependencies = [ "lock_api 0.4.10", ] +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "sqlformat" version = "0.2.1" @@ -6741,8 +6922,21 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8de3b03a925878ed54a954f621e64bf55a3c1bd29652d0d1a17830405350188" dependencies = [ - "sqlx-core", - "sqlx-macros", + "sqlx-core 0.6.3", + "sqlx-macros 0.6.3", +] + +[[package]] +name = "sqlx" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ef53c86d2066e04f0ac6b1364f16d13d82388e2d07f11a5c71782345555761" +dependencies = [ + "sqlx-core 0.7.0", + "sqlx-macros 0.7.0", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", ] [[package]] @@ -6752,7 +6946,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" dependencies = [ "ahash 0.7.6", - "atoi", + "atoi 1.0.0", "bitflags 1.3.2", "byteorder", "bytes 1.4.0", @@ -6763,9 +6957,9 @@ dependencies = [ "event-listener", "futures-channel", "futures-core", - "futures-intrusive", + "futures-intrusive 0.4.2", "futures-util", - "hashlink 0.8.3", + "hashlink", "hex", "indexmap 1.9.3", "itoa 1.0.8", @@ -6788,6 +6982,49 @@ dependencies = [ "webpki-roots 0.22.6", ] +[[package]] +name = "sqlx-core" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a22fd81e9c1ad53c562edb869ff042b215d4eadefefc4784bacfbfd19835945" +dependencies = [ + "ahash 0.8.3", + "atoi 2.0.0", + "byteorder", + "bytes 1.4.0", + "crc", + "crossbeam-queue 0.3.8", + "dotenvy", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive 0.5.0", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap 2.0.0", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "rustls 0.21.3", + "rustls-pemfile", + "serde", + "serde_json", + "sha2", + "smallvec 1.11.0", + "sqlformat", + "thiserror", + "tokio 1.29.1", + "tokio-stream", + "tracing", + "url", + "webpki-roots 0.23.1", +] + [[package]] name = "sqlx-macros" version = "0.6.3" @@ -6801,12 +7038,131 @@ dependencies = [ "proc-macro2", "quote", "sha2", - "sqlx-core", + "sqlx-core 0.6.3", "sqlx-rt", "syn 1.0.109", "url", ] +[[package]] +name = "sqlx-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00bb7c096a202b8164c175614cbfb79fe0e1e0a3d50e0374526183ef2974e4a2" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core 0.7.0", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d644623ab9699014e5b3cb61a040d16caa50fd477008f63f1399ae35498a58" +dependencies = [ + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core 0.7.0", + "sqlx-mysql", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio 1.29.1", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8264c59b28b6858796acfcedc660aa4c9075cc6e4ec8eb03cdca2a3e725726db" +dependencies = [ + "atoi 2.0.0", + "base64 0.21.2", + "bitflags 2.3.3", + "byteorder", + "bytes 1.4.0", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa 1.0.8", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand 0.8.5", + "rsa", + "serde", + "sha1 0.10.5", + "sha2", + "smallvec 1.11.0", + "sqlx-core 0.7.0", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cab6147b81ca9213a7578f1b4c9d24c449a53953cd2222a7b5d7cd29a5c3139" +dependencies = [ + "atoi 2.0.0", + "base64 0.21.2", + "bitflags 2.3.3", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa 1.0.8", + "log", + "md-5", + "memchr", + "once_cell", + "rand 0.8.5", + "serde", + "serde_json", + "sha1 0.10.5", + "sha2", + "smallvec 1.11.0", + "sqlx-core 0.7.0", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + [[package]] name = "sqlx-rt" version = "0.6.3" @@ -6818,6 +7174,28 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "sqlx-sqlite" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59fba60afa64718104b71eec6984f8779d4caffff3b30cde91a75843c7efc126" +dependencies = [ + "atoi 2.0.0", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive 0.5.0", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core 0.7.0", + "tracing", + "url", +] + [[package]] name = "standback" version = "0.2.17" @@ -7320,6 +7698,23 @@ dependencies = [ "openssl", ] +[[package]] +name = "todo" +version = "1.0.0" +dependencies = [ + "actix-files", + "actix-session", + "actix-web", + "actix-web-lab", + "dotenv", + "env_logger", + "log", + "serde", + "serde_json", + "sqlx 0.7.0", + "tera", +] + [[package]] name = "tokio" version = "0.1.22" @@ -8148,6 +8543,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" dependencies = [ "getrandom 0.2.10", + "rand 0.8.5", "serde", ] @@ -8408,13 +8804,22 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "webpki-roots" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +dependencies = [ + "rustls-webpki 0.100.1", +] + [[package]] name = "webpki-roots" version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" dependencies = [ - "rustls-webpki", + "rustls-webpki 0.101.1", ] [[package]] @@ -8526,6 +8931,12 @@ dependencies = [ "tokio-util 0.7.8", ] +[[package]] +name = "whoami" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" + [[package]] name = "widestring" version = "1.0.2" diff --git a/Cargo.toml b/Cargo.toml index cc56286..d8fbe3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ members = [ "basics/nested-routing", "basics/state", "basics/static-files", - # "basics/todo", + "basics/todo", "cors/backend", "data-factory", "databases/diesel", diff --git a/basics/todo/Cargo.toml b/basics/todo/Cargo.toml index 172d2a0..f187b23 100644 --- a/basics/todo/Cargo.toml +++ b/basics/todo/Cargo.toml @@ -14,5 +14,5 @@ env_logger.workspace = true log.workspace = true serde.workspace = true serde_json.workspace = true -sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "sqlite", "offline"] } +sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "sqlite"] } tera = "1.5" diff --git a/basics/todo/README.md b/basics/todo/README.md index 2644482..3d0d366 100644 --- a/basics/todo/README.md +++ b/basics/todo/README.md @@ -6,12 +6,13 @@ A simple Todo project using a SQLite database. - SQLite 3 -## Change Into This Project Sub Directory +## Change Into The Examples Workspace Root Directory -All instructions assume you have changed into this folder: +All instructions assume you have changed into the examples workspace root: -```sh -cd basics/todo +```pwd +$ pwd +.../examples ``` ## Set Up The Database @@ -34,7 +35,7 @@ sqlx migrate run Start the application with: ```sh -cargo run +cargo run --bin=todo ``` The app will be viewable in the browser at . @@ -44,5 +45,5 @@ The app will be viewable in the browser at . For simplicity, this example uses SQLx's offline mode. If you make any changes to the database schema, this must be turned off or the `sqlx-data.json` file regenerated using the following command: ```sh -DATABASE_URL="sqlite://$(pwd)/todo.db" cargo sqlx prepare +cargo sqlx prepare --database-url=sqlite://./todo.db ``` diff --git a/basics/todo/sqlx-data.json b/basics/todo/sqlx-data.json deleted file mode 100644 index 99c06ab..0000000 --- a/basics/todo/sqlx-data.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "db": "SQLite", - "2f4086eab47b13298a107ed8c0feaadab903468b8e4fbd39e465f581c7189272": { - "query": "\n DELETE FROM tasks\n WHERE id = $1\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 1 - }, - "nullable": [] - } - }, - "37443376215969e31bc6bc1ee00f01044647d95caf8efc61df7bf333b6a2149d": { - "query": "\n UPDATE tasks\n SET completed = NOT completed\n WHERE id = $1\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 1 - }, - "nullable": [] - } - }, - "3a5b2a81088aa91ade3106165f926c337a88f4e29ae3bb170c4b687208aba20d": { - "query": "\n SELECT *\n FROM tasks\n ", - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int64" - }, - { - "name": "description", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "completed", - "ordinal": 2, - "type_info": "Bool" - } - ], - "parameters": { - "Right": 0 - }, - "nullable": [ - false, - false, - false - ] - } - }, - "ab058898a8a1b13174d03c9972af33214619f8aa3080bc27f88bd5b9212b8c0f": { - "query": "\n INSERT INTO tasks (description)\n VALUES ($1)\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 1 - }, - "nullable": [] - } - } -} \ No newline at end of file diff --git a/databases/sqlite/Cargo.toml b/databases/sqlite/Cargo.toml index 0700e94..8d31c90 100644 --- a/databases/sqlite/Cargo.toml +++ b/databases/sqlite/Cargo.toml @@ -10,7 +10,7 @@ env_logger.workspace = true futures-util.workspace = true log.workspace = true r2d2 = "0.8" -r2d2_sqlite = "0.20" # 0.21.0 blocked on sqlx sqlite update -rusqlite = "0.27" # 0.28.0 blocked on sqlx sqlite update +r2d2_sqlite = "0.22" +rusqlite = "0.29" serde.workspace = true serde_json.workspace = true