diff --git a/Cargo.lock b/Cargo.lock index 58e208b..7e8655f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -124,7 +124,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded 0.7.1", - "sha-1", + "sha-1 0.9.8", "slab", "time 0.2.27", ] @@ -383,7 +383,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" dependencies = [ "cipher", - "opaque-debug 0.3.0", + "opaque-debug", ] [[package]] @@ -393,7 +393,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" dependencies = [ "cipher", - "opaque-debug 0.3.0", + "opaque-debug", ] [[package]] @@ -431,12 +431,6 @@ dependencies = [ "alloc-no-stdlib", ] -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.2" @@ -551,14 +545,32 @@ dependencies = [ [[package]] name = "bigdecimal" -version = "0.1.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1374191e2dd25f9ae02e3aa95041ed5d747fc77b3c102b49fe2dd9a8117a6244" +checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744" dependencies = [ - "num-bigint 0.2.6", + "num-bigint 0.4.3", "num-integer", "num-traits", - "serde", +] + +[[package]] +name = "bindgen" +version = "0.59.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", ] [[package]] @@ -568,15 +580,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "block-buffer" -version = "0.7.3" +name = "bitvec" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +checksum = "5237f00a8c86130a0cc317830e558b966dd7850d48a953d998c813f01a41b527" dependencies = [ - "block-padding 0.1.5", - "byte-tools", - "byteorder", - "generic-array 0.12.4", + "funty", + "radium", + "tap", + "wyz", ] [[package]] @@ -585,7 +597,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.5", + "generic-array", ] [[package]] @@ -594,7 +606,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ - "generic-array 0.14.5", + "generic-array", ] [[package]] @@ -603,19 +615,10 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" dependencies = [ - "block-padding 0.2.1", + "block-padding", "cipher", ] -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - [[package]] name = "block-padding" version = "0.2.1" @@ -630,7 +633,7 @@ checksum = "32fa6a061124e37baba002e496d203e23ba3d7b73750be82dbfbc92913048a5b" dependencies = [ "byteorder", "cipher", - "opaque-debug 0.3.0", + "opaque-debug", ] [[package]] @@ -675,12 +678,6 @@ version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "bytemuck" version = "1.8.0" @@ -741,6 +738,15 @@ version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom 7.1.0", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -762,7 +768,6 @@ dependencies = [ "libc", "num-integer", "num-traits", - "serde", "time 0.1.44", "winapi 0.3.9", ] @@ -773,7 +778,27 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ - "generic-array 0.14.5", + "generic-array", +] + +[[package]] +name = "clang-sys" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmake" +version = "0.1.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" +dependencies = [ + "cc", ] [[package]] @@ -888,6 +913,20 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-channel 0.5.2", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils 0.8.7", +] + [[package]] name = "crossbeam-channel" version = "0.4.4" @@ -932,6 +971,16 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dd435b205a4842da59efd07628f921c096bc1cc0a156835b4fa0bcb9a19bcce" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.7", +] + [[package]] name = "crossbeam-utils" version = "0.7.2" @@ -959,7 +1008,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" dependencies = [ - "generic-array 0.14.5", + "generic-array", "typenum", ] @@ -1046,22 +1095,13 @@ dependencies = [ "syn", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.5", + "generic-array", ] [[package]] @@ -1119,12 +1159,6 @@ dependencies = [ "syn", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fast_chemail" version = "0.9.6" @@ -1207,6 +1241,70 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "frunk" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cd67cf7d54b7e72d0ea76f3985c3747d74aee43e0218ad993b7903ba7a5395e" +dependencies = [ + "frunk_core", + "frunk_derives", + "frunk_proc_macros", +] + +[[package]] +name = "frunk_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1246cf43ec80bf8b2505b5c360b8fb999c97dabd17dbb604d85558d5cbc25482" + +[[package]] +name = "frunk_derives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dbc4f084ec5a3f031d24ccedeb87ab2c3189a2f33b8d070889073837d5ea09e" +dependencies = [ + "frunk_proc_macro_helpers", + "quote", + "syn", +] + +[[package]] +name = "frunk_proc_macro_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99f11257f106c6753f5ffcb8e601fb39c390a088017aaa55b70c526bff15f63e" +dependencies = [ + "frunk_core", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frunk_proc_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a078bd8459eccbb85e0b007b8f756585762a72a9efc53f359b371c3b6351dbcc" +dependencies = [ + "frunk_core", + "frunk_proc_macros_impl", + "proc-macro-hack", +] + +[[package]] +name = "frunk_proc_macros_impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ffba99f0fa4f57e42f57388fbb9a0ca863bc2b4261f3c5570fed579d5df6c32" +dependencies = [ + "frunk_core", + "frunk_proc_macro_helpers", + "proc-macro-hack", + "quote", + "syn", +] + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -1223,6 +1321,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +[[package]] +name = "funty" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" + [[package]] name = "futf" version = "0.1.5" @@ -1342,15 +1446,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.5" @@ -1638,9 +1733,9 @@ dependencies = [ [[package]] name = "io-enum" -version = "0.2.6" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94534fd32a986dd34d97ddefe5198630d5ed99efd4e9b9b9ed4359e6b23a9cf7" +checksum = "03e3306b0f260aad2872563eb0d5d1a59f2420fad270a661dce59a01e92d806b" dependencies = [ "autocfg", "derive_utils", @@ -1721,7 +1816,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afabcc15e437a6484fc4f12d0fd63068fe457bf93f1c148d3d9649c60b103f32" dependencies = [ "base64 0.12.3", - "pem", + "pem 0.8.3", "ring", "serde", "serde_json", @@ -1760,25 +1855,81 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] -name = "lexical" -version = "5.2.2" +name = "lazycell" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f404a90a744e32e8be729034fc33b90cf2a56418fbf594d69aa3c0214ad414e5" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "lexical" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34e981f88d060a67815388470172638f1af16b3a12e581cb75142f190161bf9" dependencies = [ - "cfg-if 1.0.0", "lexical-core", ] [[package]] name = "lexical-core" -version = "0.7.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +checksum = "6a3926d8f156019890be4abe5fd3785e0cff1001e06f59c597641fd513a5a284" dependencies = [ - "arrayvec 0.5.2", - "bitflags", - "cfg-if 1.0.0", - "ryu", + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4d066d004fa762d9da995ed21aa8845bb9f6e4265f540d716fb4b315197bf0e" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c92badda8cc0fc4f3d3cc1c30aaefafb830510c8781ce4e8669881f3ed53ac" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff669ccaae16ee33af90dc51125755efed17f1309626ba5c12052512b11e291" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b5186948c7b297abaaa51560f2581dae625e5ce7dfc2d8fdc56345adb6dc576" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece956492e0e40fd95ef8658a34d53a3b8c2015762fdcaaff2167b28de1f56ef" +dependencies = [ + "lexical-util", "static_assertions", ] @@ -1788,6 +1939,16 @@ version = "0.2.119" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" +[[package]] +name = "libloading" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", +] + [[package]] name = "libz-sys" version = "1.1.4" @@ -1826,9 +1987,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.6.6" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea2d928b485416e8908cff2d97d621db22b27f7b3b6729e438bcf42c671ba91" +checksum = "fcb87f3080f6d1d69e8c564c0fcfde1d7aa8cc451ce40cae89479111f03bc0eb" dependencies = [ "hashbrown", ] @@ -2056,11 +2217,14 @@ checksum = "16cf681a23b4d0a43fc35024c176437f9dcd818db34e0f42ab456a0ee5ad497b" [[package]] name = "mysql" -version = "20.1.0" +version = "22.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a8660184af84975ac1639aa692a539c37739cec8a22a414de3db9cb573c1aa" +checksum = "2e6f8658d54e3c294d94a741a5f414c21431f56f253b5dc2e2582941d834b3a9" dependencies = [ "bufstream", + "bytes 1.1.0", + "crossbeam", + "flate2", "io-enum", "libc", "lru", @@ -2068,41 +2232,50 @@ dependencies = [ "named_pipe", "native-tls", "nix", - "pem", + "once_cell", + "pem 1.0.2", "percent-encoding", "serde", "serde_json", - "socket2 0.3.19", + "socket2 0.4.4", "twox-hash", "url", ] [[package]] name = "mysql_common" -version = "0.24.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de63b87a5f24c5db252418a6f04abb2f62823bd838dc9b1d7fdb8ae972ef76cf" +checksum = "4140827f2d12750de1e8755442577e4292a835f26ff2f659f0a380d1d71020b0" dependencies = [ - "base64 0.12.3", + "base64 0.13.0", "bigdecimal", + "bindgen", "bitflags", + "bitvec", "byteorder", - "bytes 0.5.6", - "chrono", + "bytes 1.1.0", + "cc", + "cmake", + "crc32fast", "flate2", + "frunk", "lazy_static", "lexical", - "num-bigint 0.2.6", + "num-bigint 0.4.3", "num-traits", - "rand 0.7.3", + "rand 0.8.5", "regex", "rust_decimal", + "saturating", "serde", "serde_json", - "sha1 0.6.1", - "sha2 0.8.2", - "time 0.2.27", - "twox-hash", + "sha-1 0.10.0", + "sha2 0.10.2", + "smallvec", + "subprocess", + "thiserror", + "time 0.3.7", "uuid", ] @@ -2152,14 +2325,15 @@ checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" [[package]] name = "nix" -version = "0.19.1" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" +checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" dependencies = [ "bitflags", "cc", "cfg-if 1.0.0", "libc", + "memoffset", ] [[package]] @@ -2278,18 +2452,21 @@ dependencies = [ "libc", ] +[[package]] +name = "num_threads" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ba99ba6393e2c3734791401b66902d981cb03bf190af674ca69949b6d5fb15" +dependencies = [ + "libc", +] + [[package]] name = "once_cell" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -2399,6 +2576,12 @@ dependencies = [ "syn", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "pem" version = "0.8.3" @@ -2410,6 +2593,15 @@ dependencies = [ "regex", ] +[[package]] +name = "pem" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9a3b09a20e374558580a4914d3b7d89bd61b954a5a5e1dcbea98753addb1947" +dependencies = [ + "base64 0.13.0", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -2581,6 +2773,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" + [[package]] name = "rand" version = "0.7.3" @@ -2789,11 +2987,17 @@ version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d37baa70cf8662d2ba1c1868c5983dda16ef32b105cce41fb5c47e72936a90b3" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", "num-traits", "serde", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" @@ -2831,6 +3035,12 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +[[package]] +name = "saturating" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71" + [[package]] name = "schannel" version = "0.1.19" @@ -2982,7 +3192,18 @@ dependencies = [ "cfg-if 1.0.0", "cpufeatures", "digest 0.9.0", - "opaque-debug 0.3.0", + "opaque-debug", +] + +[[package]] +name = "sha-1" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.3", ] [[package]] @@ -3011,18 +3232,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - [[package]] name = "sha2" version = "0.9.9" @@ -3033,9 +3242,26 @@ dependencies = [ "cfg-if 1.0.0", "cpufeatures", "digest 0.9.0", - "opaque-debug 0.3.0", + "opaque-debug", ] +[[package]] +name = "sha2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.3", +] + +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" + [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -3222,6 +3448,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "subprocess" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "055cf3ebc2981ad8f0a5a17ef6652f652d87831f79fddcba2ac57bcb9a0aa407" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "syn" version = "1.0.86" @@ -3233,6 +3469,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tempfile" version = "3.3.0" @@ -3324,6 +3566,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "time" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" +dependencies = [ + "libc", + "num_threads", +] + [[package]] name = "time-macros" version = "0.1.1" @@ -3914,6 +4166,15 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "wyz" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "129e027ad65ce1453680623c3fb5163cbf7107bfe1aa32257e7d0e63f9ced188" +dependencies = [ + "tap", +] + [[package]] name = "xml5ever" version = "0.16.2" diff --git a/Cargo.toml b/Cargo.toml index ca13d6f..075f272 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] yaml-rust = "0.4.5" -mysql = "20.1.0" +mysql = "22.1.0" actix = "0.10.0" actix-web = "3.3.2" actix-files = "0.5.0" diff --git a/src/data/error.rs b/src/data/error.rs index dd084a2..4d45e11 100644 --- a/src/data/error.rs +++ b/src/data/error.rs @@ -1,7 +1,7 @@ use core::fmt; use std::error; use std::error::Error; -use std::fmt::Formatter; +use std::fmt::{Display, Formatter}; /// Simple rust error /// @@ -21,7 +21,7 @@ impl ExecError { ExecError(msg.to_string()) } - pub fn boxed_new(msg: &str) -> Box { + pub fn boxed_new(msg: D) -> Box { Box::new(ExecError(msg.to_string())) } diff --git a/src/helpers/database.rs b/src/helpers/database.rs index 76d0748..890ae11 100644 --- a/src/helpers/database.rs +++ b/src/helpers/database.rs @@ -1,17 +1,17 @@ use std::collections; use std::collections::HashMap; -use std::error::Error; use std::ops::Add; use std::sync::{Arc, Mutex}; use chrono::{TimeZone, Utc}; +use mysql::*; use mysql::{Binary, Pool, ResultSet, Value}; -use mysql::prelude::Queryable; +use mysql::prelude::*; use crate::data::admin::AdminID; use crate::data::config::{conf, DatabaseConfig}; use crate::data::conversation::ConvID; -use crate::data::error::{ExecError, Res, ResultBoxError}; +use crate::data::error::{ExecError, Res}; use crate::data::group_id::GroupID; use crate::data::user::UserID; @@ -19,19 +19,19 @@ use crate::data::user::UserID; /// /// @author Pierre Hubert -pub type ProcessRowResult = Result>; +pub type ProcessRowResult = Res; // Pool shared across threads static mut POOL: Option>> = None; /// Connect to the database -pub fn connect(conf: &DatabaseConfig) -> Result<(), Box> { +pub fn connect(conf: &DatabaseConfig) -> Res { let url = format!( "mysql://{}:{}@{}:3306/{}", conf.username, conf.password, conf.host, conf.name ); - let pool = Pool::new(url)?; + let pool = Pool::new(Opts::from_url(&url)?)?; let pool = Some(Arc::new(Mutex::new(pool))); unsafe { @@ -42,7 +42,7 @@ pub fn connect(conf: &DatabaseConfig) -> Result<(), Box> { } /// Get a connection to the database -pub fn get_connection() -> Result> { +pub fn get_connection() -> Res { let pool: Pool; unsafe { @@ -258,18 +258,18 @@ impl QueryInfo { /// Execute query pub fn exec ProcessRowResult>(self, process_function: F) - -> Result, Box> { + -> Res> { query(self, process_function) } /// Query just a row pub fn query_row ProcessRowResult>(self, process_function: F) - -> Result> { + -> Res { query_row(self, process_function) } /// Execute count query - pub fn exec_count(self) -> ResultBoxError { + pub fn exec_count(self) -> Res { count(self) } @@ -281,7 +281,7 @@ impl QueryInfo { /// Struct used to read the result of a request pub struct RowResult<'a> { - row: &'a mysql::Row + row: &'a mysql::Row, } impl<'a> RowResult<'a> { @@ -292,7 +292,7 @@ impl<'a> RowResult<'a> { } /// Find a column in result set - fn find_col(&self, name: &str) -> Result { + fn find_col(&self, name: &str) -> Res { let name_bytes = name.as_bytes(); let mut index = 0; for c in self.row.columns_ref() { @@ -303,11 +303,11 @@ impl<'a> RowResult<'a> { index += 1; } - Err(ExecError(format!("Column {} not found in database result set!", name))) + Err(ExecError::boxed_new(format!("Column {} not found in database result set!", name))) } /// Find an integer included in the request - pub fn get_int64(&self, name: &str) -> Result> { + pub fn get_int64(&self, name: &str) -> Res { let value = self.row.get_opt(self.find_col(name)?); match value { @@ -318,7 +318,7 @@ impl<'a> RowResult<'a> { } /// Find an integer included in the request - pub fn get_u64(&self, name: &str) -> Result> { + pub fn get_u64(&self, name: &str) -> Res { let value = self.row.get_opt(self.find_col(name)?); match value { @@ -329,14 +329,14 @@ impl<'a> RowResult<'a> { } /// Get an optional unsigned number => Set to None if value is null / empty - pub fn get_optional_u64(&self, name: &str) -> ResultBoxError> { + pub fn get_optional_u64(&self, name: &str) -> Res> { match self.is_null(name)? { true => Ok(None), false => Ok(Some(self.get_u64(name)?)) } } - pub fn get_optional_u32(&self, name: &str) -> ResultBoxError> { + pub fn get_optional_u32(&self, name: &str) -> Res> { match self.is_null(name)? { true => Ok(None), false => Ok(Some(self.get_u32(name)?)) @@ -344,14 +344,14 @@ impl<'a> RowResult<'a> { } /// Get an optional unsigned number => Set to None if value is null / empty / 0 - pub fn get_optional_positive_u64(&self, name: &str) -> ResultBoxError> { + pub fn get_optional_positive_u64(&self, name: &str) -> Res> { Ok(match self.get_optional_u64(name)? { None | Some(0) => None, Some(val) => Some(val) }) } - pub fn get_u32(&self, name: &str) -> ResultBoxError { + pub fn get_u32(&self, name: &str) -> Res { let value = self.row.get_opt(self.find_col(name)?); match value { @@ -361,7 +361,7 @@ impl<'a> RowResult<'a> { } } - pub fn get_u16(&self, name: &str) -> ResultBoxError { + pub fn get_u16(&self, name: &str) -> Res { let value = self.row.get_opt(self.find_col(name)?); match value { @@ -372,7 +372,7 @@ impl<'a> RowResult<'a> { } /// Find an integer included in the request - pub fn get_usize(&self, name: &str) -> Result> { + pub fn get_usize(&self, name: &str) -> Res { let value = self.row.get_opt(self.find_col(name)?); match value { @@ -383,22 +383,22 @@ impl<'a> RowResult<'a> { } /// Get the ID of a user included in the request - pub fn get_user_id(&self, name: &str) -> ResultBoxError { + pub fn get_user_id(&self, name: &str) -> Res { Ok(UserID::new(self.get_u64(name)?)) } /// Get the ID of an admin included in the request - pub fn get_admin_id(&self, name: &str) -> ResultBoxError { + pub fn get_admin_id(&self, name: &str) -> Res { Ok(AdminID::new(self.get_u64(name)?)) } /// Get the ID of a group included in the response - pub fn get_group_id(&self, name: &str) -> ResultBoxError { + pub fn get_group_id(&self, name: &str) -> Res { Ok(GroupID::new(self.get_u64(name)?)) } /// Get the optional ID of a group included in the response - pub fn get_optional_group_id(&self, name: &str) -> ResultBoxError> { + pub fn get_optional_group_id(&self, name: &str) -> Res> { Ok(match self.get_optional_u64(name)? { None | Some(0) => None, Some(id) => Some(GroupID::new(id)) @@ -406,12 +406,12 @@ impl<'a> RowResult<'a> { } /// Get the ID of a conversation included in the response - pub fn get_conv_id(&self, name: &str) -> ResultBoxError { + pub fn get_conv_id(&self, name: &str) -> Res { Ok(ConvID::new(self.get_u64(name)?)) } /// Find a string included in the request - pub fn get_str(&self, name: &str) -> Result> { + pub fn get_str(&self, name: &str) -> Res { let value = self.row.get_opt(self.find_col(name)?); match value { @@ -422,7 +422,7 @@ impl<'a> RowResult<'a> { } /// Check out whether a given value is null or not - pub fn is_null(&self, name: &str) -> ResultBoxError { + pub fn is_null(&self, name: &str) -> Res { let value = self.row.get_opt(self.find_col(name)?); match value { @@ -433,7 +433,7 @@ impl<'a> RowResult<'a> { } /// Check out whether a given value is null or empty or not - pub fn is_null_or_empty(&self, name: &str) -> ResultBoxError { + pub fn is_null_or_empty(&self, name: &str) -> Res { if self.is_null(name)? { return Ok(true); } @@ -442,7 +442,7 @@ impl<'a> RowResult<'a> { } /// Get an optional string => Set to None if string is null / empty - pub fn get_optional_str(&self, name: &str) -> ResultBoxError> { + pub fn get_optional_str(&self, name: &str) -> Res> { match self.is_null(name)? { true => Ok(None), false => Ok(Some(self.get_str(name)?).map_or(None, |d| { @@ -455,12 +455,12 @@ impl<'a> RowResult<'a> { } /// Get legacy boolean value : 1 = true / 0 = false - pub fn get_legacy_bool(&self, name: &str) -> ResultBoxError { + pub fn get_legacy_bool(&self, name: &str) -> Res { Ok(self.get_int64(name)? == 1) } /// Get a MYSQL date as a timestamp - pub fn get_date_as_time(&self, name: &str) -> ResultBoxError { + pub fn get_date_as_time(&self, name: &str) -> Res { let value = self.row.get_opt(self.find_col(name)?); let value: Value = value.ok_or(ExecError(format!("Could not find date field {} !", name)))??; @@ -479,7 +479,7 @@ impl<'a> RowResult<'a> { /// Query a single row of the database pub fn query_row ProcessRowResult>(mut info: QueryInfo, - process_function: F) -> Result> { + process_function: F) -> Res { let table = info.table.clone(); info.limit = 1; @@ -494,7 +494,7 @@ pub fn query_row ProcessRowResult>(mut info: QueryInf /// Make a simple query pub fn query ProcessRowResult>(info: QueryInfo, process_function: F) - -> Result, Box> { + -> Res> { let mut params = vec![]; let select_elements = match info.fields.len() { @@ -576,11 +576,11 @@ pub fn query ProcessRowResult>(info: QueryInfo, proce let mut res = con.exec_iter(stmt, params)?; // This system is made to support only one dataset - let result_set = res.next_set(); + let result_set = res.iter(); if let None = result_set { return Err(Box::new(ExecError::new("No result set in a query!"))); } - let result_set: ResultSet = result_set.unwrap()?; + let result_set: ResultSet = result_set.unwrap(); // Parse each result of the dataset @@ -598,7 +598,7 @@ pub fn query ProcessRowResult>(info: QueryInfo, proce } /// Count the number of results a query would have produced -pub fn count(mut q: QueryInfo) -> ResultBoxError { +pub fn count(mut q: QueryInfo) -> Res { q.fields.clear(); q.fields.push("COUNT(*) as count".to_string()); @@ -725,25 +725,25 @@ impl InsertQuery { } /// Process insert - pub fn insert(self) -> ResultBoxError> { + pub fn insert(self) -> Res> { insert(self) } /// Process insert, drop the result of the operation - pub fn insert_drop_result(self) -> ResultBoxError<()> { + pub fn insert_drop_result(self) -> Res<()> { insert(self)?; Ok(()) } /// Process insert, excepting an ID in the response - pub fn insert_expect_result(self) -> ResultBoxError { + pub fn insert_expect_result(self) -> Res { let res = insert(self)?; res.ok_or(ExecError::boxed_new("Expected an ID in insert result!")) } } /// Insert a new entry into the database -pub fn insert(query: InsertQuery) -> ResultBoxError> { +pub fn insert(query: InsertQuery) -> Res> { // Collect keys let keys = query.values @@ -862,13 +862,13 @@ impl DeleteQuery { } /// Execute the delete query - pub fn exec(self) -> ResultBoxError<()> { + pub fn exec(self) -> Res<()> { delete(self) } } /// Delete an entry from the database -pub fn delete(query: DeleteQuery) -> ResultBoxError<()> { +pub fn delete(query: DeleteQuery) -> Res<()> { if query.conditions.is_empty() && query.custom_where.is_none() { return Err(ExecError::boxed_new("DELETE without WHERE condition blocked for security reasons!")); } @@ -993,9 +993,9 @@ impl UpdateInfo { } /// Set an u64 number - /// - /// None => 0 - /// Some => The value + /// + /// None => 0 + /// Some => The value pub fn set_opt_u64_or_zero(mut self, name: &str, val: Option) -> UpdateInfo { self.set.insert(name.to_string(), Value::from(val.unwrap_or(0))); self @@ -1025,13 +1025,13 @@ impl UpdateInfo { } /// Execute the update - pub fn exec(self) -> ResultBoxError<()> { + pub fn exec(self) -> Res<()> { update(self) } } /// Execute an update query -pub fn update(u: UpdateInfo) -> ResultBoxError<()> { +pub fn update(u: UpdateInfo) -> Res<()> { if u.cond.is_empty() { Err(ExecError::boxed_new("Update without conditions blocked for security!"))?; }