diff --git a/apps/debug/Cargo.lock b/apps/debug/Cargo.lock index ac216f632..c648d1170 100644 --- a/apps/debug/Cargo.lock +++ b/apps/debug/Cargo.lock @@ -2,547 +2,19 @@ # 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.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "adler32" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" - -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if 1.0.0", - "cipher", - "cpufeatures", - "opaque-debug 0.3.0", -] - -[[package]] -name = "aes-gcm" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - -[[package]] -name = "ahash" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.5", - "once_cell", - "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "anyhow" version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "ascii" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" - -[[package]] -name = "asn1_der" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" - -[[package]] -name = "async-channel" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "once_cell", - "slab", -] - -[[package]] -name = "async-global-executor" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c026b7e44f1316b567ee750fea85103f87fcb80792b860e979f221259796ca0a" -dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-mutex", - "blocking", - "futures-lite", - "num_cpus", - "once_cell", -] - -[[package]] -name = "async-io" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" -dependencies = [ - "concurrent-queue", - "futures-lite", - "libc", - "log", - "once_cell", - "parking", - "polling", - "slab", - "socket2 0.4.4", - "waker-fn", - "winapi 0.3.9", -] - -[[package]] -name = "async-lock" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-native-tls" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d57d4cec3c647232e1094dc013546c0b33ce785d8aeb251e1f20dfaf8a9a13fe" -dependencies = [ - "futures-util", - "native-tls", - "thiserror", - "url", -] - -[[package]] -name = "async-std" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8056f1455169ab86dd47b47391e4ab0cbd25410a70e9fe675544f49bafaf952" -dependencies = [ - "async-channel", - "async-global-executor", - "async-io", - "async-lock", - "crossbeam-utils 0.8.7", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "num_cpus", - "once_cell", - "pin-project-lite 0.2.8", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-std-resolver" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf3e776afdf3a2477ef4854b85ba0dff3bd85792f685fb3c68948b4d304e4f0" -dependencies = [ - "async-std", - "async-trait", - "futures-io", - "futures-util", - "pin-utils", - "trust-dns-resolver", -] - -[[package]] -name = "async-task" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" - -[[package]] -name = "async-trait" -version = "0.1.52" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "asynchronous-codec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb4401f0a3622dad2e0763fa79e0eb328bc70fb7dccfdd645341f00d671247d6" -dependencies = [ - "bytes", - "futures-sink", - "futures-util", - "memchr", - "pin-project-lite 0.2.8", -] - -[[package]] -name = "asynchronous-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690" -dependencies = [ - "bytes", - "futures-sink", - "futures-util", - "memchr", - "pin-project-lite 0.2.8", -] - -[[package]] -name = "atomic" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "atomic-waker" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" -dependencies = [ - "addr2line", - "cc", - "cfg-if 1.0.0", - "libc", - "miniz_oxide 0.4.4", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bigdecimal" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1e50562e37200edf7c6c43e54a08e64a5553bfb59d9c297d5572512aa517256" -dependencies = [ - "num-bigint 0.3.3", - "num-integer", - "num-traits", -] - -[[package]] -name = "bigdecimal" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744" -dependencies = [ - "num-bigint 0.4.3", - "num-integer", - "num-traits", -] - -[[package]] -name = "bimap" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" - -[[package]] -name = "bindgen" -version = "0.59.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bit_field" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" - -[[package]] -name = "bitflags" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitvec" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5237f00a8c86130a0cc317830e558b966dd7850d48a953d998c813f01a41b527" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "blake2" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" -dependencies = [ - "digest 0.10.3", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding 0.1.5", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "block-padding 0.2.1", - "generic-array 0.14.5", -] - -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array 0.14.5", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "blocking" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046e47d4b2d391b1f6f8b407b1deb8dee56c1852ccd868becf2710f601b5f427" -dependencies = [ - "async-channel", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", - "once_cell", -] - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bson" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41539b5c502b7c4e7b8af8ef07e5c442fe79ceba62a2aad8e62bd589b9454745" -dependencies = [ - "ahash 0.7.6", - "base64 0.13.0", - "chrono", - "hex", - "indexmap", - "lazy_static", - "rand 0.8.5", - "serde", - "serde_bytes", - "serde_json", - "uuid", + "generic-array", ] [[package]] @@ -551,125 +23,11 @@ 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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e851ca7c24871e7336801608a4797d7376545b6928a10d32d75685687141ead" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" - -[[package]] -name = "bytesize" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70" - -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - -[[package]] -name = "camino" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3132262930b0522068049f5870a856ab8affc80c70d08b6ecb785771a6fc23" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-edit" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "047ae122855956fb253d35948213830c3b21a38b3f69eedec78eba2f3171657a" -dependencies = [ - "atty", - "cargo_metadata", - "crates-index", - "dirs-next", - "dunce", - "env_proxy", - "error-chain", - "git2", - "hex", - "pathdiff", - "regex", - "semver 1.0.6", - "serde", - "serde_derive", - "serde_json", - "structopt", - "subprocess", - "termcolor", - "toml_edit", - "ureq", - "url", -] - -[[package]] -name = "cargo-platform" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.6", - "serde", - "serde_json", -] - [[package]] name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" @@ -677,480 +35,13 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chacha20" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b72a433d0cf2aef113ba70f62634c56fddb0f244e6377185c56a7cadbd8f91" -dependencies = [ - "cfg-if 1.0.0", - "cipher", - "cpufeatures", - "zeroize", -] - -[[package]] -name = "chacha20poly1305" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b84ed6d1d5f7aa9bdde921a5090e0ca4d934d250ea3b402a5fab3a994e28a2a" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "serde", - "time 0.1.44", - "winapi 0.3.9", -] - -[[package]] -name = "chunked_transfer" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array 0.14.5", -] - -[[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 = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "term_size", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "cmake" -version = "0.1.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" -dependencies = [ - "cc", -] - -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - -[[package]] -name = "colored" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" -dependencies = [ - "atty", - "lazy_static", - "winapi 0.3.9", -] - -[[package]] -name = "combine" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" -dependencies = [ - "ascii", - "byteorder", - "either", - "memchr", - "unreachable", -] - -[[package]] -name = "combine" -version = "4.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50b727aacc797f9fc28e355d21f34709ac4fc9adecfe470ad07b8f4464f53062" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "concurrent-queue" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" -dependencies = [ - "cache-padded", -] - -[[package]] -name = "config" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54ad70579325f1a38ea4c13412b82241c5900700a69785d73e2736bd65a33f86" -dependencies = [ - "async-trait", - "json5", - "lazy_static", - "nom", - "pathdiff", - "ron", - "rust-ini", - "serde", - "serde_json", - "toml", - "yaml-rust", -] - -[[package]] -name = "connection-string" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4ecb0dc8c35d2c626e45ae70bbfcb1050b302f42bcdf025d913cc0c5a0b443" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "core2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" -dependencies = [ - "memchr", -] - [[package]] name = "cpufeatures" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" -dependencies = [ - "libc", -] - -[[package]] -name = "crates-index" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad4af5c8dd9940a497ef4473e6e558b660a4a1b6e5ce2cb9d85454e2aaaf947" -dependencies = [ - "git2", - "glob", - "hex", - "home", - "memchr", - "semver 1.0.6", - "serde", - "serde_derive", - "serde_json", - "smartstring", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -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", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue 0.3.4", - "crossbeam-utils 0.8.7", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils 0.8.7", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils 0.8.7", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00d6d2ea26e8b151d99093005cb442fb9a37aeaca582a03ec70946f49ab5ed9" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils 0.8.7", - "lazy_static", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6" -dependencies = [ - "cfg-if 1.0.0", - "lazy_static", -] - -[[package]] -name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" dependencies = [ - "generic-array 0.14.5", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array 0.14.5", - "subtle", -] - -[[package]] -name = "crypto-mac" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" -dependencies = [ - "generic-array 0.14.5", - "subtle", -] - -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array 0.14.5", - "subtle", -] - -[[package]] -name = "ctor" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher", -] - -[[package]] -name = "cuckoofilter" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" -dependencies = [ - "byteorder", - "fnv", - "rand 0.7.3", -] - -[[package]] -name = "cuid" -version = "0.1.0" -source = "git+https://github.com/prisma/cuid-rust#4ffb2e47c772af62fed3ddc92bb7fc444d19e159" -dependencies = [ - "hostname 0.1.5", - "lazy_static", - "parking_lot 0.10.2", - "rand 0.7.3", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "4.0.0-pre.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12dc3116fe595d7847c701796ac1b189bd86b81f4f593c6f775f9d80fb2e29f4" -dependencies = [ - "byteorder", - "digest 0.10.3", - "rand_core 0.6.3", - "subtle", - "zeroize", -] - -[[package]] -name = "darling" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" -dependencies = [ - "darling_core", - "quote", - "syn", + "libc", ] [[package]] @@ -1159,85 +50,14 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" -[[package]] -name = "datamodel" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "bigdecimal 0.2.2", - "chrono", - "datamodel-connector", - "diagnostics", - "dml", - "enumflags2", - "itertools 0.10.3", - "mongodb-datamodel-connector", - "once_cell", - "parser-database", - "pest", - "regex", - "schema-ast", - "serde", - "serde_json", - "sql-datamodel-connector", -] - -[[package]] -name = "datamodel-connector" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "diagnostics", - "enumflags2", - "parser-database", - "serde_json", - "url", -] - [[package]] name = "debug" version = "0.1.0" dependencies = [ - "sdcorelib", -] - -[[package]] -name = "deflate" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c86f7e25f518f4b81808a2cf1c50996a61f5c2eb394b2393bd87f2a4780a432f" -dependencies = [ - "adler32", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "diagnostics" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "colored", - "pest", - "thiserror", -] - -[[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", + "anyhow", + "data-encoding", + "ring", + "sha256", ] [[package]] @@ -1246,627 +66,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "digest" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" -dependencies = [ - "block-buffer 0.10.2", - "crypto-common", - "subtle", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if 1.0.0", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi 0.3.9", -] - -[[package]] -name = "dlv-list" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68df3f2b690c1b86e65ef7830956aededf3cb0a16f898f79b9a6f421a7b6211b" -dependencies = [ - "rand 0.8.5", -] - -[[package]] -name = "dml" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "chrono", - "cuid", - "enumflags2", - "indoc", - "native-types", - "prisma-value", - "serde", - "serde_json", - "uuid", -] - -[[package]] -name = "dmmf" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "bigdecimal 0.2.2", - "datamodel", - "serde", - "serde_json", -] - -[[package]] -name = "dns-parser" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" -dependencies = [ - "byteorder", - "quick-error", -] - -[[package]] -name = "dtoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5caaa75cbd2b960ff1e5392d2cfb1f44717fffe12fc1f32b7b5d1267f99732a6" - -[[package]] -name = "dunce" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541" - -[[package]] -name = "dyn-clone" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e50f3adc76d6a43f5ed73b698a87d0760ca74617f60f7c3b879003536fdd28" - -[[package]] -name = "ed25519" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed12bbf7b5312f8da1c2722bc06d8c6b12c2d86a7fb35a194c7f3e6fc2bbe39" -dependencies = [ - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek 3.2.1", - "ed25519", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - -[[package]] -name = "encoding" -version = "0.2.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" -dependencies = [ - "encoding-index-japanese", - "encoding-index-korean", - "encoding-index-simpchinese", - "encoding-index-singlebyte", - "encoding-index-tradchinese", -] - -[[package]] -name = "encoding-index-japanese" -version = "1.20141219.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" -dependencies = [ - "encoding_index_tests", -] - -[[package]] -name = "encoding-index-korean" -version = "1.20141219.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" -dependencies = [ - "encoding_index_tests", -] - -[[package]] -name = "encoding-index-simpchinese" -version = "1.20141219.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" -dependencies = [ - "encoding_index_tests", -] - -[[package]] -name = "encoding-index-singlebyte" -version = "1.20141219.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" -dependencies = [ - "encoding_index_tests", -] - -[[package]] -name = "encoding-index-tradchinese" -version = "1.20141219.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" -dependencies = [ - "encoding_index_tests", -] - -[[package]] -name = "encoding_index_tests" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" - -[[package]] -name = "enum-as-inner" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570d109b813e904becc80d8d5da38376818a143348413f7149f1340fe04754d4" -dependencies = [ - "heck 0.4.0", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "enumflags2" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a25c90b056b3f84111cf183cbeddef0d3a0bbe9a674f057e1a1533c315f24def" -dependencies = [ - "enumflags2_derive", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "144ec79496cbab6f84fa125dc67be9264aef22eb8a28da8454d9c33f15108da4" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "env_logger" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "env_proxy" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a5019be18538406a43b5419a5501461f0c8b49ea7dfda0cfc32f4e51fc44be1" -dependencies = [ - "log", - "url", -] - -[[package]] -name = "error-chain" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" -dependencies = [ - "backtrace", - "version_check", -] - -[[package]] -name = "event-listener" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" - -[[package]] -name = "exr" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4badb9489a465cb2c555af1f00f0bfd8cecd6fc12ac11da9d5b40c5dd5f0200" -dependencies = [ - "bit_field", - "deflate", - "flume", - "half", - "inflate", - "lebe", - "smallvec", - "threadpool", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" - -[[package]] -name = "fastrand" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" -dependencies = [ - "instant", -] - -[[package]] -name = "filetime" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.2.11", - "winapi 0.3.9", -] - -[[package]] -name = "fixedbitset" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" - -[[package]] -name = "fixedbitset" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" - -[[package]] -name = "flate2" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" -dependencies = [ - "cfg-if 1.0.0", - "crc32fast", - "libc", - "libz-sys", - "miniz_oxide 0.4.4", -] - -[[package]] -name = "flume" -version = "0.10.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843c03199d0c0ca54bc1ea90ac0d507274c28abcc4f691ae8b4eaa375087c76a" -dependencies = [ - "futures-core", - "futures-sink", - "nanorand", - "pin-project 1.0.10", - "spin 0.9.2", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" -dependencies = [ - "matches", - "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 = "fsevent" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" -dependencies = [ - "bitflags 1.3.2", - "fsevent-sys", -] - -[[package]] -name = "fsevent-sys" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" -dependencies = [ - "libc", -] - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags 1.3.2", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -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 = "futures" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" - -[[package]] -name = "futures-executor" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", -] - -[[package]] -name = "futures-io" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" - -[[package]] -name = "futures-lite" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite 0.2.8", - "waker-fn", -] - -[[package]] -name = "futures-macro" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-rustls" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d383f0425d991a05e564c2f3ec150bd6dde863179c131dd60d8aa73a05434461" -dependencies = [ - "futures-io", - "rustls 0.20.4", - "webpki 0.22.0", -] - -[[package]] -name = "futures-sink" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" - -[[package]] -name = "futures-task" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" - -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" - -[[package]] -name = "futures-util" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite 0.2.8", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", + "generic-array", ] [[package]] @@ -1879,512 +79,11 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "ghash" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" -dependencies = [ - "opaque-debug 0.3.0", - "polyval", -] - -[[package]] -name = "gif" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a7187e78088aead22ceedeee99779455b23fc231fe13ec443f99bb71694e5b" -dependencies = [ - "color_quant", - "weezl", -] - -[[package]] -name = "gimli" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" - -[[package]] -name = "git2" -version = "0.13.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6" -dependencies = [ - "bitflags 1.3.2", - "libc", - "libgit2-sys", - "log", - "openssl-probe", - "openssl-sys", - "url", -] - -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - -[[package]] -name = "gloo-timers" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d12a7f4e95cfe710f1d624fb1210b7d961a5fb05c4fd942f4feab06e61f590e" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "graphql-parser" -version = "0.3.0" -source = "git+https://github.com/prisma/graphql-parser#6a3f58bd879065588e710cb02b5bd30c1ce182c3" -dependencies = [ - "combine 3.8.1", - "indexmap", - "thiserror", -] - -[[package]] -name = "half" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" - -[[package]] -name = "hashbrown" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" -dependencies = [ - "ahash 0.4.7", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.6", -] - -[[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 = "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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] - -[[package]] -name = "hex_fmt" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" -dependencies = [ - "crypto-mac 0.10.1", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array 0.14.5", - "hmac 0.8.1", -] - -[[package]] -name = "home" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "hostname" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" -dependencies = [ - "libc", - "winutil", -] - -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.9", -] - -[[package]] -name = "hotwatch" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39301670a6f5798b75f36a1b149a379a50df5aa7c71be50f4b41ec6eab445cb8" -dependencies = [ - "log", - "notify", -] - -[[package]] -name = "httparse" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "if-addrs" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc0fa01ffc752e9dbc72818cdb072cd028b86be5e09dd04c5a643704fe101a9" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "if-watch" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8f4a3c3d4c89351ca83e120c1c00b27df945d38e05695668c9d4b4f7bc52f3" -dependencies = [ - "async-io", - "core-foundation", - "fnv", - "futures", - "if-addrs", - "ipnet", - "log", - "rtnetlink", - "system-configuration", - "windows", -] - -[[package]] -name = "im" -version = "13.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8db49f8bc08d5cc4e2bb0f7d25a6d1db2c79bc6f7d7c86c96c657eb3d214125f" -dependencies = [ - "rustc_version 0.2.3", - "sized-chunks", - "typenum", -] - -[[package]] -name = "image" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db207d030ae38f1eb6f240d5a1c1c88ff422aa005d10f8c6c6fc5e75286ab30e" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "exr", - "gif", - "jpeg-decoder 0.2.2", - "num-iter", - "num-rational", - "num-traits", - "png", - "scoped_threadpool", - "tiff", -] - -[[package]] -name = "include_dir" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "482a2e29200b7eed25d7fdbd14423326760b7f6658d21a4cf12d55a50713c69f" -dependencies = [ - "glob", - "include_dir_macros", -] - -[[package]] -name = "include_dir_macros" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e074c19deab2501407c91ba1860fa3d6820bfde307db6d8cb851b55a10be89b" -dependencies = [ - "proc-macro2", - "quote", -] - -[[package]] -name = "indexmap" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" -dependencies = [ - "autocfg", - "hashbrown 0.11.2", - "serde", -] - -[[package]] -name = "indoc" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7906a9fababaeacb774f72410e497a1d18de916322e33797bb2cd29baa23c9e" -dependencies = [ - "unindent", -] - -[[package]] -name = "inflate" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" -dependencies = [ - "adler32", -] - -[[package]] -name = "inotify" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "int-enum" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b1428b2b1abe959e6eedb0a17d0ab12f6ba20e1106cc29fc4874e3ba393c177" -dependencies = [ - "cfg-if 0.1.10", - "int-enum-impl", -] - -[[package]] -name = "int-enum-impl" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2c3cecaad8ca1a5020843500c696de2b9a07b63b624ddeef91f85f9bafb3671" -dependencies = [ - "cfg-if 0.1.10", - "proc-macro-crate 0.1.5", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "ipconfig" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" -dependencies = [ - "socket2 0.3.19", - "widestring", - "winapi 0.3.9", - "winreg", -] - -[[package]] -name = "ipnet" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c" - -[[package]] -name = "itertools" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a9b56eb56058f43dc66e58f40a214b2ccbc9f3df51861b63d51dec7b65bc3f" - -[[package]] -name = "itertools" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" - -[[package]] -name = "jobserver" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" -dependencies = [ - "libc", -] - -[[package]] -name = "jpeg-decoder" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2" - -[[package]] -name = "jpeg-decoder" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "105fb082d64e2100074587f59a74231f771750c664af903f1f9f76c9dedfc6f1" -dependencies = [ - "rayon", -] [[package]] name = "js-sys" @@ -2395,1497 +94,25 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "json5" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" -dependencies = [ - "pest", - "pest_derive", - "serde", -] - -[[package]] -name = "keccak" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "lebe" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efd1d698db0759e6ef11a7cd44407407399a910c774dd804c64c032da7826ff" - -[[package]] -name = "lexical" -version = "6.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccd3e434c16f0164124ade12dcdee324fcc3dafb1cad0c7f1d8c2451a1aa6886" -dependencies = [ - "lexical-core", -] - -[[package]] -name = "lexical-core" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92912c4af2e7d9075be3e5e3122c4d7263855fa6cce34fbece4dd08e5884624d" -dependencies = [ - "lexical-parse-float", - "lexical-parse-integer", - "lexical-util", - "lexical-write-float", - "lexical-write-integer", -] - -[[package]] -name = "lexical-parse-float" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f518eed87c3be6debe6d26b855c97358d8a11bf05acec137e5f53080f5ad2dd8" -dependencies = [ - "lexical-parse-integer", - "lexical-util", - "static_assertions", -] - -[[package]] -name = "lexical-parse-integer" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc852ec67c6538bbb2b9911116a385b24510e879a69ab516e6a151b15a79168" -dependencies = [ - "lexical-util", - "static_assertions", -] - -[[package]] -name = "lexical-util" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c72a9d52c5c4e62fa2cdc2cb6c694a39ae1382d9c2a17a466f18e272a0930eb1" -dependencies = [ - "static_assertions", -] - -[[package]] -name = "lexical-write-float" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26f6202bff3d35ede41a6200227837468bb92e4ecdd437328b1055ed218fb855" -dependencies = [ - "lexical-util", - "lexical-write-integer", - "static_assertions", -] - -[[package]] -name = "lexical-write-integer" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "094060bd2a7c2ff3a16d5304a6ae82727cb3cc9d1c70f813cc73f744c319337e" -dependencies = [ - "lexical-util", - "static_assertions", -] - [[package]] name = "libc" -version = "0.2.119" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" - -[[package]] -name = "libgit2-sys" -version = "0.12.26+1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -] - -[[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 = "libp2p" -version = "0.43.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e8570e25fa03d4385405dbeaf540ba00e3ee50942f03d84e1a8928a029f35f9" -dependencies = [ - "atomic", - "bytes", - "futures", - "futures-timer", - "getrandom 0.2.5", - "instant", - "lazy_static", - "libp2p-autonat", - "libp2p-core", - "libp2p-deflate", - "libp2p-dns", - "libp2p-floodsub", - "libp2p-gossipsub", - "libp2p-identify", - "libp2p-kad", - "libp2p-mdns", - "libp2p-metrics", - "libp2p-mplex", - "libp2p-noise", - "libp2p-ping", - "libp2p-plaintext", - "libp2p-pnet", - "libp2p-relay", - "libp2p-rendezvous", - "libp2p-request-response", - "libp2p-swarm", - "libp2p-swarm-derive", - "libp2p-tcp", - "libp2p-uds", - "libp2p-wasm-ext", - "libp2p-websocket", - "libp2p-yamux", - "multiaddr", - "parking_lot 0.12.0", - "pin-project 1.0.10", - "rand 0.7.3", - "smallvec", -] - -[[package]] -name = "libp2p-autonat" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd6314084638e09e4162a5c6d0c1ba859f5d5f8a045ca015f7c95325e4b7c230" -dependencies = [ - "async-trait", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-request-response", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.8.5", -] - -[[package]] -name = "libp2p-core" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9164ec41455856e8187addc870bb4fe1ea2ee28e1a9244831d449a2429b32c1a" -dependencies = [ - "asn1_der", - "bs58", - "ed25519-dalek", - "either", - "fnv", - "futures", - "futures-timer", - "instant", - "lazy_static", - "libsecp256k1", - "log", - "multiaddr", - "multihash", - "multistream-select", - "parking_lot 0.12.0", - "pin-project 1.0.10", - "prost", - "prost-build", - "rand 0.8.5", - "ring 0.16.20", - "rw-stream-sink", - "sha2 0.10.2", - "smallvec", - "thiserror", - "unsigned-varint", - "void", - "zeroize", -] - -[[package]] -name = "libp2p-deflate" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1d37f042f748e224f04785d0e987ae09a2aa518d6401d82d412dad83e360ed" -dependencies = [ - "flate2", - "futures", - "libp2p-core", -] - -[[package]] -name = "libp2p-dns" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7838647d33978b77f943687412f4a39e74234c8342cbfdad14282b465b272cb4" -dependencies = [ - "async-std-resolver", - "futures", - "libp2p-core", - "log", - "smallvec", - "trust-dns-resolver", -] - -[[package]] -name = "libp2p-floodsub" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0b7d6c3fa2ead77a5bbeff580bd7507efcc9d7fa9d0caf873795b097d385c0" -dependencies = [ - "cuckoofilter", - "fnv", - "futures", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.7.3", - "smallvec", -] - -[[package]] -name = "libp2p-gossipsub" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f62943fba0b0dae02b87868620c52a581c54ec9fb04b5e195cf20313fc510c3" -dependencies = [ - "asynchronous-codec 0.6.0", - "base64 0.13.0", - "byteorder", - "bytes", - "fnv", - "futures", - "hex_fmt", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "prometheus-client", - "prost", - "prost-build", - "rand 0.7.3", - "regex", - "sha2 0.10.2", - "smallvec", - "unsigned-varint", - "wasm-timer", -] - -[[package]] -name = "libp2p-identify" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f219b4d4660fe3a04bf5fe6b5970902b7c1918e25b2536be8c70efc480f88f8" -dependencies = [ - "futures", - "futures-timer", - "libp2p-core", - "libp2p-swarm", - "log", - "lru", - "prost", - "prost-build", - "smallvec", -] - -[[package]] -name = "libp2p-kad" -version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aead5ee2322a7b825c7633065370909c8383046f955cda5b56797e6904db7a72" -dependencies = [ - "arrayvec 0.5.2", - "asynchronous-codec 0.6.0", - "bytes", - "either", - "fnv", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.7.3", - "sha2 0.10.2", - "smallvec", - "thiserror", - "uint", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-mdns" -version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54d1914576978e5f3b15ac99e2cda9b56471ce64f1cfc7c2b09ac0cee147175e" -dependencies = [ - "async-io", - "data-encoding", - "dns-parser", - "futures", - "if-watch", - "lazy_static", - "libp2p-core", - "libp2p-swarm", - "log", - "rand 0.8.5", - "smallvec", - "socket2 0.4.4", - "void", -] - -[[package]] -name = "libp2p-metrics" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29e4e5e4c5aa567fe1ee3133afe088dc2d2fd104e20c5c2c5c2649f75129677" -dependencies = [ - "libp2p-core", - "libp2p-gossipsub", - "libp2p-identify", - "libp2p-kad", - "libp2p-ping", - "libp2p-relay", - "libp2p-swarm", - "prometheus-client", -] - -[[package]] -name = "libp2p-mplex" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "442eb0c9fff0bf22a34f015724b4143ce01877e079ed0963c722d94c07c72160" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes", - "futures", - "libp2p-core", - "log", - "nohash-hasher", - "parking_lot 0.12.0", - "rand 0.7.3", - "smallvec", - "unsigned-varint", -] - -[[package]] -name = "libp2p-noise" -version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd7e0c94051cda67123be68cf6b65211ba3dde7277be9068412de3e7ffd63ef" -dependencies = [ - "bytes", - "curve25519-dalek 3.2.1", - "futures", - "lazy_static", - "libp2p-core", - "log", - "prost", - "prost-build", - "rand 0.8.5", - "sha2 0.10.2", - "snow", - "static_assertions", - "x25519-dalek", - "zeroize", -] - -[[package]] -name = "libp2p-ping" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab44a12d372d6abdd326c468c1d5b002be06fbd923c5a799d6a9d3b36646ca3" -dependencies = [ - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "rand 0.7.3", - "void", -] - -[[package]] -name = "libp2p-plaintext" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962c0fb0e7212fb96a69b87f2d09bcefd317935239bdc79cda900e7a8897a3fe" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes", - "futures", - "libp2p-core", - "log", - "prost", - "prost-build", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-pnet" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1a458bbda880107b5b36fcb9b5a1ef0c329685da0e203ed692a8ebe64cc92c" -dependencies = [ - "futures", - "log", - "pin-project 1.0.10", - "rand 0.7.3", - "salsa20", - "sha3", -] - -[[package]] -name = "libp2p-relay" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "517be90a2ce60b6c3bdfe88f34cc789c61dafe6f694a7b45e644af7353880fa3" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes", - "either", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "pin-project 1.0.10", - "prost", - "prost-build", - "rand 0.8.5", - "smallvec", - "static_assertions", - "thiserror", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-rendezvous" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597e4a022dd2e168ce1218faf6b3aead5c427fb828eb4f982cef7c40d4b7f49e" -dependencies = [ - "asynchronous-codec 0.6.0", - "bimap", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.8.5", - "sha2 0.10.2", - "thiserror", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-request-response" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12388a73626d1727524069cce0bb05a9c428581de435278a070c55ae27cc7e73" -dependencies = [ - "async-trait", - "bytes", - "futures", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "rand 0.7.3", - "smallvec", - "unsigned-varint", -] - -[[package]] -name = "libp2p-swarm" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53ab2d4eb8ef2966b10fdf859245cdd231026df76d3c6ed2cf9e418a8f688ec9" -dependencies = [ - "either", - "fnv", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "log", - "pin-project 1.0.10", - "rand 0.7.3", - "smallvec", - "thiserror", - "void", -] - -[[package]] -name = "libp2p-swarm-derive" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8153a6472e84ec888ef2bf21deafe8d4214e811f0f162abbf07156c27f8fa8" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "libp2p-tcp" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193447aa729c85aac2376828df76d171c1a589c9e6b58fcc7f9d9a020734122c" -dependencies = [ - "async-io", - "futures", - "futures-timer", - "if-watch", - "ipnet", - "libc", - "libp2p-core", - "log", - "socket2 0.4.4", -] - -[[package]] -name = "libp2p-uds" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24bdab114f7f2701757d6541266e1131b429bbae382008f207f2114ee4222dcb" -dependencies = [ - "async-std", - "futures", - "libp2p-core", - "log", -] - -[[package]] -name = "libp2p-wasm-ext" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f6ea0f84a967ef59a16083f222c18115ae2e91db69809dce275df62e101b279" -dependencies = [ - "futures", - "js-sys", - "libp2p-core", - "parity-send-wrapper", - "wasm-bindgen", - "wasm-bindgen-futures", -] - -[[package]] -name = "libp2p-websocket" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c932834c3754501c368d1bf3d0fb458487a642b90fc25df082a3a2f3d3b32e37" -dependencies = [ - "either", - "futures", - "futures-rustls", - "libp2p-core", - "log", - "quicksink", - "rw-stream-sink", - "soketto", - "url", - "webpki-roots 0.22.2", -] - -[[package]] -name = "libp2p-yamux" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be902ebd89193cd020e89e89107726a38cfc0d16d18f613f4a37d046e92c7517" -dependencies = [ - "futures", - "libp2p-core", - "parking_lot 0.12.0", - "thiserror", - "yamux", -] - -[[package]] -name = "libsecp256k1" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37" -dependencies = [ - "arrayref", - "base64 0.13.0", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.8.5", - "serde", - "sha2 0.9.9", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsqlite3-sys" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290b64917f8b0cb885d9de0f9959fe1f775d7fa12f1da2db9001c1c8ab60f89d" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libssh2-sys" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libwebp-sys" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439fd1885aa28937e7edcd68d2e793cb4a22f8733460d2519fbafd2b215672bf" -dependencies = [ - "cc", -] - -[[package]] -name = "libz-sys" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f35facd4a5673cb5a48822be2be1d4236c1c99cb4113cab7061ac720d5bf859" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" - -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "lock_api" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" -dependencies = [ - "scopeguard", -] +checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" [[package]] name = "log" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" dependencies = [ - "cfg-if 1.0.0", - "value-bag", -] - -[[package]] -name = "lru" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb87f3080f6d1d69e8c564c0fcfde1d7aa8cc451ce40cae89479111f03bc0eb" -dependencies = [ - "hashbrown 0.11.2", -] - -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - -[[package]] -name = "md-5" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[package]] -name = "md5" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e6bcd6433cff03a4bfc3d9834d504467db1f1cf6d0ea765d37d330249ed629d" - -[[package]] -name = "memchr" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "metrics" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b70227ece8711a1aa2f99655efd795d0cff297a5b9fe39645a93aacf6ad39d" -dependencies = [ - "metrics-core", -] - -[[package]] -name = "metrics-core" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c064b3a1ff41f4bf6c91185c8a0caeccf8a8a27e9d0f92cc54cf3dbec812f48" - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow 0.2.2", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba42135c6a5917b9db9cd7b293e5409e1c6b041e6f9825e92e55a894c63b6f8" -dependencies = [ - "libc", - "log", - "miow 0.3.7", - "ntapi", - "wasi 0.11.0+wasi-snapshot-preview1", - "winapi 0.3.9", -] - -[[package]] -name = "mio-extras" -version = "2.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" -dependencies = [ - "lazycell", - "log", - "mio 0.6.23", - "slab", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "mobc" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f76d2f2e2dcbb00a8d3b2b09f026a74a82693ea52cd071647aa6cfa7f1ff37e" -dependencies = [ - "async-trait", - "futures-channel", - "futures-core", - "futures-timer", - "futures-util", - "log", - "tokio", -] - -[[package]] -name = "mongodb" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bacb6f8cee6bf010d7bc57550d859f6a4ffe255eb8c9a7014637fe988eaece64" -dependencies = [ - "async-trait", - "base64 0.13.0", - "bitflags 1.3.2", - "bson", - "chrono", - "derivative", - "futures-core", - "futures-executor", - "futures-io", - "futures-util", - "hex", - "hmac 0.11.0", - "lazy_static", - "md-5", - "os_info", - "pbkdf2", - "percent-encoding", - "rand 0.8.5", - "rustls 0.19.1", - "rustls-pemfile", - "serde", - "serde_bytes", - "serde_with", - "sha-1 0.9.8", - "sha2 0.9.9", - "socket2 0.4.4", - "stringprep", - "strsim 0.10.0", - "take_mut", - "thiserror", - "tokio", - "tokio-rustls", - "tokio-util", - "trust-dns-proto", - "trust-dns-resolver", - "typed-builder", - "uuid", - "version_check", - "webpki 0.21.4", - "webpki-roots 0.21.1", -] - -[[package]] -name = "mongodb-client" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "mongodb", - "once_cell", - "percent-encoding", - "thiserror", -] - -[[package]] -name = "mongodb-datamodel-connector" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "datamodel-connector", - "enumflags2", - "native-types", - "once_cell", - "serde_json", -] - -[[package]] -name = "mongodb-query-connector" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "anyhow", - "async-trait", - "bigdecimal 0.2.2", - "chrono", - "cuid", - "datamodel", - "futures", - "indexmap", - "itertools 0.10.3", - "mongodb", - "mongodb-client", - "native-types", - "prisma-models", - "prisma-value", - "query-connector", - "rand 0.7.3", - "regex", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "user-facing-errors", - "uuid", -] - -[[package]] -name = "multiaddr" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c580bfdd8803cce319b047d239559a22f809094aaea4ac13902a1fdcfcd4261" -dependencies = [ - "arrayref", - "bs58", - "byteorder", - "data-encoding", - "multihash", - "percent-encoding", - "serde", - "static_assertions", - "unsigned-varint", - "url", -] - -[[package]] -name = "multihash" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7392bffd88bc0c4f8297e36a777ab9f80b7127409c4a1acb8fee99c9f27addcd" -dependencies = [ - "core2", - "digest 0.10.3", - "multihash-derive", - "sha2 0.10.2", - "unsigned-varint", -] - -[[package]] -name = "multihash-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc076939022111618a5026d3be019fd8b366e76314538ff9a1b59ffbcbf98bcd" -dependencies = [ - "proc-macro-crate 1.1.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "multimap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" - -[[package]] -name = "multistream-select" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" -dependencies = [ - "bytes", - "futures", - "log", - "pin-project 1.0.10", - "smallvec", - "unsigned-varint", -] - -[[package]] -name = "mysql_async" -version = "0.29.0" -source = "git+https://github.com/prisma/mysql_async?branch=vendored-openssl#650f07121681ada8a5baec3669197e5ce7e0e6d7" -dependencies = [ - "bytes", - "crossbeam", - "flate2", - "futures-core", - "futures-sink", - "futures-util", - "lazy_static", - "lru", - "mio 0.8.1", - "mysql_common", - "native-tls", - "once_cell", - "pem", - "percent-encoding", - "pin-project 1.0.10", - "serde", - "serde_json", - "socket2 0.4.4", - "thiserror", - "tokio", - "tokio-native-tls", - "tokio-util", - "twox-hash", - "url", - "uuid", -] - -[[package]] -name = "mysql_common" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4140827f2d12750de1e8755442577e4292a835f26ff2f659f0a380d1d71020b0" -dependencies = [ - "base64 0.13.0", - "bigdecimal 0.3.0", - "bindgen", - "bitflags 1.3.2", - "bitvec", - "byteorder", - "bytes", - "cc", - "cmake", - "crc32fast", - "flate2", - "frunk", - "lazy_static", - "lexical", - "num-bigint 0.4.3", - "num-traits", - "rand 0.8.5", - "regex", - "rust_decimal", - "saturating", - "serde", - "serde_json", - "sha-1 0.10.0", - "sha2 0.10.2", - "smallvec", - "subprocess", - "thiserror", - "time 0.3.7", - "uuid", -] - -[[package]] -name = "nanorand" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" -dependencies = [ - "getrandom 0.2.5", -] - -[[package]] -name = "native-tls" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "native-types" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "net2" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "netlink-packet-core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" -dependencies = [ - "anyhow", - "byteorder", - "libc", - "netlink-packet-utils", -] - -[[package]] -name = "netlink-packet-route" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733ea73609acfd7fa7ddadfb7bf709b0471668c456ad9513685af543a06342b2" -dependencies = [ - "anyhow", - "bitflags 1.3.2", - "byteorder", - "libc", - "netlink-packet-core", - "netlink-packet-utils", -] - -[[package]] -name = "netlink-packet-utils" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" -dependencies = [ - "anyhow", - "byteorder", - "paste", - "thiserror", -] - -[[package]] -name = "netlink-proto" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8785b8141e8432aa45fceb922a7e876d7da3fad37fa7e7ec702ace3aa0826b" -dependencies = [ - "bytes", - "futures", - "log", - "netlink-packet-core", - "netlink-sys", - "tokio", -] - -[[package]] -name = "netlink-sys" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c9f9547a08241bee7b6558b9b98e1f290d187de8b7cfca2bbb4937bcaa8f8" -dependencies = [ - "async-io", - "bytes", - "futures", - "libc", - "log", -] - -[[package]] -name = "nix" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if 1.0.0", - "libc", - "memoffset", -] - -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[package]] -name = "nom" -version = "7.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" -dependencies = [ - "memchr", - "minimal-lexical", - "version_check", -] - -[[package]] -name = "notify" -version = "4.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257" -dependencies = [ - "bitflags 1.3.2", - "filetime", - "fsevent", - "fsevent-sys", - "inotify", - "libc", - "mio 0.6.23", - "mio-extras", - "walkdir", - "winapi 0.3.9", -] - -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "num-bigint" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "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 = "object" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" -dependencies = [ - "memchr", + "cfg-if", ] [[package]] @@ -3894,652 +121,12 @@ 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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" -dependencies = [ - "bitflags 1.3.2", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-sys", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "opentelemetry" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf9b1c4e9a6c4de793c632496fa490bdc0e1eea73f0c91394f7b6990935d22" -dependencies = [ - "async-trait", - "crossbeam-channel", - "futures", - "js-sys", - "lazy_static", - "percent-encoding", - "pin-project 1.0.10", - "rand 0.8.5", - "thiserror", - "tokio", -] - -[[package]] -name = "opentls" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f561874f8d6ecfb674fc08863414040c93cc90c0b6963fe679895fab8b65560" -dependencies = [ - "futures-util", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "url", -] - -[[package]] -name = "ordered-multimap" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c672c7ad9ec066e428c00eb917124a06f08db19e2584de982cc34b1f4c12485" -dependencies = [ - "dlv-list", - "hashbrown 0.9.1", -] - -[[package]] -name = "ordermap" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" - -[[package]] -name = "os_info" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "023df84d545ef479cf67fd2f4459a613585c9db4852c2fad12ab70587859d340" -dependencies = [ - "log", - "winapi 0.3.9", -] - -[[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "parity-send-wrapper" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" - -[[package]] -name = "parking" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" - -[[package]] -name = "parking_lot" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.2", -] - -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api 0.4.6", - "parking_lot_core 0.8.5", -] - -[[package]] -name = "parking_lot" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" -dependencies = [ - "lock_api 0.4.6", - "parking_lot_core 0.9.1", -] - -[[package]] -name = "parking_lot_core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if 1.0.0", - "instant", - "libc", - "redox_syscall 0.2.11", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.2.11", - "smallvec", - "windows-sys", -] - -[[package]] -name = "parser-database" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "diagnostics", - "enumflags2", - "indexmap", - "schema-ast", -] - -[[package]] -name = "paste" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" - -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - -[[package]] -name = "pbkdf2" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" -dependencies = [ - "crypto-mac 0.11.1", -] - -[[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 = "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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" -dependencies = [ - "maplit", - "pest", - "sha-1 0.8.2", -] - -[[package]] -name = "petgraph" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" -dependencies = [ - "fixedbitset 0.1.9", - "ordermap", -] - -[[package]] -name = "petgraph" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" -dependencies = [ - "fixedbitset 0.4.1", - "indexmap", -] - -[[package]] -name = "phf" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" -dependencies = [ - "phf_shared", -] - -[[package]] -name = "phf_shared" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9615c18d31137579e9ff063499264ddc1278e7b1982757ebc111028c4d1dc909" -dependencies = [ - "pin-project-internal 0.4.29", -] - -[[package]] -name = "pin-project" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" -dependencies = [ - "pin-project-internal 1.0.10", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "044964427019eed9d49d9d5bbce6047ef18f37100ea400912a9fa4a3523ab12a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - -[[package]] -name = "pin-project-lite" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "piston-float" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "191472f1cf8b069c13ca018975e21e3082fc8ad4beeeda716c51fdc6b964c3d1" - -[[package]] -name = "piston-viewport" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d6254303f902baa397b4acf918110d70a33c4062f8ab47e8a4b527d29d3a4e7" -dependencies = [ - "piston-float", -] - -[[package]] -name = "pistoncore-input" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0239232284123c4ee1ad9b618134599002a8f135587d6886fa63614f517e4b19" -dependencies = [ - "bitflags 0.4.0", - "piston-viewport", - "rustc-serialize", -] - -[[package]] -name = "pistoncore-window" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e750b680fed29457933cf9dfb94381ef1b9dbed230f03cc1a88aac6c940766e7" -dependencies = [ - "pistoncore-input", - "shader_version", -] - -[[package]] -name = "pkg-config" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" - -[[package]] -name = "png" -version = "0.17.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc38c0ad57efb786dd57b9864e5b18bae478c00c824dc55a38bbc9da95dde3ba" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "deflate", - "miniz_oxide 0.5.1", -] - -[[package]] -name = "polling" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "log", - "wepoll-ffi", - "winapi 0.3.9", -] - -[[package]] -name = "poly1305" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" -dependencies = [ - "cpufeatures", - "opaque-debug 0.3.0", - "universal-hash", -] - -[[package]] -name = "polyval" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "opaque-debug 0.3.0", - "universal-hash", -] - -[[package]] -name = "postgres-native-tls" -version = "0.5.0" -source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" -dependencies = [ - "futures", - "native-tls", - "tokio", - "tokio-native-tls", - "tokio-postgres", -] - -[[package]] -name = "postgres-protocol" -version = "0.6.1" -source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" -dependencies = [ - "base64 0.13.0", - "byteorder", - "bytes", - "fallible-iterator", - "hmac 0.10.1", - "md-5", - "memchr", - "rand 0.8.5", - "sha2 0.9.9", - "stringprep", -] - -[[package]] -name = "postgres-types" -version = "0.2.1" -source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" -dependencies = [ - "bit-vec", - "bytes", - "chrono", - "fallible-iterator", - "postgres-protocol", - "serde", - "serde_json", - "uuid", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" - -[[package]] -name = "pretty-hex" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be91bcc43e73799dc46a6c194a55e7aae1d86cc867c860fd4a436019af21bd8c" - -[[package]] -name = "prisma-client-rust" -version = "0.3.0" -source = "git+https://github.com/Brendonovich/prisma-client-rust.git?branch=master#5d8a5d91ffa18af28e5423eb1aa8a27a93c22bba" -dependencies = [ - "chrono", - "datamodel", - "graphql-parser", - "prisma-models", - "query-core", - "request-handlers", - "serde", - "serde_json", -] - -[[package]] -name = "prisma-inflector" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "once_cell", - "regex", - "unicode-segmentation", -] - -[[package]] -name = "prisma-models" -version = "0.0.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "bigdecimal 0.2.2", - "chrono", - "cuid", - "datamodel", - "itertools 0.10.3", - "once_cell", - "prisma-value", - "quaint", - "rand 0.7.3", - "serde", - "serde_derive", - "serde_json", - "thiserror", - "uuid", -] - -[[package]] -name = "prisma-value" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "base64 0.12.3", - "bigdecimal 0.2.2", - "chrono", - "once_cell", - "quaint", - "regex", - "serde", - "serde_derive", - "serde_json", - "uuid", -] - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro-crate" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" -dependencies = [ - "thiserror", - "toml", -] - -[[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", - "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-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - [[package]] name = "proc-macro2" version = "1.0.36" @@ -4549,413 +136,15 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "prometheus-client" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a896938cc6018c64f279888b8c7559d3725210d5db9a3a1ee6bc7188d51d34" -dependencies = [ - "dtoa", - "itoa", - "owning_ref", - "prometheus-client-derive-text-encode", -] - -[[package]] -name = "prometheus-client-derive-text-encode" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" -dependencies = [ - "bytes", - "heck 0.3.3", - "itertools 0.10.3", - "lazy_static", - "log", - "multimap", - "petgraph 0.6.0", - "prost", - "prost-types", - "regex", - "tempfile", - "which", -] - -[[package]] -name = "prost-derive" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" -dependencies = [ - "anyhow", - "itertools 0.10.3", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-types" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" -dependencies = [ - "bytes", - "prost", -] - -[[package]] -name = "qstring" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "quaint" -version = "0.2.0-alpha.13" -source = "git+https://github.com/prisma/quaint#0b9aa168f5d25b1f752db075ee500e336c31301a" -dependencies = [ - "async-trait", - "base64 0.12.3", - "bigdecimal 0.2.2", - "bit-vec", - "byteorder", - "bytes", - "chrono", - "connection-string", - "either", - "futures", - "hex", - "libsqlite3-sys", - "lru-cache", - "metrics", - "mobc", - "mysql_async", - "native-tls", - "num_cpus", - "percent-encoding", - "postgres-native-tls", - "postgres-types", - "rusqlite", - "serde_json", - "thiserror", - "tiberius", - "tokio", - "tokio-postgres", - "tokio-util", - "tracing", - "tracing-core", - "url", - "uuid", -] - -[[package]] -name = "query-connector" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "anyhow", - "async-trait", - "chrono", - "futures", - "indexmap", - "itertools 0.10.3", - "prisma-models", - "prisma-value", - "serde", - "serde_json", - "thiserror", - "user-facing-errors", - "uuid", -] - -[[package]] -name = "query-core" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "async-trait", - "base64 0.12.3", - "bigdecimal 0.2.2", - "chrono", - "connection-string", - "crossbeam-queue 0.2.3", - "cuid", - "datamodel", - "datamodel-connector", - "futures", - "im", - "indexmap", - "itertools 0.10.3", - "mongodb-client", - "mongodb-query-connector", - "once_cell", - "petgraph 0.4.13", - "pin-utils", - "prisma-inflector", - "prisma-models", - "prisma-value", - "query-connector", - "serde", - "serde_json", - "sql-query-connector", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "url", - "user-facing-errors", - "uuid", -] - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quicksink" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77de3c815e5a160b1539c6592796801df2043ae35e123b46d73380cfa57af858" -dependencies = [ - "futures-core", - "futures-sink", - "pin-project-lite 0.1.12", -] - [[package]] name = "quote" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" +checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" 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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.3", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom 0.2.5", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rayon" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils 0.8.7", - "lazy_static", - "num_cpus", -] - -[[package]] -name = "rebind" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cbc79b47ca94b985302a11dd9f255f73e14e1d86ca9bd4ac4f494b7513bfcf" -dependencies = [ - "itertools 0.4.19", - "piston-viewport", - "pistoncore-input", - "pistoncore-window", - "rustc-serialize", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_syscall" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_users" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" -dependencies = [ - "getrandom 0.2.5", - "redox_syscall 0.2.11", -] - -[[package]] -name = "regex" -version = "1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "request-handlers" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "bigdecimal 0.2.2", - "connection-string", - "datamodel", - "dmmf", - "futures", - "graphql-parser", - "indexmap", - "itertools 0.10.3", - "query-core", - "serde", - "serde_json", - "thiserror", - "tracing", - "url", - "user-facing-errors", -] - -[[package]] -name = "resolv-conf" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" -dependencies = [ - "hostname 0.3.1", - "quick-error", -] - [[package]] name = "ring" version = "0.16.20" @@ -4965,445 +154,10 @@ dependencies = [ "cc", "libc", "once_cell", - "spin 0.5.2", + "spin", "untrusted", "web-sys", - "winapi 0.3.9", -] - -[[package]] -name = "ring" -version = "0.17.0-alpha.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4575a179070909595bea5f999d67934737c2e0757a1eb9839af555917817b257" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted", - "web-sys", - "winapi 0.3.9", -] - -[[package]] -name = "ron" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b861ecaade43ac97886a512b360d01d66be9f41f3c61088b42cedf92e03d678" -dependencies = [ - "base64 0.13.0", - "bitflags 1.3.2", - "serde", -] - -[[package]] -name = "rtnetlink" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f54290e54521dac3de4149d83ddf9f62a359b3cc93bcb494a794a41e6f4744b" -dependencies = [ - "async-global-executor", - "futures", - "log", - "netlink-packet-route", - "netlink-proto", - "nix", - "thiserror", -] - -[[package]] -name = "rusqlite" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4b1eaf239b47034fb450ee9cdedd7d0226571689d8823030c4b6c2cb407152" -dependencies = [ - "bitflags 1.3.2", - "chrono", - "fallible-iterator", - "fallible-streaming-iterator", - "hashlink", - "libsqlite3-sys", - "memchr", - "smallvec", -] - -[[package]] -name = "rust-ini" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63471c4aa97a1cf8332a5f97709a79a4234698de6a1f5087faf66f2dae810e22" -dependencies = [ - "cfg-if 1.0.0", - "ordered-multimap", -] - -[[package]] -name = "rust_decimal" -version = "1.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37baa70cf8662d2ba1c1868c5983dda16ef32b105cce41fb5c47e72936a90b3" -dependencies = [ - "arrayvec 0.7.2", - "num-traits", - "serde", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.6", -] - -[[package]] -name = "rustls" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" -dependencies = [ - "base64 0.13.0", - "log", - "ring 0.16.20", - "sct 0.6.1", - "webpki 0.21.4", -] - -[[package]] -name = "rustls" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921" -dependencies = [ - "log", - "ring 0.16.20", - "sct 0.7.0", - "webpki 0.22.0", -] - -[[package]] -name = "rustls-pemfile" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" -dependencies = [ - "base64 0.13.0", -] - -[[package]] -name = "rustversion" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" - -[[package]] -name = "rw-stream-sink" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" -dependencies = [ - "futures", - "pin-project 0.4.29", - "static_assertions", -] - -[[package]] -name = "ryu" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" - -[[package]] -name = "salsa20" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0fbb5f676da676c260ba276a8f43a8dc67cf02d1438423aeb1c677a7212686" -dependencies = [ - "cipher", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" -dependencies = [ - "lazy_static", - "winapi 0.3.9", -] - -[[package]] -name = "schema-ast" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "diagnostics", - "pest", - "pest_derive", -] - -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring 0.16.20", - "untrusted", -] - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring 0.16.20", - "untrusted", -] - -[[package]] -name = "sdcorelib" -version = "0.1.0" -dependencies = [ - "anyhow", - "async-trait", - "base64 0.13.0", - "bytesize", - "cargo-edit", - "chrono", - "config", - "data-encoding", - "dyn-clone", - "env_logger", - "futures", - "hostname 0.3.1", - "hotwatch", - "include_dir", - "int-enum", - "lazy_static", - "libp2p", - "log", - "mime", - "once_cell", - "prisma-client-rust", - "rebind", - "ring 0.17.0-alpha.11", - "serde", - "serde_json", - "sha256", - "strum", - "swift-rs", - "sysinfo", - "thiserror", - "thumbnailer", - "tokio", - "ts-rs", - "uuid", - "walkdir", -] - -[[package]] -name = "security-framework" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d" -dependencies = [ - "serde", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.136" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.136" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec1e6ec4d8950e5b1e894eac0d360742f3b1407a6078a604a731c4b3f49cefbc" -dependencies = [ - "rustversion", - "serde", - "serde_with_macros", -] - -[[package]] -name = "serde_with_macros" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - -[[package]] -name = "sha-1" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[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", + "winapi", ] [[package]] @@ -5412,22 +166,11 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", + "block-buffer", + "cfg-if", "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - -[[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", + "digest", + "opaque-debug", ] [[package]] @@ -5437,148 +180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e84a7f596c081d359de5e06a83877138bc3c4483591e1af1916e1472e6e146e" dependencies = [ "hex", - "sha2 0.9.9", -] - -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug 0.3.0", -] - -[[package]] -name = "shader_version" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476a6f59085a3b8ba2d1127d3f3d9d3b100bbc60301a6a557a405313ea99096f" - -[[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 = "shlex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" - -[[package]] -name = "signature" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" - -[[package]] -name = "siphasher" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" - -[[package]] -name = "sized-chunks" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f01db57d7ee89c8e053245deb77040a6cc8508311f381c88749c33d4b9b78785" -dependencies = [ - "typenum", -] - -[[package]] -name = "slab" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" - -[[package]] -name = "smallvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" - -[[package]] -name = "smartstring" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e714dff2b33f2321fdcd475b71cec79781a692d846f37f415fb395a1d2bcd48e" -dependencies = [ - "serde", - "static_assertions", -] - -[[package]] -name = "snow" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" -dependencies = [ - "aes-gcm", - "blake2", - "chacha20poly1305", - "curve25519-dalek 4.0.0-pre.2", - "rand_core 0.6.3", - "ring 0.16.20", - "rustc_version 0.4.0", - "sha2 0.10.2", - "subtle", -] - -[[package]] -name = "socket2" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "socket2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "socks" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b" -dependencies = [ - "byteorder", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "soketto" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" -dependencies = [ - "base64 0.13.0", - "bytes", - "flate2", - "futures", - "httparse", - "log", - "rand 0.8.5", - "sha-1 0.9.8", + "sha2", ] [[package]] @@ -5587,940 +189,48 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "spin" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" -dependencies = [ - "lock_api 0.4.6", -] - -[[package]] -name = "sql-datamodel-connector" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "datamodel-connector", - "enumflags2", - "native-types", - "once_cell", - "regex", - "serde_json", -] - -[[package]] -name = "sql-query-connector" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "anyhow", - "async-trait", - "bigdecimal 0.2.2", - "chrono", - "cuid", - "datamodel", - "futures", - "itertools 0.10.3", - "once_cell", - "opentelemetry", - "prisma-models", - "prisma-value", - "quaint", - "query-connector", - "rand 0.7.3", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "tracing-opentelemetry", - "user-facing-errors", - "uuid", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "stringprep" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "strum" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn", -] - -[[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 = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "swift-rs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31aa5c69d3be879a07d9a0eb0ad1a424301849061fff96294569b61dd137d2f" -dependencies = [ - "base64 0.13.0", - "serde", - "serde_json", -] - [[package]] name = "syn" -version = "1.0.86" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" +checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f" dependencies = [ "proc-macro2", "quote", "unicode-xid", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "sysinfo" -version = "0.23.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fa4c84a5305909b0eedfcc8d1f2fafdbede645bb700a45ecaafe681a0ac5d6" -dependencies = [ - "cfg-if 1.0.0", - "core-foundation-sys", - "libc", - "ntapi", - "once_cell", - "rayon", - "winapi 0.3.9", -] - -[[package]] -name = "system-configuration" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "take_mut" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if 1.0.0", - "fastrand", - "libc", - "redox_syscall 0.2.11", - "remove_dir_all", - "winapi 0.3.9", -] - -[[package]] -name = "term_size" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "term_size", - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" -dependencies = [ - "once_cell", -] - -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "thumbnailer" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16c652b0061a3f3500284063fab527dc5e2dbd015905fcd08c5bd471c52a338b" -dependencies = [ - "image", - "lazy_static", - "mime", - "rayon", - "tempfile", - "webp", -] - -[[package]] -name = "tiberius" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00035fdbcee3e791e756d1831a1b9a89e414c320d3eccdae65aba4f388216c30" -dependencies = [ - "async-native-tls", - "async-trait", - "asynchronous-codec 0.5.0", - "bigdecimal 0.2.2", - "byteorder", - "bytes", - "chrono", - "connection-string", - "encoding", - "enumflags2", - "futures", - "futures-sink", - "futures-util", - "num-traits", - "once_cell", - "opentls", - "pin-project-lite 0.2.8", - "pretty-hex", - "thiserror", - "tokio", - "tokio-util", - "tracing", - "uuid", - "winauth", -] - -[[package]] -name = "tiff" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0247608e998cb6ce39dfc8f4a16c50361ce71e5b52e6d24ea1227ea8ea8ee0b2" -dependencies = [ - "flate2", - "jpeg-decoder 0.1.22", - "weezl", -] - -[[package]] -name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "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 = "tinyvec" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "tokio" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" -dependencies = [ - "bytes", - "libc", - "memchr", - "mio 0.8.1", - "num_cpus", - "pin-project-lite 0.2.8", - "socket2 0.4.4", - "tokio-macros", - "winapi 0.3.9", -] - -[[package]] -name = "tokio-macros" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "git+https://github.com/pimeys/tls?branch=vendored-openssl#6d0e6fc7a4bf6f290b1033764b47cb3f26d7fceb" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-postgres" -version = "0.7.1" -source = "git+https://github.com/pimeys/rust-postgres?branch=pgbouncer-mode#8a61d46905571ff2b530b204dfa7c56ccbace7f4" -dependencies = [ - "async-trait", - "byteorder", - "bytes", - "fallible-iterator", - "futures", - "log", - "parking_lot 0.11.2", - "percent-encoding", - "phf", - "pin-project-lite 0.2.8", - "postgres-protocol", - "postgres-types", - "socket2 0.4.4", - "tokio", - "tokio-util", -] - -[[package]] -name = "tokio-rustls" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" -dependencies = [ - "rustls 0.19.1", - "tokio", - "webpki 0.21.4", -] - -[[package]] -name = "tokio-util" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" -dependencies = [ - "bytes", - "futures-core", - "futures-io", - "futures-sink", - "log", - "pin-project-lite 0.2.8", - "tokio", -] - -[[package]] -name = "toml" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d30834716e93eef7db510648299f647427858e7e2c0beeec2699ea2289c7739" -dependencies = [ - "combine 4.6.3", - "indexmap", - "itertools 0.10.3", - "serde", - "vec1", -] - -[[package]] -name = "tracing" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" -dependencies = [ - "cfg-if 1.0.0", - "log", - "pin-project-lite 0.2.8", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c" -dependencies = [ - "lazy_static", - "valuable", -] - -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project 1.0.10", - "tracing", -] - -[[package]] -name = "tracing-log" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" -dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-opentelemetry" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ffbf13a0f8b054a4e59df3a173b818e9c6177c02789871f2073977fd0062076" -dependencies = [ - "opentelemetry", - "tracing", - "tracing-core", - "tracing-log", - "tracing-subscriber", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e0ab7bdc962035a87fba73f3acca9b8a8d0034c2e6f60b84aeaaddddc155dce" -dependencies = [ - "sharded-slab", - "thread_local", - "tracing-core", -] - -[[package]] -name = "trust-dns-proto" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca94d4e9feb6a181c690c4040d7a24ef34018d8313ac5044a61d21222ae24e31" -dependencies = [ - "async-trait", - "cfg-if 1.0.0", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna", - "ipnet", - "lazy_static", - "log", - "rand 0.8.5", - "smallvec", - "thiserror", - "tinyvec", - "tokio", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecae383baad9995efaa34ce8e57d12c3f305e545887472a492b838f4b5cfb77a" -dependencies = [ - "cfg-if 1.0.0", - "futures-util", - "ipconfig", - "lazy_static", - "log", - "lru-cache", - "parking_lot 0.11.2", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "trust-dns-proto", -] - -[[package]] -name = "ts-rs" -version = "6.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d26cba30c9b3a2f537f765cf754126f11c983b7426d280ae0b4cef2374cab98" -dependencies = [ - "thiserror", - "ts-rs-macros", -] - -[[package]] -name = "ts-rs-macros" -version = "6.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd8e302fbcf5b60dfa1df443535967511442c5ce4eac8b4c9fa811f2274280a4" -dependencies = [ - "Inflector", - "proc-macro2", - "quote", - "syn", - "termcolor", -] - -[[package]] -name = "twox-hash" -version = "1.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee73e6e4924fe940354b8d4d98cad5231175d615cd855b758adc658c0aac6a0" -dependencies = [ - "cfg-if 1.0.0", - "rand 0.8.5", - "static_assertions", -] - -[[package]] -name = "typed-builder" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a46ee5bd706ff79131be9c94e7edcb82b703c487766a114434e5790361cf08c5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "typenum" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "uint" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" - -[[package]] -name = "unicode-normalization" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" -[[package]] -name = "unindent" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514672a55d7380da379785a4d70ca8386c8883ff7eaae877be4d2081cebe73d8" - -[[package]] -name = "universal-hash" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" -dependencies = [ - "generic-array 0.14.5", - "subtle", -] - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -dependencies = [ - "void", -] - -[[package]] -name = "unsigned-varint" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes", - "futures-io", - "futures-util", -] - [[package]] name = "untrusted" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" -[[package]] -name = "ureq" -version = "1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8b063c2d59218ae09f22b53c42eaad0d53516457905f5235ca4bc9e99daa71" -dependencies = [ - "base64 0.13.0", - "chunked_transfer", - "log", - "once_cell", - "qstring", - "rustls 0.19.1", - "serde", - "serde_json", - "socks", - "url", - "webpki 0.21.4", - "webpki-roots 0.21.1", -] - -[[package]] -name = "url" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" -dependencies = [ - "form_urlencoded", - "idna", - "matches", - "percent-encoding", -] - -[[package]] -name = "user-facing-error-macros" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "user-facing-errors" -version = "0.1.0" -source = "git+https://github.com/prisma/prisma-engines?tag=3.10.0#73e60b76d394f8d37d8ebd1f8918c79029f0db86" -dependencies = [ - "backtrace", - "indoc", - "quaint", - "serde", - "serde_json", - "tracing", - "user-facing-error-macros", -] - -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom 0.2.5", - "serde", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "value-bag" -version = "1.0.0-alpha.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" -dependencies = [ - "ctor", - "version_check", -] - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "vec1" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc1631c774f0f9570797191e01247cbefde789eebfbf128074cb934115a6133" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - -[[package]] -name = "walkdir" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "wasm-bindgen" version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -6539,18 +249,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.79" @@ -6580,21 +278,6 @@ version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" -[[package]] -name = "wasm-timer" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" -dependencies = [ - "futures", - "js-sys", - "parking_lot 0.11.2", - "pin-utils", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "web-sys" version = "0.3.56" @@ -6605,92 +288,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webp" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f80f6a431ea17cbe9d6958628e553c17d22df62b301b39940a9dfd60f3dd7c6" -dependencies = [ - "image", - "libwebp-sys", -] - -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring 0.16.20", - "untrusted", -] - -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring 0.16.20", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" -dependencies = [ - "webpki 0.21.4", -] - -[[package]] -name = "webpki-roots" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552ceb903e957524388c4d3475725ff2c8b7960922063af6ce53c9a43da07449" -dependencies = [ - "webpki 0.22.0", -] - -[[package]] -name = "weezl" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b77fdfd5a253be4ab714e4ffa3c49caf146b4de743e97510c0656cf90f1e8e" - -[[package]] -name = "wepoll-ffi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" -dependencies = [ - "cc", -] - -[[package]] -name = "which" -version = "4.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5a7e487e921cf220206864a94a89b6c6905bfc19f1057fa26a4cb360e5c1d2" -dependencies = [ - "either", - "lazy_static", - "libc", -] - -[[package]] -name = "widestring" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -6701,220 +298,14 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "winauth" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f820cd208ce9c6b050812dc2d724ba98c6c1e9db5ce9b3f58d925ae5723a5e6" -dependencies = [ - "bitflags 1.3.2", - "byteorder", - "md5", - "rand 0.7.3", - "winapi 0.3.9", -] - -[[package]] -name = "windows" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac7fef12f4b59cd0a29339406cc9203ab44e440ddff6b3f5a41455349fa9cf3" -dependencies = [ - "windows_aarch64_msvc 0.29.0", - "windows_i686_gnu 0.29.0", - "windows_i686_msvc 0.29.0", - "windows_x86_64_gnu 0.29.0", - "windows_x86_64_msvc 0.29.0", -] - -[[package]] -name = "windows-sys" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" -dependencies = [ - "windows_aarch64_msvc 0.32.0", - "windows_i686_gnu 0.32.0", - "windows_i686_msvc 0.32.0", - "windows_x86_64_gnu 0.32.0", - "windows_x86_64_msvc 0.32.0", -] - -[[package]] -name = "windows_aarch64_msvc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d027175d00b01e0cbeb97d6ab6ebe03b12330a35786cbaca5252b1c4bf5d9b" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" - -[[package]] -name = "windows_i686_gnu" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8793f59f7b8e8b01eda1a652b2697d87b93097198ae85f823b969ca5b89bba58" - -[[package]] -name = "windows_i686_gnu" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" - -[[package]] -name = "windows_i686_msvc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8602f6c418b67024be2996c512f5f995de3ba417f4c75af68401ab8756796ae4" - -[[package]] -name = "windows_i686_msvc" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d615f419543e0bd7d2b3323af0d86ff19cbc4f816e6453f36a2c2ce889c354" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d95421d9ed3672c280884da53201a5c46b7b2765ca6faf34b0d71cf34a3561" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" - -[[package]] -name = "winreg" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "winutil" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "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 = "x25519-dalek" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2392b6b94a576b4e2bf3c5b2757d63f10ada8020a2e4d08ac849ebcf6ea8e077" -dependencies = [ - "curve25519-dalek 3.2.1", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "yamux" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29d4c1dd079043fe673e79fe3c3a260ae2d2fb413f1062cae9e062748df0df03" -dependencies = [ - "futures", - "log", - "nohash-hasher", - "parking_lot 0.11.2", - "rand 0.8.5", - "static_assertions", -] - -[[package]] -name = "zeroize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] diff --git a/apps/debug/Cargo.toml b/apps/debug/Cargo.toml index 09f8c4304..1a0c8a57d 100644 --- a/apps/debug/Cargo.toml +++ b/apps/debug/Cargo.toml @@ -6,4 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sdcorelib = { path = "../../packages/core" } \ No newline at end of file +anyhow = "1.0.56" +data-encoding = "2.3.2" +ring = "0.16.20" +sha256 = "1.0.3" +# sdcorelib = { path = "../../packages/core" } \ No newline at end of file diff --git a/apps/debug/src/main.rs b/apps/debug/src/main.rs index 78f41770f..494dbfc34 100644 --- a/apps/debug/src/main.rs +++ b/apps/debug/src/main.rs @@ -1,13 +1,87 @@ -fn main() { - // let mounts = match get() { - // Ok(mounts) => mounts, - // Err(e) => { - // dbg!(e); - // return; - // } - // }; +#![allow(dead_code)] - // for mount in mounts { - // dbg!(mount); - // } +use anyhow::Result; +use data_encoding::HEXLOWER; +use ring::digest::{Context, SHA256}; +use std::fs::{self, File}; +use std::io::{BufReader, Read}; +use std::os::unix::prelude::FileExt; +use std::time::Instant; + +static BIG_FILE: &str = "/Users/jamie/Movies/2022-03-08 06-08-35.mkv"; +static LITTLE_FILE: &str = "/Users/jamie/Movies/client_state.json"; + +fn main() { + println!("Generating hash from file {:?}", BIG_FILE); + + let start = Instant::now(); + let checksum = sampled_checksum(BIG_FILE).unwrap(); + println!( + "Sampled checksum completed in {:?} {}", + start.elapsed(), + checksum + ); + + let start = Instant::now(); + let checksum = full_checksum(BIG_FILE).unwrap(); + println!( + "Full checksum completed in {:?} {}", + start.elapsed(), + checksum + ); +} + +static SAMPLE_COUNT: u64 = 6; +static SAMPLE_SIZE: u64 = 10000; + +pub fn sampled_checksum(path: &str) -> Result { + // get file size + let metadata = fs::metadata(path)?; + let size = metadata.len(); + // open file reference + let file = File::open(path)?; + + let mut context = Context::new(&SHA256); + // if size is small enough, just read the whole thing + if SAMPLE_COUNT * SAMPLE_SIZE > size { + let mut buf = vec![0u8; size.try_into()?]; + file.read_exact_at(&mut buf, 0)?; + context.update(&buf); + } else { + // loop over samples + for i in 0..SAMPLE_COUNT { + let start_point = (size / SAMPLE_COUNT) * i; + let mut buf = vec![0u8; SAMPLE_SIZE.try_into()?]; + file.read_exact_at(&mut buf, start_point)?; + context.update(&buf); + } + // sample end of file + let mut buf = vec![0u8; SAMPLE_SIZE.try_into()?]; + file.read_exact_at(&mut buf, size - SAMPLE_SIZE)?; + context.update(&buf); + } + + let digest = context.finish(); + let hex = HEXLOWER.encode(digest.as_ref()); + + Ok(hex) +} + +pub fn full_checksum(path: &str) -> Result { + // read file as buffer and convert to digest + let mut reader = BufReader::new(File::open(path).unwrap()); + let mut context = Context::new(&SHA256); + let mut buffer = [0; 1024]; + loop { + let count = reader.read(&mut buffer)?; + if count == 0 { + break; + } + context.update(&buffer[..count]); + } + let digest = context.finish(); + // create a lowercase hash from + let hex = HEXLOWER.encode(digest.as_ref()); + + Ok(hex) } diff --git a/apps/desktop/src/components/primitive/Codeblock.tsx b/apps/desktop/src/components/primitive/Codeblock.tsx new file mode 100644 index 000000000..8df3806cc --- /dev/null +++ b/apps/desktop/src/components/primitive/Codeblock.tsx @@ -0,0 +1,23 @@ +import React from 'react'; +import ReactJson, { ReactJsonViewProps } from 'react-json-view'; + +export interface CodeBlockProps extends ReactJsonViewProps {} + +export default function CodeBlock(props: CodeBlockProps) { + return ( + + ); +} diff --git a/docs/FileIndexing.md b/docs/FileIndexing.md new file mode 100644 index 000000000..9bcbfd73f --- /dev/null +++ b/docs/FileIndexing.md @@ -0,0 +1,4 @@ + +- Initial scan, ingest file paths into database. +- Query file_paths for all paths without a File identifier, chunks of 100 oldest to newest +- \ No newline at end of file diff --git a/packages/core/prisma/migrations/20220329045012_/migration.sql b/packages/core/prisma/migrations/20220329045012_/migration.sql new file mode 100644 index 000000000..040625797 --- /dev/null +++ b/packages/core/prisma/migrations/20220329045012_/migration.sql @@ -0,0 +1,52 @@ +/* + Warnings: + + - You are about to drop the column `extension` on the `files` table. All the data in the column will be lost. + - You are about to drop the column `id_hash` on the `files` table. All the data in the column will be lost. + - You are about to drop the column `name` on the `files` table. All the data in the column will be lost. + - Added the required column `partial_checksum` to the `files` table without a default value. This is not possible if the table is not empty. + - Added the required column `name` to the `file_paths` table without a default value. This is not possible if the table is not empty. + +*/ +-- RedefineTables +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_files" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "type" INTEGER NOT NULL DEFAULT 0, + "size_in_bytes" TEXT NOT NULL, + "partial_checksum" TEXT NOT NULL, + "checksum" TEXT, + "encryption" INTEGER NOT NULL DEFAULT 0, + "ipfs_id" TEXT, + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date_indexed" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +); +INSERT INTO "new_files" ("checksum", "date_created", "date_indexed", "date_modified", "encryption", "id", "ipfs_id", "size_in_bytes") SELECT "checksum", "date_created", "date_indexed", "date_modified", "encryption", "id", "ipfs_id", "size_in_bytes" FROM "files"; +DROP TABLE "files"; +ALTER TABLE "new_files" RENAME TO "files"; +CREATE UNIQUE INDEX "files_checksum_key" ON "files"("checksum"); +CREATE TABLE "new_file_paths" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "is_dir" BOOLEAN NOT NULL DEFAULT false, + "location_id" INTEGER NOT NULL, + "materialized_path" TEXT NOT NULL, + "name" TEXT NOT NULL, + "extension" TEXT, + "file_id" INTEGER, + "parent_id" INTEGER, + "encryption" INTEGER NOT NULL DEFAULT 0, + "permissions" TEXT, + "date_created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date_modified" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date_indexed" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT "file_paths_location_id_fkey" FOREIGN KEY ("location_id") REFERENCES "locations" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT "file_paths_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "files" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "file_paths_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "file_paths" ("id") ON DELETE SET NULL ON UPDATE CASCADE +); +INSERT INTO "new_file_paths" ("date_indexed", "file_id", "id", "is_dir", "location_id", "materialized_path", "parent_id", "permissions") SELECT "date_indexed", "file_id", "id", "is_dir", "location_id", "materialized_path", "parent_id", "permissions" FROM "file_paths"; +DROP TABLE "file_paths"; +ALTER TABLE "new_file_paths" RENAME TO "file_paths"; +CREATE UNIQUE INDEX "file_paths_location_id_materialized_path_name_extension_key" ON "file_paths"("location_id", "materialized_path", "name", "extension"); +PRAGMA foreign_key_check; +PRAGMA foreign_keys=ON; diff --git a/packages/core/prisma/schema.prisma b/packages/core/prisma/schema.prisma index e4fab96b9..24920eb68 100644 --- a/packages/core/prisma/schema.prisma +++ b/packages/core/prisma/schema.prisma @@ -78,17 +78,17 @@ model Location { } model File { - id Int @id @default(autoincrement()) - id_hash String @unique - name String - extension String? - checksum String? - size_in_bytes String - encryption Int @default(0) + id Int @id @default(autoincrement()) + kind Int @default(0) + size_in_bytes String + partial_checksum String + checksum String? @unique + encryption Int @default(0) + ipfs_id String? + date_created DateTime @default(now()) date_modified DateTime @default(now()) date_indexed DateTime @default(now()) - ipfs_id String? file_tags TagOnFile[] file_labels LabelOnFile[] @@ -98,20 +98,27 @@ model File { } model FilePath { - id Int @id @default(autoincrement()) - is_dir Boolean @default(false) - materialized_path String - file_id Int? - file File? @relation(fields: [file_id], references: [id], onDelete: Cascade, onUpdate: Cascade) - parent_id Int? - parent FilePath? @relation("directory_file_paths", fields: [parent_id], references: [id]) - children FilePath[] @relation("directory_file_paths") + id Int @id @default(autoincrement()) + is_dir Boolean @default(false) location_id Int - location Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction) - date_indexed DateTime @default(now()) + materialized_path String + name String + extension String? + file_id Int? + parent_id Int? + encryption Int @default(0) permissions String? - @@unique([location_id, materialized_path, file_id]) + date_created DateTime @default(now()) + date_modified DateTime @default(now()) + date_indexed DateTime @default(now()) + + file File? @relation(fields: [file_id], references: [id], onDelete: Cascade, onUpdate: Cascade) + location Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction) + parent FilePath? @relation("directory_file_paths", fields: [parent_id], references: [id]) + children FilePath[] @relation("directory_file_paths") + + @@unique([location_id, materialized_path, name, extension]) @@map("file_paths") } diff --git a/packages/core/src/file/checksum.rs b/packages/core/src/file/checksum.rs index b326ae6b6..1d48bb029 100644 --- a/packages/core/src/file/checksum.rs +++ b/packages/core/src/file/checksum.rs @@ -1,9 +1,62 @@ +use anyhow::Result; use data_encoding::HEXLOWER; use ring::digest::{Context, Digest, SHA256}; -use sha256::digest; -use std::io; -use std::io::{BufReader, Read}; -use std::time::Instant; +use std::convert::TryInto; +use std::fs::{self, File}; +use std::io::{self, BufReader, Read}; +use std::os::unix::prelude::FileExt; + +static SAMPLE_COUNT: u64 = 4; +static SAMPLE_SIZE: u64 = 10000; + +pub fn partial_checksum(path: &str, size: u64) -> Result { + // open file reference + let file = File::open(path)?; + + let mut context = Context::new(&SHA256); + // if size is small enough, just read the whole thing + if SAMPLE_COUNT * SAMPLE_SIZE > size { + let mut buf = vec![0u8; size.try_into()?]; + file.read_exact_at(&mut buf, 0)?; + context.update(&buf); + } else { + // loop over samples + for i in 0..SAMPLE_COUNT { + let start_point = (size / SAMPLE_COUNT) * i; + let mut buf = vec![0u8; SAMPLE_SIZE.try_into()?]; + file.read_exact_at(&mut buf, start_point)?; + context.update(&buf); + } + // sample end of file + let mut buf = vec![0u8; SAMPLE_SIZE.try_into()?]; + file.read_exact_at(&mut buf, size - SAMPLE_SIZE)?; + context.update(&buf); + } + + let digest = context.finish(); + let hex = HEXLOWER.encode(digest.as_ref()); + + Ok(hex) +} + +pub fn full_checksum(path: &str) -> Result { + // read file as buffer and convert to digest + let mut reader = BufReader::new(File::open(path).unwrap()); + let mut context = Context::new(&SHA256); + let mut buffer = [0; 1024]; + loop { + let count = reader.read(&mut buffer)?; + if count == 0 { + break; + } + context.update(&buffer[..count]); + } + let digest = context.finish(); + // create a lowercase hash from + let hex = HEXLOWER.encode(digest.as_ref()); + + Ok(hex) +} pub fn sha256_digest(mut reader: R) -> io::Result { let mut context = Context::new(&SHA256); @@ -17,17 +70,3 @@ pub fn sha256_digest(mut reader: R) -> io::Result { } Ok(context.finish()) } - -pub async fn create_buffer_checksum(path: &str) -> io::Result { - let start = Instant::now(); - // read file as buffer and convert to digest - let digest = sha256_digest(BufReader::new(std::fs::File::open(path)?))?; - // create a lowercase hash from - let hex = HEXLOWER.encode(digest.as_ref()); - println!("hashing complete in {:?} {}", start.elapsed(), hex); - Ok(hex) -} - -pub fn create_meta_integrity_hash(uri: &str) -> io::Result { - Ok(digest(format!("{}", uri))) -} diff --git a/packages/core/src/file/indexer.rs b/packages/core/src/file/indexer.rs index ca5619571..059692706 100644 --- a/packages/core/src/file/indexer.rs +++ b/packages/core/src/file/indexer.rs @@ -5,9 +5,12 @@ use crate::util::time; use crate::CoreContext; use anyhow::{anyhow, Result}; use serde::{Deserialize, Serialize}; +use std::ffi::OsStr; use std::{collections::HashMap, fs, path::Path, path::PathBuf, time::Instant}; use walkdir::{DirEntry, WalkDir}; +use super::checksum::partial_checksum; + #[derive(Debug)] pub struct IndexerJob { pub path: String, @@ -73,6 +76,7 @@ pub async fn scan_path( } let dir_path = path.clone(); + // spawn a dedicated thread to scan the directory for performance let (paths, scan_start, on_progress) = tokio::task::spawn_blocking(move || { // store every valid path discovered let mut paths: Vec<(PathBuf, i64, Option)> = Vec::new(); @@ -163,13 +167,13 @@ pub async fn scan_path( } let raw_sql = format!( r#" - INSERT INTO file_paths (id, is_dir, location_id, parent_id, materialized_path, date_indexed) + INSERT INTO file_paths (id, is_dir, location_id, materialized_path, name, extension, parent_id, date_indexed) VALUES {} "#, files.join(", ") ); - let _count = db._execute_raw(&raw_sql).await; - // println!("Inserted {:?} records", count); + let count = db._execute_raw(&raw_sql).await; + println!("Inserted {:?} records", count); } println!( "scan of {:?} completed in {:?}. {:?} files found. db write completed in {:?}", @@ -191,7 +195,7 @@ fn prepare_values( let metadata = fs::metadata(&file_path)?; let location_path = location.path.as_ref().unwrap().as_str(); // let size = metadata.len(); - // let name = extract_name(file_path.file_stem()); + let name = extract_name(file_path.file_stem()); // let extension = extract_name(file_path.extension()); let materialized_path = match file_path.to_str() { @@ -203,43 +207,44 @@ fn prepare_values( None => return Err(anyhow!("{}", file_path.to_str().unwrap_or_default())), }; - Ok(format!( - "({}, {}, {}, {}, \"{}\", \"{}\")", + let partial_checksum = { + if !metadata.is_dir() { + partial_checksum(&file_path.to_str().unwrap(), metadata.len()).unwrap() + } else { + "".to_string() + } + }; + + let values = format!( + "({}, {}, {}, \"{}\", \"{}\", \"{}\", \"{}\", \"{}\")", id, metadata.is_dir(), location.id, + materialized_path, + name, + partial_checksum, parent_id .clone() .map(|id| id.to_string()) .unwrap_or("NULL".to_string()), - materialized_path, - // &size.to_string(), &time::system_time_to_date_time(metadata.created()) .unwrap() .to_string(), - // &time::system_time_to_date_time(metadata.modified()).unwrap().to_string(), - )) -} + ); -pub async fn test_scan(path: &str) -> Result<()> { - let mut count: u32 = 0; - for entry in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) { - let child_path = entry.path().to_str().unwrap(); - count = count + 1; - println!("Reading file from dir {:?}", child_path); - } - println!("files found {}", count); - Ok(()) + println!("{}", values); + + Ok(values) } // extract name from OsStr returned by PathBuff -// fn extract_name(os_string: Option<&OsStr>) -> String { -// os_string -// .unwrap_or_default() -// .to_str() -// .unwrap_or_default() -// .to_owned() -// } +fn extract_name(os_string: Option<&OsStr>) -> String { + os_string + .unwrap_or_default() + .to_str() + .unwrap_or_default() + .to_owned() +} fn is_hidden(entry: &DirEntry) -> bool { entry @@ -284,47 +289,3 @@ fn is_app_bundle(entry: &DirEntry) -> bool { is_app_bundle } -// pub async fn scan_loc(core: &mut Core, location: &LocationResource) -> Result<()> { -// // get location by location_id from db and include location_paths -// // let job = core.queue( -// // job::JobResource::new(core.state.client_uuid.clone(), job::JobAction::ScanLoc, 1, |loc| { -// // if let Some(path) = &loc.path { -// // scan_path(core, path).await?; -// // watch_dir(path); -// // } -// // }) -// // .await?, -// // ); - -// Ok(()) -// } -// pub async fn scan_loc(core: &mut Core, location: &LocationResource) -> Result<()> { -// // get location by location_id from db and include location_paths -// let job = core.queue( -// job::JobResource::new( -// core.state.client_uuid.clone(), -// job::JobAction::ScanLoc, -// 1, -// Some(vec![location.path.as_ref().unwrap().to_string()]), -// ) -// .await?, -// ); - -// if let Some(path) = &location.path { -// scan_path(core, path).await?; -// watch_dir(path); -// } -// Ok(()) -// } - -// impl From for JobReportUpdate { -// fn from(progress: ScanProgress) -> Self { -// match progress { -// ScanProgress::ChunkCount(count) => JobReportUpdate::TaskCount(count), -// ScanProgress::SavedChunks(count) => { -// JobReportUpdate::CompletedTaskCount(count) -// }, -// ScanProgress::Message(message) => JobReportUpdate::Message(message), -// } -// } -// } diff --git a/packages/core/src/file/mod.rs b/packages/core/src/file/mod.rs index 720190045..6b42f155f 100644 --- a/packages/core/src/file/mod.rs +++ b/packages/core/src/file/mod.rs @@ -14,13 +14,12 @@ pub mod indexer; pub mod thumb; pub mod watcher; +// A unique file #[derive(Debug, Clone, Serialize, Deserialize, TS)] #[ts(export)] pub struct File { pub id: i64, - pub id_hash: String, - pub name: String, - pub extension: Option, + pub partial_checksum: String, pub checksum: Option, pub size_in_bytes: String, pub encryption: EncryptionAlgorithm, @@ -35,15 +34,16 @@ pub struct File { pub file_paths: Vec, } +// A physical file path #[derive(Debug, Clone, Serialize, Deserialize, TS)] #[ts(export)] pub struct FilePath { pub id: i64, pub is_dir: bool, + pub location_id: i64, pub materialized_path: String, pub file_id: Option, pub parent_id: Option, - pub location_id: i64, #[ts(type = "string")] pub date_indexed: chrono::DateTime, pub permissions: Option, @@ -68,9 +68,7 @@ impl Into for FileData { fn into(self) -> File { File { id: self.id, - id_hash: self.id_hash, - name: self.name, - extension: self.extension, + partial_checksum: self.partial_checksum, checksum: self.checksum, size_in_bytes: self.size_in_bytes.to_string(), encryption: EncryptionAlgorithm::from_int(self.encryption).unwrap(), diff --git a/packages/core/src/prisma.rs b/packages/core/src/prisma.rs index 6def7ba2c..d1d50cf30 100644 --- a/packages/core/src/prisma.rs +++ b/packages/core/src/prisma.rs @@ -2,9 +2,15 @@ use prisma_client_rust::datamodel::parse_configuration; use prisma_client_rust::prisma_models::InternalDataModelBuilder; -use prisma_client_rust::query::*; -use prisma_client_rust::query_core::{executor, schema_builder, BuildMode, CoreError, QueryExecutor, QuerySchema}; -use prisma_client_rust::{chrono, operator::Operator, serde_json, DeleteResult}; +use prisma_client_rust::query::{ + transform_equals, Field, Input, Output, Query, QueryContext, Result as QueryResult, +}; +use prisma_client_rust::query_core::{ + executor, schema_builder, BuildMode, QueryExecutor, QuerySchema, +}; +use prisma_client_rust::{ + chrono, operator::Operator, serde_json, DeleteResult, Direction, +}; use serde::{Deserialize, Serialize}; use std::path::Path; use std::sync::Arc; @@ -13,7 +19,7 @@ pub struct PrismaClient { query_schema: Arc, } pub async fn new_client() -> PrismaClient { - let datamodel_str = "datasource db {\n provider = \"sqlite\"\n url = \"file:dev.db\"\n}\n\ngenerator client {\n provider = \"prisma-client-rust\"\n output = \"../src/prisma.rs\"\n}\n\nmodel Migration {\n id Int @id @default(autoincrement())\n name String\n checksum String @unique\n steps_applied Int @default(0)\n applied_at DateTime @default(now())\n\n @@map(\"_migrations\")\n}\n\nmodel Library {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n remote_id String?\n is_primary Boolean @default(true)\n encryption Int @default(0)\n date_created DateTime @default(now())\n timezone String?\n spaces Space[]\n\n @@map(\"libraries\")\n}\n\nmodel LibraryStatistics {\n id Int @id @default(autoincrement())\n date_captured DateTime @default(now())\n library_id Int @unique\n total_file_count Int @default(0)\n total_bytes_used String @default(\"0\")\n total_byte_capacity String @default(\"0\")\n total_unique_bytes String @default(\"0\")\n\n @@map(\"library_statistics\")\n}\n\nmodel Client {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n platform Int @default(0)\n version String?\n online Boolean? @default(true)\n last_seen DateTime @default(now())\n timezone String?\n date_created DateTime @default(now())\n // jobs Job[]\n\n @@map(\"clients\")\n}\n\nmodel Location {\n id Int @id @default(autoincrement())\n name String?\n local_path String?\n total_capacity Int?\n available_capacity Int?\n filesystem String?\n disk_type Int?\n is_removable Boolean @default(true)\n is_ejectable Boolean @default(true)\n is_root_filesystem Boolean @default(true)\n is_online Boolean @default(true)\n date_created DateTime @default(now())\n\n file_paths FilePath[]\n @@map(\"locations\")\n}\n\nmodel File {\n id Int @id @default(autoincrement())\n id_hash String @unique\n name String\n extension String?\n checksum String?\n size_in_bytes String\n encryption Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n date_indexed DateTime @default(now())\n ipfs_id String?\n\n file_tags TagOnFile[]\n file_labels LabelOnFile[]\n file_paths FilePath[]\n comments Comment[]\n @@map(\"files\")\n}\n\nmodel FilePath {\n id Int @id @default(autoincrement())\n is_dir Boolean @default(false)\n materialized_path String\n file_id Int?\n file File? @relation(fields: [file_id], references: [id], onDelete: Cascade, onUpdate: Cascade)\n parent_id Int?\n parent FilePath? @relation(\"directory_file_paths\", fields: [parent_id], references: [id])\n children FilePath[] @relation(\"directory_file_paths\")\n location_id Int\n location Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n date_indexed DateTime @default(now())\n permissions String?\n\n @@unique([location_id, materialized_path, file_id])\n @@map(\"file_paths\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String?\n encryption Int? @default(0)\n total_files Int? @default(0)\n redundancy_goal Int? @default(1)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n tag_files TagOnFile[]\n @@map(\"tags\")\n}\n\nmodel TagOnFile {\n date_created DateTime @default(now())\n\n tag_id Int\n tag Tag @relation(fields: [tag_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([tag_id, file_id])\n @@map(\"tags_on_files\")\n}\n\nmodel Label {\n id Int @id @default(autoincrement())\n name String?\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n label_files LabelOnFile[]\n @@map(\"labels\")\n}\n\nmodel LabelOnFile {\n date_created DateTime @default(now())\n\n label_id Int\n label Label @relation(fields: [label_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([label_id, file_id])\n @@map(\"label_on_files\")\n}\n\nmodel Job {\n id String @id\n // client_id Int\n action Int\n status Int @default(0)\n\n task_count Int @default(1)\n completed_task_count Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n // clients Client @relation(fields: [client_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n seconds_elapsed Int @default(0)\n\n @@map(\"jobs\")\n}\n\nmodel Space {\n id Int @id @default(autoincrement())\n name String\n encryption Int? @default(0) // remove\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n Library Library? @relation(fields: [libraryId], references: [id])\n libraryId Int?\n\n @@map(\"spaces\")\n}\n\nmodel Album {\n id Int @id @default(autoincrement())\n name String\n is_hidden Boolean @default(false)\n\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n @@map(\"albums\")\n}\n\nmodel Comment {\n id Int @id @default(autoincrement())\n content String\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n file_id Int?\n file File? @relation(fields: [file_id], references: [id])\n\n @@map(\"comments\")\n}\n" ; + let datamodel_str = "datasource db {\n provider = \"sqlite\"\n url = \"file:dev.db\"\n}\n\ngenerator client {\n provider = \"prisma-client-rust\"\n output = \"../src/prisma.rs\"\n}\n\nmodel Migration {\n id Int @id @default(autoincrement())\n name String\n checksum String @unique\n steps_applied Int @default(0)\n applied_at DateTime @default(now())\n\n @@map(\"_migrations\")\n}\n\nmodel Library {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n remote_id String?\n is_primary Boolean @default(true)\n encryption Int @default(0)\n date_created DateTime @default(now())\n timezone String?\n spaces Space[]\n\n @@map(\"libraries\")\n}\n\nmodel LibraryStatistics {\n id Int @id @default(autoincrement())\n date_captured DateTime @default(now())\n library_id Int @unique\n total_file_count Int @default(0)\n total_bytes_used String @default(\"0\")\n total_byte_capacity String @default(\"0\")\n total_unique_bytes String @default(\"0\")\n\n @@map(\"library_statistics\")\n}\n\nmodel Client {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n platform Int @default(0)\n version String?\n online Boolean? @default(true)\n last_seen DateTime @default(now())\n timezone String?\n date_created DateTime @default(now())\n // jobs Job[]\n\n @@map(\"clients\")\n}\n\nmodel Location {\n id Int @id @default(autoincrement())\n name String?\n local_path String?\n total_capacity Int?\n available_capacity Int?\n filesystem String?\n disk_type Int?\n is_removable Boolean @default(true)\n is_ejectable Boolean @default(true)\n is_root_filesystem Boolean @default(true)\n is_online Boolean @default(true)\n date_created DateTime @default(now())\n\n file_paths FilePath[]\n @@map(\"locations\")\n}\n\nmodel File {\n id Int @id @default(autoincrement())\n kind Int @default(0)\n size_in_bytes String\n partial_checksum String\n checksum String? @unique\n encryption Int @default(0)\n ipfs_id String?\n\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n date_indexed DateTime @default(now())\n\n file_tags TagOnFile[]\n file_labels LabelOnFile[]\n file_paths FilePath[]\n comments Comment[]\n @@map(\"files\")\n}\n\nmodel FilePath {\n id Int @id @default(autoincrement())\n is_dir Boolean @default(false)\n location_id Int\n materialized_path String\n name String\n extension String?\n file_id Int?\n parent_id Int?\n encryption Int @default(0)\n permissions String?\n\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n date_indexed DateTime @default(now())\n\n file File? @relation(fields: [file_id], references: [id], onDelete: Cascade, onUpdate: Cascade)\n location Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n parent FilePath? @relation(\"directory_file_paths\", fields: [parent_id], references: [id])\n children FilePath[] @relation(\"directory_file_paths\")\n\n @@unique([location_id, materialized_path, name, extension])\n @@map(\"file_paths\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String?\n encryption Int? @default(0)\n total_files Int? @default(0)\n redundancy_goal Int? @default(1)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n tag_files TagOnFile[]\n @@map(\"tags\")\n}\n\nmodel TagOnFile {\n date_created DateTime @default(now())\n\n tag_id Int\n tag Tag @relation(fields: [tag_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([tag_id, file_id])\n @@map(\"tags_on_files\")\n}\n\nmodel Label {\n id Int @id @default(autoincrement())\n name String?\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n label_files LabelOnFile[]\n @@map(\"labels\")\n}\n\nmodel LabelOnFile {\n date_created DateTime @default(now())\n\n label_id Int\n label Label @relation(fields: [label_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([label_id, file_id])\n @@map(\"label_on_files\")\n}\n\nmodel Job {\n id String @id\n // client_id Int\n action Int\n status Int @default(0)\n\n task_count Int @default(1)\n completed_task_count Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n // clients Client @relation(fields: [client_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n seconds_elapsed Int @default(0)\n\n @@map(\"jobs\")\n}\n\nmodel Space {\n id Int @id @default(autoincrement())\n name String\n encryption Int? @default(0) // remove\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n Library Library? @relation(fields: [libraryId], references: [id])\n libraryId Int?\n\n @@map(\"spaces\")\n}\n\nmodel Album {\n id Int @id @default(autoincrement())\n name String\n is_hidden Boolean @default(false)\n\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n @@map(\"albums\")\n}\n\nmodel Comment {\n id Int @id @default(autoincrement())\n content String\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n file_id Int?\n file File? @relation(fields: [file_id], references: [id])\n\n @@map(\"comments\")\n}\n" ; let config = parse_configuration(datamodel_str).unwrap().subject; let source = config .datasources @@ -39,7 +45,7 @@ pub async fn new_client() -> PrismaClient { new_client_with_url(&url).await } pub async fn new_client_with_url(url: &str) -> PrismaClient { - let datamodel_str = "datasource db {\n provider = \"sqlite\"\n url = \"file:dev.db\"\n}\n\ngenerator client {\n provider = \"prisma-client-rust\"\n output = \"../src/prisma.rs\"\n}\n\nmodel Migration {\n id Int @id @default(autoincrement())\n name String\n checksum String @unique\n steps_applied Int @default(0)\n applied_at DateTime @default(now())\n\n @@map(\"_migrations\")\n}\n\nmodel Library {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n remote_id String?\n is_primary Boolean @default(true)\n encryption Int @default(0)\n date_created DateTime @default(now())\n timezone String?\n spaces Space[]\n\n @@map(\"libraries\")\n}\n\nmodel LibraryStatistics {\n id Int @id @default(autoincrement())\n date_captured DateTime @default(now())\n library_id Int @unique\n total_file_count Int @default(0)\n total_bytes_used String @default(\"0\")\n total_byte_capacity String @default(\"0\")\n total_unique_bytes String @default(\"0\")\n\n @@map(\"library_statistics\")\n}\n\nmodel Client {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n platform Int @default(0)\n version String?\n online Boolean? @default(true)\n last_seen DateTime @default(now())\n timezone String?\n date_created DateTime @default(now())\n // jobs Job[]\n\n @@map(\"clients\")\n}\n\nmodel Location {\n id Int @id @default(autoincrement())\n name String?\n local_path String?\n total_capacity Int?\n available_capacity Int?\n filesystem String?\n disk_type Int?\n is_removable Boolean @default(true)\n is_ejectable Boolean @default(true)\n is_root_filesystem Boolean @default(true)\n is_online Boolean @default(true)\n date_created DateTime @default(now())\n\n file_paths FilePath[]\n @@map(\"locations\")\n}\n\nmodel File {\n id Int @id @default(autoincrement())\n id_hash String @unique\n name String\n extension String?\n checksum String?\n size_in_bytes String\n encryption Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n date_indexed DateTime @default(now())\n ipfs_id String?\n\n file_tags TagOnFile[]\n file_labels LabelOnFile[]\n file_paths FilePath[]\n comments Comment[]\n @@map(\"files\")\n}\n\nmodel FilePath {\n id Int @id @default(autoincrement())\n is_dir Boolean @default(false)\n materialized_path String\n file_id Int?\n file File? @relation(fields: [file_id], references: [id], onDelete: Cascade, onUpdate: Cascade)\n parent_id Int?\n parent FilePath? @relation(\"directory_file_paths\", fields: [parent_id], references: [id])\n children FilePath[] @relation(\"directory_file_paths\")\n location_id Int\n location Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n date_indexed DateTime @default(now())\n permissions String?\n\n @@unique([location_id, materialized_path, file_id])\n @@map(\"file_paths\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String?\n encryption Int? @default(0)\n total_files Int? @default(0)\n redundancy_goal Int? @default(1)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n tag_files TagOnFile[]\n @@map(\"tags\")\n}\n\nmodel TagOnFile {\n date_created DateTime @default(now())\n\n tag_id Int\n tag Tag @relation(fields: [tag_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([tag_id, file_id])\n @@map(\"tags_on_files\")\n}\n\nmodel Label {\n id Int @id @default(autoincrement())\n name String?\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n label_files LabelOnFile[]\n @@map(\"labels\")\n}\n\nmodel LabelOnFile {\n date_created DateTime @default(now())\n\n label_id Int\n label Label @relation(fields: [label_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([label_id, file_id])\n @@map(\"label_on_files\")\n}\n\nmodel Job {\n id String @id\n // client_id Int\n action Int\n status Int @default(0)\n\n task_count Int @default(1)\n completed_task_count Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n // clients Client @relation(fields: [client_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n seconds_elapsed Int @default(0)\n\n @@map(\"jobs\")\n}\n\nmodel Space {\n id Int @id @default(autoincrement())\n name String\n encryption Int? @default(0) // remove\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n Library Library? @relation(fields: [libraryId], references: [id])\n libraryId Int?\n\n @@map(\"spaces\")\n}\n\nmodel Album {\n id Int @id @default(autoincrement())\n name String\n is_hidden Boolean @default(false)\n\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n @@map(\"albums\")\n}\n\nmodel Comment {\n id Int @id @default(autoincrement())\n content String\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n file_id Int?\n file File? @relation(fields: [file_id], references: [id])\n\n @@map(\"comments\")\n}\n" ; + let datamodel_str = "datasource db {\n provider = \"sqlite\"\n url = \"file:dev.db\"\n}\n\ngenerator client {\n provider = \"prisma-client-rust\"\n output = \"../src/prisma.rs\"\n}\n\nmodel Migration {\n id Int @id @default(autoincrement())\n name String\n checksum String @unique\n steps_applied Int @default(0)\n applied_at DateTime @default(now())\n\n @@map(\"_migrations\")\n}\n\nmodel Library {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n remote_id String?\n is_primary Boolean @default(true)\n encryption Int @default(0)\n date_created DateTime @default(now())\n timezone String?\n spaces Space[]\n\n @@map(\"libraries\")\n}\n\nmodel LibraryStatistics {\n id Int @id @default(autoincrement())\n date_captured DateTime @default(now())\n library_id Int @unique\n total_file_count Int @default(0)\n total_bytes_used String @default(\"0\")\n total_byte_capacity String @default(\"0\")\n total_unique_bytes String @default(\"0\")\n\n @@map(\"library_statistics\")\n}\n\nmodel Client {\n id Int @id @default(autoincrement())\n uuid String @unique\n name String\n platform Int @default(0)\n version String?\n online Boolean? @default(true)\n last_seen DateTime @default(now())\n timezone String?\n date_created DateTime @default(now())\n // jobs Job[]\n\n @@map(\"clients\")\n}\n\nmodel Location {\n id Int @id @default(autoincrement())\n name String?\n local_path String?\n total_capacity Int?\n available_capacity Int?\n filesystem String?\n disk_type Int?\n is_removable Boolean @default(true)\n is_ejectable Boolean @default(true)\n is_root_filesystem Boolean @default(true)\n is_online Boolean @default(true)\n date_created DateTime @default(now())\n\n file_paths FilePath[]\n @@map(\"locations\")\n}\n\nmodel File {\n id Int @id @default(autoincrement())\n kind Int @default(0)\n size_in_bytes String\n partial_checksum String\n checksum String? @unique\n encryption Int @default(0)\n ipfs_id String?\n\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n date_indexed DateTime @default(now())\n\n file_tags TagOnFile[]\n file_labels LabelOnFile[]\n file_paths FilePath[]\n comments Comment[]\n @@map(\"files\")\n}\n\nmodel FilePath {\n id Int @id @default(autoincrement())\n is_dir Boolean @default(false)\n location_id Int\n materialized_path String\n name String\n extension String?\n file_id Int?\n parent_id Int?\n encryption Int @default(0)\n permissions String?\n\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n date_indexed DateTime @default(now())\n\n file File? @relation(fields: [file_id], references: [id], onDelete: Cascade, onUpdate: Cascade)\n location Location? @relation(fields: [location_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n parent FilePath? @relation(\"directory_file_paths\", fields: [parent_id], references: [id])\n children FilePath[] @relation(\"directory_file_paths\")\n\n @@unique([location_id, materialized_path, name, extension])\n @@map(\"file_paths\")\n}\n\nmodel Tag {\n id Int @id @default(autoincrement())\n name String?\n encryption Int? @default(0)\n total_files Int? @default(0)\n redundancy_goal Int? @default(1)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n tag_files TagOnFile[]\n @@map(\"tags\")\n}\n\nmodel TagOnFile {\n date_created DateTime @default(now())\n\n tag_id Int\n tag Tag @relation(fields: [tag_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([tag_id, file_id])\n @@map(\"tags_on_files\")\n}\n\nmodel Label {\n id Int @id @default(autoincrement())\n name String?\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n label_files LabelOnFile[]\n @@map(\"labels\")\n}\n\nmodel LabelOnFile {\n date_created DateTime @default(now())\n\n label_id Int\n label Label @relation(fields: [label_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n file_id Int\n file File @relation(fields: [file_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n\n @@id([label_id, file_id])\n @@map(\"label_on_files\")\n}\n\nmodel Job {\n id String @id\n // client_id Int\n action Int\n status Int @default(0)\n\n task_count Int @default(1)\n completed_task_count Int @default(0)\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n // clients Client @relation(fields: [client_id], references: [id], onDelete: NoAction, onUpdate: NoAction)\n seconds_elapsed Int @default(0)\n\n @@map(\"jobs\")\n}\n\nmodel Space {\n id Int @id @default(autoincrement())\n name String\n encryption Int? @default(0) // remove\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n Library Library? @relation(fields: [libraryId], references: [id])\n libraryId Int?\n\n @@map(\"spaces\")\n}\n\nmodel Album {\n id Int @id @default(autoincrement())\n name String\n is_hidden Boolean @default(false)\n\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n\n @@map(\"albums\")\n}\n\nmodel Comment {\n id Int @id @default(autoincrement())\n content String\n date_created DateTime @default(now())\n date_modified DateTime @default(now())\n file_id Int?\n file File? @relation(fields: [file_id], references: [id])\n\n @@map(\"comments\")\n}\n" ; let config = parse_configuration(datamodel_str).unwrap().subject; let source = config .datasources @@ -56,10 +62,16 @@ pub async fn new_client_with_url(url: &str) -> PrismaClient { source.referential_integrity(), )); executor.primary_connector().get_connection().await.unwrap(); - PrismaClient { executor, query_schema } + PrismaClient { + executor, + query_schema, + } } impl PrismaClient { - pub async fn _query_raw(&self, query: &str) -> Result, CoreError> { + pub async fn _query_raw( + &self, + query: &str, + ) -> QueryResult> { let query = Query { ctx: QueryContext::new(&self.executor, self.query_schema.clone()), operation: "mutation".into(), @@ -82,7 +94,7 @@ impl PrismaClient { }; query.perform().await } - pub async fn _execute_raw(&self, query: &str) -> Result { + pub async fn _execute_raw(&self, query: &str) -> QueryResult { let query = Query { ctx: QueryContext::new(&self.executor, self.query_schema.clone()), operation: "mutation".into(), @@ -163,13 +175,13 @@ fn migration_outputs() -> Vec { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct MigrationData { #[serde(rename = "id")] - pub id: i64, + pub id: i32, #[serde(rename = "name")] pub name: String, #[serde(rename = "checksum")] pub checksum: String, #[serde(rename = "steps_applied")] - pub steps_applied: i64, + pub steps_applied: i32, #[serde(rename = "applied_at")] pub applied_at: chrono::DateTime, } @@ -193,199 +205,529 @@ impl Migration { } } pub struct MigrationIdField {} -pub struct MigrationSetId(i64); -impl From for MigrationSetParam { - fn from(value: MigrationSetId) -> Self { - Self::Id(value.0) +impl MigrationIdField { + pub fn set>(&self, value: i32) -> T { + MigrationSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + MigrationWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> MigrationOrderByParam { + MigrationOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> MigrationCursor { + MigrationCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> MigrationSetParam { + MigrationSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> MigrationSetParam { + MigrationSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> MigrationSetParam { + MigrationSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> MigrationSetParam { + MigrationSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> MigrationWhereParam { + MigrationWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> MigrationWhereParam { + MigrationWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::IdGte(value) } } -impl MigrationIdField { - pub fn lt(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - MigrationSetId(value).into() +pub struct MigrationSetId(i32); +impl From for MigrationSetParam { + fn from(value: MigrationSetId) -> Self { + Self::SetId(value.0) } } pub struct MigrationNameField {} -pub struct MigrationSetName(String); -impl From for MigrationSetParam { - fn from(value: MigrationSetName) -> Self { - Self::Name(value.0) - } -} impl MigrationNameField { + pub fn set>(&self, value: String) -> T { + MigrationSetName(value).into() + } + pub fn equals(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameEquals(value).into() + } + pub fn order(&self, direction: Direction) -> MigrationOrderByParam { + MigrationOrderByParam::Name(direction) + } + pub fn cursor(&self, cursor: String) -> MigrationCursor { + MigrationCursor::Name(cursor) + } + pub fn in_vec(&self, value: Vec) -> MigrationWhereParam { + MigrationWhereParam::NameInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> MigrationWhereParam { + MigrationWhereParam::NameNotInVec(value) + } + pub fn lt(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameLt(value) + } + pub fn lte(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameLte(value) + } + pub fn gt(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameGt(value) + } + pub fn gte(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameGte(value) + } pub fn contains(&self, value: String) -> MigrationWhereParam { MigrationWhereParam::NameContains(value) } + pub fn starts_with(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameStartsWith(value) + } + pub fn ends_with(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameEndsWith(value) + } + pub fn not(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::NameNot(value) + } pub fn has_prefix(&self, value: String) -> MigrationWhereParam { MigrationWhereParam::NameHasPrefix(value) } pub fn has_suffix(&self, value: String) -> MigrationWhereParam { MigrationWhereParam::NameHasSuffix(value) } - pub fn equals(&self, value: String) -> MigrationWhereParam { - MigrationWhereParam::NameEquals(value) - } - pub fn set>(&self, value: String) -> T { - MigrationSetName(value).into() +} +pub struct MigrationSetName(String); +impl From for MigrationSetParam { + fn from(value: MigrationSetName) -> Self { + Self::SetName(value.0) } } pub struct MigrationChecksumField {} -pub struct MigrationSetChecksum(String); -impl From for MigrationSetParam { - fn from(value: MigrationSetChecksum) -> Self { - Self::Checksum(value.0) - } -} impl MigrationChecksumField { + pub fn set>(&self, value: String) -> T { + MigrationSetChecksum(value).into() + } + pub fn equals>(&self, value: String) -> T { + MigrationWhereUniqueParam::ChecksumEquals(value).into() + } + pub fn order(&self, direction: Direction) -> MigrationOrderByParam { + MigrationOrderByParam::Checksum(direction) + } + pub fn cursor(&self, cursor: String) -> MigrationCursor { + MigrationCursor::Checksum(cursor) + } + pub fn in_vec(&self, value: Vec) -> MigrationWhereParam { + MigrationWhereParam::ChecksumInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> MigrationWhereParam { + MigrationWhereParam::ChecksumNotInVec(value) + } + pub fn lt(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumLt(value) + } + pub fn lte(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumLte(value) + } + pub fn gt(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumGt(value) + } + pub fn gte(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumGte(value) + } pub fn contains(&self, value: String) -> MigrationWhereParam { MigrationWhereParam::ChecksumContains(value) } + pub fn starts_with(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumStartsWith(value) + } + pub fn ends_with(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumEndsWith(value) + } + pub fn not(&self, value: String) -> MigrationWhereParam { + MigrationWhereParam::ChecksumNot(value) + } pub fn has_prefix(&self, value: String) -> MigrationWhereParam { MigrationWhereParam::ChecksumHasPrefix(value) } pub fn has_suffix(&self, value: String) -> MigrationWhereParam { MigrationWhereParam::ChecksumHasSuffix(value) } - pub fn equals(&self, value: String) -> MigrationWhereParam { - MigrationWhereParam::ChecksumEquals(value) - } - pub fn set>(&self, value: String) -> T { - MigrationSetChecksum(value).into() +} +pub struct MigrationSetChecksum(String); +impl From for MigrationSetParam { + fn from(value: MigrationSetChecksum) -> Self { + Self::SetChecksum(value.0) } } pub struct MigrationStepsAppliedField {} -pub struct MigrationSetStepsApplied(i64); -impl From for MigrationSetParam { - fn from(value: MigrationSetStepsApplied) -> Self { - Self::StepsApplied(value.0) +impl MigrationStepsAppliedField { + pub fn set>(&self, value: i32) -> T { + MigrationSetStepsApplied(value).into() + } + pub fn equals(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> MigrationOrderByParam { + MigrationOrderByParam::StepsApplied(direction) + } + pub fn cursor(&self, cursor: i32) -> MigrationCursor { + MigrationCursor::StepsApplied(cursor) + } + pub fn increment(&self, value: i32) -> MigrationSetParam { + MigrationSetParam::StepsApplied(value) + } + pub fn decrement(&self, value: i32) -> MigrationSetParam { + MigrationSetParam::StepsApplied(value) + } + pub fn multiply(&self, value: i32) -> MigrationSetParam { + MigrationSetParam::StepsApplied(value) + } + pub fn divide(&self, value: i32) -> MigrationSetParam { + MigrationSetParam::StepsApplied(value) + } + pub fn in_vec(&self, value: Vec) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedNotInVec(value) + } + pub fn lt(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedLt(value) + } + pub fn lte(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedLte(value) + } + pub fn gt(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedGt(value) + } + pub fn gte(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedGte(value) + } + pub fn not(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedNot(value) + } + pub fn lt(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedLt(value) + } + pub fn lte(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedLte(value) + } + pub fn gt(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedGt(value) + } + pub fn gte(&self, value: i32) -> MigrationWhereParam { + MigrationWhereParam::StepsAppliedGte(value) } } -impl MigrationStepsAppliedField { - pub fn lt(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::StepsAppliedLT(value) - } - pub fn gt(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::StepsAppliedGT(value) - } - pub fn lte(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::StepsAppliedLTE(value) - } - pub fn gte(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::StepsAppliedGTE(value) - } - pub fn equals(&self, value: i64) -> MigrationWhereParam { - MigrationWhereParam::StepsAppliedEquals(value) - } - pub fn set>(&self, value: i64) -> T { - MigrationSetStepsApplied(value).into() +pub struct MigrationSetStepsApplied(i32); +impl From for MigrationSetParam { + fn from(value: MigrationSetStepsApplied) -> Self { + Self::SetStepsApplied(value.0) } } pub struct MigrationAppliedAtField {} -pub struct MigrationSetAppliedAt(chrono::DateTime); -impl From for MigrationSetParam { - fn from(value: MigrationSetAppliedAt) -> Self { - Self::AppliedAt(value.0) - } -} impl MigrationAppliedAtField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + MigrationSetAppliedAt(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtEquals(value).into() + } + pub fn order(&self, direction: Direction) -> MigrationOrderByParam { + MigrationOrderByParam::AppliedAt(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> MigrationCursor { + MigrationCursor::AppliedAt(cursor) + } + pub fn in_vec( + &self, + value: Vec>, + ) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> MigrationWhereParam { + MigrationWhereParam::AppliedAtNot(value) + } pub fn before(&self, value: chrono::DateTime) -> MigrationWhereParam { MigrationWhereParam::AppliedAtBefore(value) } pub fn after(&self, value: chrono::DateTime) -> MigrationWhereParam { MigrationWhereParam::AppliedAtAfter(value) } - pub fn before_equals(&self, value: chrono::DateTime) -> MigrationWhereParam { + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> MigrationWhereParam { MigrationWhereParam::AppliedAtBeforeEquals(value) } - pub fn after_equals(&self, value: chrono::DateTime) -> MigrationWhereParam { + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> MigrationWhereParam { MigrationWhereParam::AppliedAtAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> MigrationWhereParam { - MigrationWhereParam::AppliedAtEquals(value) +} +pub struct MigrationSetAppliedAt(chrono::DateTime); +impl From for MigrationSetParam { + fn from(value: MigrationSetAppliedAt) -> Self { + Self::SetAppliedAt(value.0) } - pub fn set>(&self, value: chrono::DateTime) -> T { - MigrationSetAppliedAt(value).into() +} +pub enum MigrationWithParam {} +impl MigrationWithParam { + pub fn to_output(self) -> Output { + match self {} + } +} +pub enum MigrationSetParam { + SetId(i32), + SetName(String), + SetChecksum(String), + SetStepsApplied(i32), + SetAppliedAt(chrono::DateTime), +} +impl MigrationSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetName(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetChecksum(value) => Field { + name: "checksum".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetStepsApplied(value) => Field { + name: "steps_applied".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetAppliedAt(value) => Field { + name: "applied_at".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum MigrationOrderByParam { + Id(Direction), + Name(Direction), + Checksum(Direction), + StepsApplied(Direction), + AppliedAt(Direction), +} +impl MigrationOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Name(direction) => Field { + name: "name".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Checksum(direction) => Field { + name: "checksum".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::StepsApplied(direction) => Field { + name: "steps_applied".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::AppliedAt(direction) => Field { + name: "applied_at".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum MigrationCursor { + Id(i32), + Name(String), + Checksum(String), + StepsApplied(i32), + AppliedAt(chrono::DateTime), +} +impl MigrationCursor { + fn to_field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Checksum(value) => Field { + name: "checksum".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::StepsApplied(value) => Field { + name: "steps_applied".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::AppliedAt(value) => Field { + name: "applied_at".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } } } pub enum MigrationWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + NameEquals(String), + NameInVec(Vec), + NameNotInVec(Vec), + NameLt(String), + NameLte(String), + NameGt(String), + NameGte(String), NameContains(String), + NameStartsWith(String), + NameEndsWith(String), + NameNot(String), NameHasPrefix(String), NameHasSuffix(String), - NameEquals(String), + ChecksumEquals(String), + ChecksumInVec(Vec), + ChecksumNotInVec(Vec), + ChecksumLt(String), + ChecksumLte(String), + ChecksumGt(String), + ChecksumGte(String), ChecksumContains(String), + ChecksumStartsWith(String), + ChecksumEndsWith(String), + ChecksumNot(String), ChecksumHasPrefix(String), ChecksumHasSuffix(String), - ChecksumEquals(String), - StepsAppliedLT(i64), - StepsAppliedGT(i64), - StepsAppliedLTE(i64), - StepsAppliedGTE(i64), - StepsAppliedEquals(i64), + StepsAppliedEquals(i32), + StepsAppliedInVec(Vec), + StepsAppliedNotInVec(Vec), + StepsAppliedLt(i32), + StepsAppliedLte(i32), + StepsAppliedGt(i32), + StepsAppliedGte(i32), + StepsAppliedNot(i32), + StepsAppliedLt(i32), + StepsAppliedLte(i32), + StepsAppliedGt(i32), + StepsAppliedGte(i32), + AppliedAtEquals(chrono::DateTime), + AppliedAtInVec(Vec>), + AppliedAtNotInVec(Vec>), + AppliedAtLt(chrono::DateTime), + AppliedAtLte(chrono::DateTime), + AppliedAtGt(chrono::DateTime), + AppliedAtGte(chrono::DateTime), + AppliedAtNot(chrono::DateTime), AppliedAtBefore(chrono::DateTime), AppliedAtAfter(chrono::DateTime), AppliedAtBeforeEquals(chrono::DateTime), AppliedAtAfterEquals(chrono::DateTime), - AppliedAtEquals(chrono::DateTime), - Not(Vec), - Or(Vec), - And(Vec), } impl MigrationWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, Self::IdEquals(value) => Field { @@ -397,6 +739,204 @@ impl MigrationWhereParam { }]), ..Default::default() }, + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNotInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::NameContains(value) => Field { name: "name".into(), fields: Some(vec![Field { @@ -406,6 +946,33 @@ impl MigrationWhereParam { }]), ..Default::default() }, + Self::NameStartsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEndsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNot(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::NameHasPrefix(value) => Field { name: "name".into(), fields: Some(vec![Field { @@ -424,8 +991,8 @@ impl MigrationWhereParam { }]), ..Default::default() }, - Self::NameEquals(value) => Field { - name: "name".into(), + Self::ChecksumEquals(value) => Field { + name: "checksum".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -433,6 +1000,78 @@ impl MigrationWhereParam { }]), ..Default::default() }, + Self::ChecksumInVec(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumNotInVec(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumLt(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumLte(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumGt(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumGte(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::ChecksumContains(value) => Field { name: "checksum".into(), fields: Some(vec![Field { @@ -442,6 +1081,33 @@ impl MigrationWhereParam { }]), ..Default::default() }, + Self::ChecksumStartsWith(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumEndsWith(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumNot(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::ChecksumHasPrefix(value) => Field { name: "checksum".into(), fields: Some(vec![Field { @@ -460,8 +1126,8 @@ impl MigrationWhereParam { }]), ..Default::default() }, - Self::ChecksumEquals(value) => Field { - name: "checksum".into(), + Self::StepsAppliedEquals(value) => Field { + name: "steps_applied".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -469,7 +1135,43 @@ impl MigrationWhereParam { }]), ..Default::default() }, - Self::StepsAppliedLT(value) => Field { + Self::StepsAppliedInVec(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedNotInVec(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedLt(value) => Field { name: "steps_applied".into(), fields: Some(vec![Field { name: "lt".into(), @@ -478,16 +1180,7 @@ impl MigrationWhereParam { }]), ..Default::default() }, - Self::StepsAppliedGT(value) => Field { - name: "steps_applied".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::StepsAppliedLTE(value) => Field { + Self::StepsAppliedLte(value) => Field { name: "steps_applied".into(), fields: Some(vec![Field { name: "lte".into(), @@ -496,7 +1189,16 @@ impl MigrationWhereParam { }]), ..Default::default() }, - Self::StepsAppliedGTE(value) => Field { + Self::StepsAppliedGt(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedGte(value) => Field { name: "steps_applied".into(), fields: Some(vec![Field { name: "gte".into(), @@ -505,8 +1207,53 @@ impl MigrationWhereParam { }]), ..Default::default() }, - Self::StepsAppliedEquals(value) => Field { + Self::StepsAppliedNot(value) => Field { name: "steps_applied".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedLt(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedLte(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedGt(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StepsAppliedGte(value) => Field { + name: "steps_applied".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtEquals(value) => Field { + name: "applied_at".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -514,6 +1261,87 @@ impl MigrationWhereParam { }]), ..Default::default() }, + Self::AppliedAtInVec(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtNotInVec(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtLt(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtLte(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtGt(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtGte(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AppliedAtNot(value) => Field { + name: "applied_at".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::AppliedAtBefore(value) => Field { name: "applied_at".into(), fields: Some(vec![Field { @@ -550,35 +1378,19 @@ impl MigrationWhereParam { }]), ..Default::default() }, - Self::AppliedAtEquals(value) => Field { - name: "applied_at".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() + } + } +} +pub enum MigrationWhereUniqueParam { + IdEquals(i32), + ChecksumEquals(String), +} +impl From for MigrationWhereParam { + fn from(value: MigrationWhereUniqueParam) -> Self { + match value { + MigrationWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + MigrationWhereUniqueParam::ChecksumEquals(value) => { + Self::ChecksumEquals(value) }, } } @@ -592,64 +1404,32 @@ impl From> for MigrationWhereParam { } } } -pub struct MigrationWith { - pub param: MigrationWithParam, -} -pub enum MigrationWithParam {} -impl From for MigrationWith { - fn from(param: MigrationWithParam) -> Self { - Self { param } - } -} -impl MigrationWithParam { - pub fn output(self) -> Output { - match self {} - } -} -pub enum MigrationSetParam { - Id(i64), - Name(String), - Checksum(String), - StepsApplied(i64), - AppliedAt(chrono::DateTime), -} -impl MigrationSetParam { - pub fn field(self) -> Field { - match self { - Self::Id(value) => Field { - name: "id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::Name(value) => Field { - name: "name".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::Checksum(value) => Field { - name: "checksum".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::StepsApplied(value) => Field { - name: "steps_applied".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::AppliedAt(value) => Field { - name: "applied_at".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - } - } -} pub struct MigrationFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> MigrationFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> MigrationDelete<'a> { MigrationDelete { @@ -668,7 +1448,7 @@ impl<'a> MigrationFindMany<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -688,33 +1468,119 @@ impl<'a> MigrationFindMany<'a> { method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: MigrationOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: MigrationWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: MigrationCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct MigrationFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> MigrationFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: MigrationWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: MigrationOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: MigrationCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct MigrationFindUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> MigrationFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> MigrationDelete<'a> { MigrationDelete { @@ -732,7 +1598,7 @@ impl<'a> MigrationFindUnique<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -752,45 +1618,107 @@ impl<'a> MigrationFindUnique<'a> { method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: MigrationWithParam) -> Self { + self.with_params.push(param); self } } pub struct MigrationCreateOne<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> MigrationCreateOne<'a> { - pub async fn exec(self) -> MigrationData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: MigrationWithParam) -> Self { + self.with_params.push(param); + self } } pub struct MigrationUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> MigrationUpdateUnique<'a> { - pub async fn exec(self) -> MigrationData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: MigrationWithParam) -> Self { + self.with_params.push(param); self } } pub struct MigrationUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> MigrationUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: MigrationWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct MigrationUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> MigrationUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + name: MigrationSetName, + checksum: MigrationSetChecksum, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(MigrationSetParam::from(name).to_field()); + input_fields.push(MigrationSetParam::from(checksum).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); self } } @@ -798,18 +1726,22 @@ pub struct MigrationDelete<'a> { query: Query<'a>, } impl<'a> MigrationDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) } } pub struct MigrationActions<'a> { client: &'a PrismaClient, } impl<'a> MigrationActions<'a> { - pub fn find_unique(&self, param: MigrationWhereParam) -> MigrationFindUnique { - let fields = transform_equals(vec![param.field()]); + pub fn find_unique(&self, param: MigrationWhereUniqueParam) -> MigrationFindUnique { + let param: MigrationWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), @@ -821,10 +1753,14 @@ impl<'a> MigrationActions<'a> { ..Default::default() }], }; - MigrationFindUnique { query } + MigrationFindUnique { + query, + with_params: vec![], + } } pub fn find_first(&self, params: Vec) -> MigrationFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -841,7 +1777,10 @@ impl<'a> MigrationActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), @@ -849,10 +1788,15 @@ impl<'a> MigrationActions<'a> { outputs: migration_outputs(), inputs, }; - MigrationFindFirst { query } + MigrationFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn find_many(&self, params: Vec) -> MigrationFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -863,7 +1807,10 @@ impl<'a> MigrationActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), @@ -871,7 +1818,11 @@ impl<'a> MigrationActions<'a> { outputs: migration_outputs(), inputs, }; - MigrationFindMany { query } + MigrationFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn create_one( &self, @@ -879,11 +1830,15 @@ impl<'a> MigrationActions<'a> { checksum: MigrationSetChecksum, params: Vec, ) -> MigrationCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(MigrationSetParam::from(name).field()); - input_fields.push(MigrationSetParam::from(checksum).field()); + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(MigrationSetParam::from(name).to_field()); + input_fields.push(MigrationSetParam::from(checksum).to_field()); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), @@ -895,7 +1850,31 @@ impl<'a> MigrationActions<'a> { ..Default::default() }], }; - MigrationCreateOne { query } + MigrationCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: MigrationWhereUniqueParam) -> MigrationUpsertOne { + let param: MigrationWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Migration".into(), + outputs: migration_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + MigrationUpsertOne { query } } } fn library_outputs() -> Vec { @@ -913,7 +1892,7 @@ fn library_outputs() -> Vec { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LibraryData { #[serde(rename = "id")] - pub id: i64, + pub id: i32, #[serde(rename = "uuid")] pub uuid: String, #[serde(rename = "name")] @@ -923,7 +1902,7 @@ pub struct LibraryData { #[serde(rename = "is_primary")] pub is_primary: bool, #[serde(rename = "encryption")] - pub encryption: i64, + pub encryption: i32, #[serde(rename = "date_created")] pub date_created: chrono::DateTime, #[serde(rename = "timezone")] @@ -933,10 +1912,7 @@ pub struct LibraryData { } impl LibraryData { pub fn spaces(&self) -> Result<&Vec, String> { - match self.spaces.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access spaces but did not fetch it using the .with() syntax".to_string()), - } + match self . spaces . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access spaces but did not fetch it using the .with() syntax" . to_string ()) , } } } pub struct Library; @@ -970,204 +1946,453 @@ impl Library { } } pub struct LibraryIdField {} -pub struct LibrarySetId(i64); -impl From for LibrarySetParam { - fn from(value: LibrarySetId) -> Self { - Self::Id(value.0) +impl LibraryIdField { + pub fn set>(&self, value: i32) -> T { + LibrarySetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + LibraryWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryOrderByParam { + LibraryOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> LibraryCursor { + LibraryCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> LibrarySetParam { + LibrarySetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> LibrarySetParam { + LibrarySetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> LibrarySetParam { + LibrarySetParam::Id(value) + } + pub fn divide(&self, value: i32) -> LibrarySetParam { + LibrarySetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::IdGte(value) } } -impl LibraryIdField { - pub fn lt(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LibrarySetId(value).into() +pub struct LibrarySetId(i32); +impl From for LibrarySetParam { + fn from(value: LibrarySetId) -> Self { + Self::SetId(value.0) } } pub struct LibraryUuidField {} -pub struct LibrarySetUuid(String); -impl From for LibrarySetParam { - fn from(value: LibrarySetUuid) -> Self { - Self::Uuid(value.0) - } -} impl LibraryUuidField { + pub fn set>(&self, value: String) -> T { + LibrarySetUuid(value).into() + } + pub fn equals>(&self, value: String) -> T { + LibraryWhereUniqueParam::UuidEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryOrderByParam { + LibraryOrderByParam::Uuid(direction) + } + pub fn cursor(&self, cursor: String) -> LibraryCursor { + LibraryCursor::Uuid(cursor) + } + pub fn in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::UuidInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::UuidNotInVec(value) + } + pub fn lt(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidLt(value) + } + pub fn lte(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidLte(value) + } + pub fn gt(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidGt(value) + } + pub fn gte(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidGte(value) + } pub fn contains(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::UuidContains(value) } + pub fn starts_with(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidEndsWith(value) + } + pub fn not(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::UuidNot(value) + } pub fn has_prefix(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::UuidHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::UuidHasSuffix(value) } - pub fn equals(&self, value: String) -> LibraryWhereParam { - LibraryWhereParam::UuidEquals(value) - } - pub fn set>(&self, value: String) -> T { - LibrarySetUuid(value).into() +} +pub struct LibrarySetUuid(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetUuid) -> Self { + Self::SetUuid(value.0) } } pub struct LibraryNameField {} -pub struct LibrarySetName(String); -impl From for LibrarySetParam { - fn from(value: LibrarySetName) -> Self { - Self::Name(value.0) - } -} impl LibraryNameField { + pub fn set>(&self, value: String) -> T { + LibrarySetName(value).into() + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryOrderByParam { + LibraryOrderByParam::Name(direction) + } + pub fn cursor(&self, cursor: String) -> LibraryCursor { + LibraryCursor::Name(cursor) + } + pub fn in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::NameInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::NameNotInVec(value) + } + pub fn lt(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameLt(value) + } + pub fn lte(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameLte(value) + } + pub fn gt(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameGt(value) + } + pub fn gte(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameGte(value) + } pub fn contains(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::NameContains(value) } + pub fn starts_with(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameEndsWith(value) + } + pub fn not(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::NameNot(value) + } pub fn has_prefix(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::NameHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::NameHasSuffix(value) } - pub fn equals(&self, value: String) -> LibraryWhereParam { - LibraryWhereParam::NameEquals(value) - } - pub fn set>(&self, value: String) -> T { - LibrarySetName(value).into() +} +pub struct LibrarySetName(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetName) -> Self { + Self::SetName(value.0) } } pub struct LibraryRemoteIdField {} -pub struct LibrarySetRemoteId(String); -impl From for LibrarySetParam { - fn from(value: LibrarySetRemoteId) -> Self { - Self::RemoteId(value.0) - } -} impl LibraryRemoteIdField { + pub fn set>(&self, value: String) -> T { + LibrarySetRemoteId(value).into() + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryOrderByParam { + LibraryOrderByParam::RemoteId(direction) + } + pub fn cursor(&self, cursor: String) -> LibraryCursor { + LibraryCursor::RemoteId(cursor) + } + pub fn in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdNotInVec(value) + } + pub fn lt(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdLt(value) + } + pub fn lte(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdLte(value) + } + pub fn gt(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdGt(value) + } + pub fn gte(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdGte(value) + } pub fn contains(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::RemoteIdContains(value) } + pub fn starts_with(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdEndsWith(value) + } + pub fn not(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::RemoteIdNot(value) + } pub fn has_prefix(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::RemoteIdHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::RemoteIdHasSuffix(value) } - pub fn equals(&self, value: String) -> LibraryWhereParam { - LibraryWhereParam::RemoteIdEquals(value) - } - pub fn set>(&self, value: String) -> T { - LibrarySetRemoteId(value).into() +} +pub struct LibrarySetRemoteId(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetRemoteId) -> Self { + Self::SetRemoteId(value.0) } } pub struct LibraryIsPrimaryField {} -pub struct LibrarySetIsPrimary(bool); -impl From for LibrarySetParam { - fn from(value: LibrarySetIsPrimary) -> Self { - Self::IsPrimary(value.0) - } -} impl LibraryIsPrimaryField { - pub fn equals(&self, value: bool) -> LibraryWhereParam { - LibraryWhereParam::IsPrimaryEquals(value) - } pub fn set>(&self, value: bool) -> T { LibrarySetIsPrimary(value).into() } + pub fn equals(&self, value: bool) -> LibraryWhereParam { + LibraryWhereParam::IsPrimaryEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryOrderByParam { + LibraryOrderByParam::IsPrimary(direction) + } + pub fn cursor(&self, cursor: bool) -> LibraryCursor { + LibraryCursor::IsPrimary(cursor) + } +} +pub struct LibrarySetIsPrimary(bool); +impl From for LibrarySetParam { + fn from(value: LibrarySetIsPrimary) -> Self { + Self::SetIsPrimary(value.0) + } } pub struct LibraryEncryptionField {} -pub struct LibrarySetEncryption(i64); -impl From for LibrarySetParam { - fn from(value: LibrarySetEncryption) -> Self { - Self::Encryption(value.0) +impl LibraryEncryptionField { + pub fn set>(&self, value: i32) -> T { + LibrarySetEncryption(value).into() + } + pub fn equals(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryOrderByParam { + LibraryOrderByParam::Encryption(direction) + } + pub fn cursor(&self, cursor: i32) -> LibraryCursor { + LibraryCursor::Encryption(cursor) + } + pub fn increment(&self, value: i32) -> LibrarySetParam { + LibrarySetParam::Encryption(value) + } + pub fn decrement(&self, value: i32) -> LibrarySetParam { + LibrarySetParam::Encryption(value) + } + pub fn multiply(&self, value: i32) -> LibrarySetParam { + LibrarySetParam::Encryption(value) + } + pub fn divide(&self, value: i32) -> LibrarySetParam { + LibrarySetParam::Encryption(value) + } + pub fn in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::EncryptionInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::EncryptionNotInVec(value) + } + pub fn lt(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionGte(value) + } + pub fn not(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionNot(value) + } + pub fn lt(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> LibraryWhereParam { + LibraryWhereParam::EncryptionGte(value) } } -impl LibraryEncryptionField { - pub fn lt(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::EncryptionLT(value) - } - pub fn gt(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::EncryptionGT(value) - } - pub fn lte(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::EncryptionLTE(value) - } - pub fn gte(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::EncryptionGTE(value) - } - pub fn equals(&self, value: i64) -> LibraryWhereParam { - LibraryWhereParam::EncryptionEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LibrarySetEncryption(value).into() +pub struct LibrarySetEncryption(i32); +impl From for LibrarySetParam { + fn from(value: LibrarySetEncryption) -> Self { + Self::SetEncryption(value.0) } } pub struct LibraryDateCreatedField {} -pub struct LibrarySetDateCreated(chrono::DateTime); -impl From for LibrarySetParam { - fn from(value: LibrarySetDateCreated) -> Self { - Self::DateCreated(value.0) - } -} impl LibraryDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + LibrarySetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryOrderByParam { + LibraryOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> LibraryCursor { + LibraryCursor::DateCreated(cursor) + } + pub fn in_vec(&self, value: Vec>) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> LibraryWhereParam { + LibraryWhereParam::DateCreatedNot(value) + } pub fn before(&self, value: chrono::DateTime) -> LibraryWhereParam { LibraryWhereParam::DateCreatedBefore(value) } pub fn after(&self, value: chrono::DateTime) -> LibraryWhereParam { LibraryWhereParam::DateCreatedAfter(value) } - pub fn before_equals(&self, value: chrono::DateTime) -> LibraryWhereParam { + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> LibraryWhereParam { LibraryWhereParam::DateCreatedBeforeEquals(value) } - pub fn after_equals(&self, value: chrono::DateTime) -> LibraryWhereParam { + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> LibraryWhereParam { LibraryWhereParam::DateCreatedAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> LibraryWhereParam { - LibraryWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - LibrarySetDateCreated(value).into() +} +pub struct LibrarySetDateCreated(chrono::DateTime); +impl From for LibrarySetParam { + fn from(value: LibrarySetDateCreated) -> Self { + Self::SetDateCreated(value.0) } } pub struct LibraryTimezoneField {} -pub struct LibrarySetTimezone(String); -impl From for LibrarySetParam { - fn from(value: LibrarySetTimezone) -> Self { - Self::Timezone(value.0) - } -} impl LibraryTimezoneField { + pub fn set>(&self, value: String) -> T { + LibrarySetTimezone(value).into() + } + pub fn equals(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryOrderByParam { + LibraryOrderByParam::Timezone(direction) + } + pub fn cursor(&self, cursor: String) -> LibraryCursor { + LibraryCursor::Timezone(cursor) + } + pub fn in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::TimezoneInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryWhereParam { + LibraryWhereParam::TimezoneNotInVec(value) + } + pub fn lt(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneLt(value) + } + pub fn lte(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneLte(value) + } + pub fn gt(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneGt(value) + } + pub fn gte(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneGte(value) + } pub fn contains(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::TimezoneContains(value) } + pub fn starts_with(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneEndsWith(value) + } + pub fn not(&self, value: String) -> LibraryWhereParam { + LibraryWhereParam::TimezoneNot(value) + } pub fn has_prefix(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::TimezoneHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LibraryWhereParam { LibraryWhereParam::TimezoneHasSuffix(value) } - pub fn equals(&self, value: String) -> LibraryWhereParam { - LibraryWhereParam::TimezoneEquals(value) - } - pub fn set>(&self, value: String) -> T { - LibrarySetTimezone(value).into() +} +pub struct LibrarySetTimezone(String); +impl From for LibrarySetParam { + fn from(value: LibrarySetTimezone) -> Self { + Self::SetTimezone(value.0) } } pub struct LibrarySpacesField {} -pub struct LibraryLinkSpaces(Vec); -impl From for LibrarySetParam { - fn from(value: LibraryLinkSpaces) -> Self { - Self::LinkSpaces(value.0.into_iter().map(|v| v.into()).collect()) - } -} impl LibrarySpacesField { pub fn some(&self, value: Vec) -> LibraryWhereParam { LibraryWhereParam::SpacesSome(value) @@ -1175,410 +2400,30 @@ impl LibrarySpacesField { pub fn every(&self, value: Vec) -> LibraryWhereParam { LibraryWhereParam::SpacesEvery(value) } - pub fn link>(&self, value: Vec) -> T { - LibraryLinkSpaces(value).into() + pub fn fetch(&self, params: Vec) -> LibraryWithParam { + LibraryWithParam::Spaces(params) } - pub fn unlink(&self, params: Vec) -> LibrarySetParam { - LibrarySetParam::UnlinkSpaces(params) + pub fn link>( + &self, + params: Vec, + ) -> T { + LibraryLinkSpaces(params).into() } - pub fn fetch(&self, params: Vec) -> LibraryWith { - LibraryWithParam::Spaces(params).into() + pub fn unlink(&self, params: Vec) -> LibrarySetParam { + LibrarySetParam::UnLinkSpaces(params) } } -pub enum LibraryWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), - UuidContains(String), - UuidHasPrefix(String), - UuidHasSuffix(String), - UuidEquals(String), - NameContains(String), - NameHasPrefix(String), - NameHasSuffix(String), - NameEquals(String), - RemoteIdContains(String), - RemoteIdHasPrefix(String), - RemoteIdHasSuffix(String), - RemoteIdEquals(String), - IsPrimaryEquals(bool), - EncryptionLT(i64), - EncryptionGT(i64), - EncryptionLTE(i64), - EncryptionGTE(i64), - EncryptionEquals(i64), - DateCreatedBefore(chrono::DateTime), - DateCreatedAfter(chrono::DateTime), - DateCreatedBeforeEquals(chrono::DateTime), - DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), - TimezoneContains(String), - TimezoneHasPrefix(String), - TimezoneHasSuffix(String), - TimezoneEquals(String), - SpacesSome(Vec), - SpacesEvery(Vec), - Not(Vec), - Or(Vec), - And(Vec), -} -impl LibraryWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdEquals(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::UuidContains(value) => Field { - name: "uuid".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::UuidHasPrefix(value) => Field { - name: "uuid".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::UuidHasSuffix(value) => Field { - name: "uuid".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::UuidEquals(value) => Field { - name: "uuid".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameContains(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasPrefix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasSuffix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameEquals(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::RemoteIdContains(value) => Field { - name: "remote_id".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::RemoteIdHasPrefix(value) => Field { - name: "remote_id".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::RemoteIdHasSuffix(value) => Field { - name: "remote_id".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::RemoteIdEquals(value) => Field { - name: "remote_id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IsPrimaryEquals(value) => Field { - name: "is_primary".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionLT(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionGT(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionLTE(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionGTE(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionEquals(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBefore(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfter(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBeforeEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfterEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TimezoneContains(value) => Field { - name: "timezone".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TimezoneHasPrefix(value) => Field { - name: "timezone".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TimezoneHasSuffix(value) => Field { - name: "timezone".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TimezoneEquals(value) => Field { - name: "timezone".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SpacesSome(value) => Field { - name: "spaces".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SpacesEvery(value) => Field { - name: "spaces".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - } +pub struct LibraryLinkSpaces(Vec); +impl From for LibrarySetParam { + fn from(value: LibraryLinkSpaces) -> Self { + Self::LinkSpaces(value.0) } } -impl From> for LibraryWhereParam { - fn from(op: Operator) -> Self { - match op { - Operator::Not(value) => Self::Not(value), - Operator::And(value) => Self::And(value), - Operator::Or(value) => Self::Or(value), - } - } -} -pub struct LibraryWith { - pub param: LibraryWithParam, -} pub enum LibraryWithParam { Spaces(Vec), } -impl From for LibraryWith { - fn from(param: LibraryWithParam) -> Self { - Self { param } - } -} impl LibraryWithParam { - pub fn output(self) -> Output { + pub fn to_output(self) -> Output { match self { Self::Spaces(where_params) => Output { name: "spaces".into(), @@ -1586,7 +2431,10 @@ impl LibraryWithParam { inputs: if where_params.len() > 0 { vec![Input { name: "where".into(), - fields: where_params.into_iter().map(|f| f.field()).collect(), + fields: where_params + .into_iter() + .map(|param| Into::::into(param).to_field()) + .collect(), ..Default::default() }] } else { @@ -1598,19 +2446,163 @@ impl LibraryWithParam { } } pub enum LibrarySetParam { - Id(i64), + SetId(i32), + SetUuid(String), + SetName(String), + SetRemoteId(String), + SetIsPrimary(bool), + SetEncryption(i32), + SetDateCreated(chrono::DateTime), + SetTimezone(String), + LinkSpaces(Vec), + UnLinkSpaces(Vec), +} +impl LibrarySetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetUuid(value) => Field { + name: "uuid".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetName(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetRemoteId(value) => Field { + name: "remote_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetIsPrimary(value) => Field { + name: "is_primary".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetEncryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTimezone(value) => Field { + name: "timezone".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkSpaces(where_params) => Field { + name: "spaces".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| Into::::into(param).to_field()) + .collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkSpaces(where_params) => Field { + name: "spaces".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| Into::::into(param).to_field()) + .collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum LibraryOrderByParam { + Id(Direction), + Uuid(Direction), + Name(Direction), + RemoteId(Direction), + IsPrimary(Direction), + Encryption(Direction), + DateCreated(Direction), + Timezone(Direction), +} +impl LibraryOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Uuid(direction) => Field { + name: "uuid".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Name(direction) => Field { + name: "name".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::RemoteId(direction) => Field { + name: "remote_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::IsPrimary(direction) => Field { + name: "is_primary".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Encryption(direction) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Timezone(direction) => Field { + name: "timezone".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum LibraryCursor { + Id(i32), Uuid(String), Name(String), RemoteId(String), IsPrimary(bool), - Encryption(i64), + Encryption(i32), DateCreated(chrono::DateTime), Timezone(String), - LinkSpaces(Vec), - UnlinkSpaces(Vec), } -impl LibrarySetParam { - pub fn field(self) -> Field { +impl LibraryCursor { + fn to_field(self) -> Field { match self { Self::Id(value) => Field { name: "id".into(), @@ -1652,28 +2644,1070 @@ impl LibrarySetParam { value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }, - Self::LinkSpaces(where_params) => Field { - name: "spaces".into(), + } + } +} +pub enum LibraryWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + UuidEquals(String), + UuidInVec(Vec), + UuidNotInVec(Vec), + UuidLt(String), + UuidLte(String), + UuidGt(String), + UuidGte(String), + UuidContains(String), + UuidStartsWith(String), + UuidEndsWith(String), + UuidNot(String), + UuidHasPrefix(String), + UuidHasSuffix(String), + NameEquals(String), + NameInVec(Vec), + NameNotInVec(Vec), + NameLt(String), + NameLte(String), + NameGt(String), + NameGte(String), + NameContains(String), + NameStartsWith(String), + NameEndsWith(String), + NameNot(String), + NameHasPrefix(String), + NameHasSuffix(String), + RemoteIdEquals(String), + RemoteIdInVec(Vec), + RemoteIdNotInVec(Vec), + RemoteIdLt(String), + RemoteIdLte(String), + RemoteIdGt(String), + RemoteIdGte(String), + RemoteIdContains(String), + RemoteIdStartsWith(String), + RemoteIdEndsWith(String), + RemoteIdNot(String), + RemoteIdHasPrefix(String), + RemoteIdHasSuffix(String), + IsPrimaryEquals(bool), + EncryptionEquals(i32), + EncryptionInVec(Vec), + EncryptionNotInVec(Vec), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + EncryptionNot(i32), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + TimezoneEquals(String), + TimezoneInVec(Vec), + TimezoneNotInVec(Vec), + TimezoneLt(String), + TimezoneLte(String), + TimezoneGt(String), + TimezoneGte(String), + TimezoneContains(String), + TimezoneStartsWith(String), + TimezoneEndsWith(String), + TimezoneNot(String), + TimezoneHasPrefix(String), + TimezoneHasSuffix(String), + SpacesSome(Vec), + SpacesEvery(Vec), +} +impl LibraryWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - list: true, - wrap_list: true, + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }]), ..Default::default() }, - Self::UnlinkSpaces(where_params) => Field { + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidEquals(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidInVec(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidNotInVec(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidLt(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidLte(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidGt(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidGte(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidContains(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidStartsWith(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidEndsWith(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidNot(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidHasPrefix(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidHasSuffix(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNotInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameStartsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEndsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNot(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdEquals(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdInVec(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdNotInVec(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdLt(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdLte(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdGt(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdGte(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdContains(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdStartsWith(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdEndsWith(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdNot(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdHasPrefix(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RemoteIdHasSuffix(value) => Field { + name: "remote_id".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsPrimaryEquals(value) => Field { + name: "is_primary".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionEquals(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionInVec(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNotInVec(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNot(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneEquals(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneInVec(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneNotInVec(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneLt(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneLte(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneGt(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneGte(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneContains(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneStartsWith(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneEndsWith(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneNot(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneHasPrefix(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneHasSuffix(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SpacesSome(value) => Field { name: "spaces".into(), fields: Some(vec![Field { - name: "disconnect".into(), - list: true, - wrap_list: true, - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), + name: "some".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SpacesEvery(value) => Field { + name: "spaces".into(), + fields: Some(vec![Field { + name: "every".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() @@ -1681,12 +3715,53 @@ impl LibrarySetParam { } } } +pub enum LibraryWhereUniqueParam { + IdEquals(i32), + UuidEquals(String), +} +impl From for LibraryWhereParam { + fn from(value: LibraryWhereUniqueParam) -> Self { + match value { + LibraryWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + LibraryWhereUniqueParam::UuidEquals(value) => Self::UuidEquals(value), + } + } +} +impl From> for LibraryWhereParam { + fn from(op: Operator) -> Self { + match op { + Operator::Not(value) => Self::Not(value), + Operator::And(value) => Self::And(value), + Operator::Or(value) => Self::Or(value), + } + } +} pub struct LibraryFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> LibraryFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> LibraryDelete<'a> { LibraryDelete { @@ -1705,7 +3780,7 @@ impl<'a> LibraryFindMany<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -1725,33 +3800,119 @@ impl<'a> LibraryFindMany<'a> { method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: LibraryOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: LibraryWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LibraryCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct LibraryFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> LibraryFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LibraryWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: LibraryOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LibraryCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct LibraryFindUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LibraryFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> LibraryDelete<'a> { LibraryDelete { @@ -1769,7 +3930,7 @@ impl<'a> LibraryFindUnique<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -1789,45 +3950,107 @@ impl<'a> LibraryFindUnique<'a> { method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LibraryWithParam) -> Self { + self.with_params.push(param); self } } pub struct LibraryCreateOne<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LibraryCreateOne<'a> { - pub async fn exec(self) -> LibraryData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: LibraryWithParam) -> Self { + self.with_params.push(param); + self } } pub struct LibraryUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LibraryUpdateUnique<'a> { - pub async fn exec(self) -> LibraryData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LibraryWithParam) -> Self { + self.with_params.push(param); self } } pub struct LibraryUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LibraryUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LibraryWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LibraryUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> LibraryUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + uuid: LibrarySetUuid, + name: LibrarySetName, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(LibrarySetParam::from(uuid).to_field()); + input_fields.push(LibrarySetParam::from(name).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); self } } @@ -1835,18 +4058,22 @@ pub struct LibraryDelete<'a> { query: Query<'a>, } impl<'a> LibraryDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) } } pub struct LibraryActions<'a> { client: &'a PrismaClient, } impl<'a> LibraryActions<'a> { - pub fn find_unique(&self, param: LibraryWhereParam) -> LibraryFindUnique { - let fields = transform_equals(vec![param.field()]); + pub fn find_unique(&self, param: LibraryWhereUniqueParam) -> LibraryFindUnique { + let param: LibraryWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), @@ -1858,10 +4085,14 @@ impl<'a> LibraryActions<'a> { ..Default::default() }], }; - LibraryFindUnique { query } + LibraryFindUnique { + query, + with_params: vec![], + } } pub fn find_first(&self, params: Vec) -> LibraryFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -1878,7 +4109,10 @@ impl<'a> LibraryActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), @@ -1886,10 +4120,15 @@ impl<'a> LibraryActions<'a> { outputs: library_outputs(), inputs, }; - LibraryFindFirst { query } + LibraryFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn find_many(&self, params: Vec) -> LibraryFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -1900,7 +4139,10 @@ impl<'a> LibraryActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), @@ -1908,7 +4150,11 @@ impl<'a> LibraryActions<'a> { outputs: library_outputs(), inputs, }; - LibraryFindMany { query } + LibraryFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn create_one( &self, @@ -1916,11 +4162,15 @@ impl<'a> LibraryActions<'a> { name: LibrarySetName, params: Vec, ) -> LibraryCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(LibrarySetParam::from(uuid).field()); - input_fields.push(LibrarySetParam::from(name).field()); + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(LibrarySetParam::from(uuid).to_field()); + input_fields.push(LibrarySetParam::from(name).to_field()); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), @@ -1932,7 +4182,31 @@ impl<'a> LibraryActions<'a> { ..Default::default() }], }; - LibraryCreateOne { query } + LibraryCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: LibraryWhereUniqueParam) -> LibraryUpsertOne { + let param: LibraryWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Library".into(), + outputs: library_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + LibraryUpsertOne { query } } } fn library_statistics_outputs() -> Vec { @@ -1949,13 +4223,13 @@ fn library_statistics_outputs() -> Vec { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LibraryStatisticsData { #[serde(rename = "id")] - pub id: i64, + pub id: i32, #[serde(rename = "date_captured")] pub date_captured: chrono::DateTime, #[serde(rename = "library_id")] - pub library_id: i64, + pub library_id: i32, #[serde(rename = "total_file_count")] - pub total_file_count: i64, + pub total_file_count: i32, #[serde(rename = "total_bytes_used")] pub total_bytes_used: String, #[serde(rename = "total_byte_capacity")] @@ -1989,226 +4263,791 @@ impl LibraryStatistics { } } pub struct LibraryStatisticsIdField {} -pub struct LibraryStatisticsSetId(i64); -impl From for LibraryStatisticsSetParam { - fn from(value: LibraryStatisticsSetId) -> Self { - Self::Id(value.0) +impl LibraryStatisticsIdField { + pub fn set>(&self, value: i32) -> T { + LibraryStatisticsSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + LibraryStatisticsWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryStatisticsOrderByParam { + LibraryStatisticsOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> LibraryStatisticsCursor { + LibraryStatisticsCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::IdGte(value) } } -impl LibraryStatisticsIdField { - pub fn lt(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LibraryStatisticsSetId(value).into() +pub struct LibraryStatisticsSetId(i32); +impl From for LibraryStatisticsSetParam { + fn from(value: LibraryStatisticsSetId) -> Self { + Self::SetId(value.0) } } pub struct LibraryStatisticsDateCapturedField {} +impl LibraryStatisticsDateCapturedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + LibraryStatisticsSetDateCaptured(value).into() + } + pub fn equals( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryStatisticsOrderByParam { + LibraryStatisticsOrderByParam::DateCaptured(direction) + } + pub fn cursor( + &self, + cursor: chrono::DateTime, + ) -> LibraryStatisticsCursor { + LibraryStatisticsCursor::DateCaptured(cursor) + } + pub fn in_vec( + &self, + value: Vec>, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedNotInVec(value) + } + pub fn lt( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedLt(value) + } + pub fn lte( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedLte(value) + } + pub fn gt( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedGt(value) + } + pub fn gte( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedGte(value) + } + pub fn not( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedNot(value) + } + pub fn before( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedBefore(value) + } + pub fn after( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedAfter(value) + } + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedBeforeEquals(value) + } + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::DateCapturedAfterEquals(value) + } +} pub struct LibraryStatisticsSetDateCaptured(chrono::DateTime); impl From for LibraryStatisticsSetParam { fn from(value: LibraryStatisticsSetDateCaptured) -> Self { - Self::DateCaptured(value.0) - } -} -impl LibraryStatisticsDateCapturedField { - pub fn before(&self, value: chrono::DateTime) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::DateCapturedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::DateCapturedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::DateCapturedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::DateCapturedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::DateCapturedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - LibraryStatisticsSetDateCaptured(value).into() + Self::SetDateCaptured(value.0) } } pub struct LibraryStatisticsLibraryIdField {} -pub struct LibraryStatisticsSetLibraryId(i64); -impl From for LibraryStatisticsSetParam { - fn from(value: LibraryStatisticsSetLibraryId) -> Self { - Self::LibraryId(value.0) +impl LibraryStatisticsLibraryIdField { + pub fn set>(&self, value: i32) -> T { + LibraryStatisticsSetLibraryId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + LibraryStatisticsWhereUniqueParam::LibraryIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryStatisticsOrderByParam { + LibraryStatisticsOrderByParam::LibraryId(direction) + } + pub fn cursor(&self, cursor: i32) -> LibraryStatisticsCursor { + LibraryStatisticsCursor::LibraryId(cursor) + } + pub fn increment(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::LibraryId(value) + } + pub fn decrement(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::LibraryId(value) + } + pub fn multiply(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::LibraryId(value) + } + pub fn divide(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::LibraryId(value) + } + pub fn in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdLt(value) + } + pub fn lte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdLte(value) + } + pub fn gt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdGt(value) + } + pub fn gte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdGte(value) + } + pub fn not(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdNot(value) + } + pub fn lt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdLt(value) + } + pub fn lte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdLte(value) + } + pub fn gt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdGt(value) + } + pub fn gte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::LibraryIdGte(value) } } -impl LibraryStatisticsLibraryIdField { - pub fn lt(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::LibraryIdLT(value) - } - pub fn gt(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::LibraryIdGT(value) - } - pub fn lte(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::LibraryIdLTE(value) - } - pub fn gte(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::LibraryIdGTE(value) - } - pub fn equals(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::LibraryIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LibraryStatisticsSetLibraryId(value).into() +pub struct LibraryStatisticsSetLibraryId(i32); +impl From for LibraryStatisticsSetParam { + fn from(value: LibraryStatisticsSetLibraryId) -> Self { + Self::SetLibraryId(value.0) } } pub struct LibraryStatisticsTotalFileCountField {} -pub struct LibraryStatisticsSetTotalFileCount(i64); -impl From for LibraryStatisticsSetParam { - fn from(value: LibraryStatisticsSetTotalFileCount) -> Self { - Self::TotalFileCount(value.0) +impl LibraryStatisticsTotalFileCountField { + pub fn set>(&self, value: i32) -> T { + LibraryStatisticsSetTotalFileCount(value).into() + } + pub fn equals(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryStatisticsOrderByParam { + LibraryStatisticsOrderByParam::TotalFileCount(direction) + } + pub fn cursor(&self, cursor: i32) -> LibraryStatisticsCursor { + LibraryStatisticsCursor::TotalFileCount(cursor) + } + pub fn increment(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::TotalFileCount(value) + } + pub fn decrement(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::TotalFileCount(value) + } + pub fn multiply(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::TotalFileCount(value) + } + pub fn divide(&self, value: i32) -> LibraryStatisticsSetParam { + LibraryStatisticsSetParam::TotalFileCount(value) + } + pub fn in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountNotInVec(value) + } + pub fn lt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountLt(value) + } + pub fn lte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountLte(value) + } + pub fn gt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountGt(value) + } + pub fn gte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountGte(value) + } + pub fn not(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountNot(value) + } + pub fn lt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountLt(value) + } + pub fn lte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountLte(value) + } + pub fn gt(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountGt(value) + } + pub fn gte(&self, value: i32) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalFileCountGte(value) } } -impl LibraryStatisticsTotalFileCountField { - pub fn lt(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::TotalFileCountLT(value) - } - pub fn gt(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::TotalFileCountGT(value) - } - pub fn lte(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::TotalFileCountLTE(value) - } - pub fn gte(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::TotalFileCountGTE(value) - } - pub fn equals(&self, value: i64) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::TotalFileCountEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LibraryStatisticsSetTotalFileCount(value).into() +pub struct LibraryStatisticsSetTotalFileCount(i32); +impl From for LibraryStatisticsSetParam { + fn from(value: LibraryStatisticsSetTotalFileCount) -> Self { + Self::SetTotalFileCount(value.0) } } pub struct LibraryStatisticsTotalBytesUsedField {} -pub struct LibraryStatisticsSetTotalBytesUsed(String); -impl From for LibraryStatisticsSetParam { - fn from(value: LibraryStatisticsSetTotalBytesUsed) -> Self { - Self::TotalBytesUsed(value.0) - } -} impl LibraryStatisticsTotalBytesUsedField { + pub fn set>(&self, value: String) -> T { + LibraryStatisticsSetTotalBytesUsed(value).into() + } + pub fn equals(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryStatisticsOrderByParam { + LibraryStatisticsOrderByParam::TotalBytesUsed(direction) + } + pub fn cursor(&self, cursor: String) -> LibraryStatisticsCursor { + LibraryStatisticsCursor::TotalBytesUsed(cursor) + } + pub fn in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedNotInVec(value) + } + pub fn lt(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedLt(value) + } + pub fn lte(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedLte(value) + } + pub fn gt(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedGt(value) + } + pub fn gte(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedGte(value) + } pub fn contains(&self, value: String) -> LibraryStatisticsWhereParam { LibraryStatisticsWhereParam::TotalBytesUsedContains(value) } + pub fn starts_with(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedEndsWith(value) + } + pub fn not(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalBytesUsedNot(value) + } pub fn has_prefix(&self, value: String) -> LibraryStatisticsWhereParam { LibraryStatisticsWhereParam::TotalBytesUsedHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LibraryStatisticsWhereParam { LibraryStatisticsWhereParam::TotalBytesUsedHasSuffix(value) } - pub fn equals(&self, value: String) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::TotalBytesUsedEquals(value) - } - pub fn set>(&self, value: String) -> T { - LibraryStatisticsSetTotalBytesUsed(value).into() +} +pub struct LibraryStatisticsSetTotalBytesUsed(String); +impl From for LibraryStatisticsSetParam { + fn from(value: LibraryStatisticsSetTotalBytesUsed) -> Self { + Self::SetTotalBytesUsed(value.0) } } pub struct LibraryStatisticsTotalByteCapacityField {} -pub struct LibraryStatisticsSetTotalByteCapacity(String); -impl From for LibraryStatisticsSetParam { - fn from(value: LibraryStatisticsSetTotalByteCapacity) -> Self { - Self::TotalByteCapacity(value.0) - } -} impl LibraryStatisticsTotalByteCapacityField { + pub fn set>( + &self, + value: String, + ) -> T { + LibraryStatisticsSetTotalByteCapacity(value).into() + } + pub fn equals(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryStatisticsOrderByParam { + LibraryStatisticsOrderByParam::TotalByteCapacity(direction) + } + pub fn cursor(&self, cursor: String) -> LibraryStatisticsCursor { + LibraryStatisticsCursor::TotalByteCapacity(cursor) + } + pub fn in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityNotInVec(value) + } + pub fn lt(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityLt(value) + } + pub fn lte(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityLte(value) + } + pub fn gt(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityGt(value) + } + pub fn gte(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityGte(value) + } pub fn contains(&self, value: String) -> LibraryStatisticsWhereParam { LibraryStatisticsWhereParam::TotalByteCapacityContains(value) } + pub fn starts_with(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityEndsWith(value) + } + pub fn not(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalByteCapacityNot(value) + } pub fn has_prefix(&self, value: String) -> LibraryStatisticsWhereParam { LibraryStatisticsWhereParam::TotalByteCapacityHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LibraryStatisticsWhereParam { LibraryStatisticsWhereParam::TotalByteCapacityHasSuffix(value) } - pub fn equals(&self, value: String) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::TotalByteCapacityEquals(value) - } - pub fn set>(&self, value: String) -> T { - LibraryStatisticsSetTotalByteCapacity(value).into() +} +pub struct LibraryStatisticsSetTotalByteCapacity(String); +impl From for LibraryStatisticsSetParam { + fn from(value: LibraryStatisticsSetTotalByteCapacity) -> Self { + Self::SetTotalByteCapacity(value.0) } } pub struct LibraryStatisticsTotalUniqueBytesField {} -pub struct LibraryStatisticsSetTotalUniqueBytes(String); -impl From for LibraryStatisticsSetParam { - fn from(value: LibraryStatisticsSetTotalUniqueBytes) -> Self { - Self::TotalUniqueBytes(value.0) - } -} impl LibraryStatisticsTotalUniqueBytesField { + pub fn set>(&self, value: String) -> T { + LibraryStatisticsSetTotalUniqueBytes(value).into() + } + pub fn equals(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LibraryStatisticsOrderByParam { + LibraryStatisticsOrderByParam::TotalUniqueBytes(direction) + } + pub fn cursor(&self, cursor: String) -> LibraryStatisticsCursor { + LibraryStatisticsCursor::TotalUniqueBytes(cursor) + } + pub fn in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesNotInVec(value) + } + pub fn lt(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesLt(value) + } + pub fn lte(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesLte(value) + } + pub fn gt(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesGt(value) + } + pub fn gte(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesGte(value) + } pub fn contains(&self, value: String) -> LibraryStatisticsWhereParam { LibraryStatisticsWhereParam::TotalUniqueBytesContains(value) } + pub fn starts_with(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesEndsWith(value) + } + pub fn not(&self, value: String) -> LibraryStatisticsWhereParam { + LibraryStatisticsWhereParam::TotalUniqueBytesNot(value) + } pub fn has_prefix(&self, value: String) -> LibraryStatisticsWhereParam { LibraryStatisticsWhereParam::TotalUniqueBytesHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LibraryStatisticsWhereParam { LibraryStatisticsWhereParam::TotalUniqueBytesHasSuffix(value) } - pub fn equals(&self, value: String) -> LibraryStatisticsWhereParam { - LibraryStatisticsWhereParam::TotalUniqueBytesEquals(value) +} +pub struct LibraryStatisticsSetTotalUniqueBytes(String); +impl From for LibraryStatisticsSetParam { + fn from(value: LibraryStatisticsSetTotalUniqueBytes) -> Self { + Self::SetTotalUniqueBytes(value.0) } - pub fn set>(&self, value: String) -> T { - LibraryStatisticsSetTotalUniqueBytes(value).into() +} +pub enum LibraryStatisticsWithParam {} +impl LibraryStatisticsWithParam { + pub fn to_output(self) -> Output { + match self {} + } +} +pub enum LibraryStatisticsSetParam { + SetId(i32), + SetDateCaptured(chrono::DateTime), + SetLibraryId(i32), + SetTotalFileCount(i32), + SetTotalBytesUsed(String), + SetTotalByteCapacity(String), + SetTotalUniqueBytes(String), +} +impl LibraryStatisticsSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCaptured(value) => Field { + name: "date_captured".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetLibraryId(value) => Field { + name: "library_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTotalFileCount(value) => Field { + name: "total_file_count".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTotalBytesUsed(value) => Field { + name: "total_bytes_used".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTotalByteCapacity(value) => Field { + name: "total_byte_capacity".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTotalUniqueBytes(value) => Field { + name: "total_unique_bytes".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum LibraryStatisticsOrderByParam { + Id(Direction), + DateCaptured(Direction), + LibraryId(Direction), + TotalFileCount(Direction), + TotalBytesUsed(Direction), + TotalByteCapacity(Direction), + TotalUniqueBytes(Direction), +} +impl LibraryStatisticsOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCaptured(direction) => Field { + name: "date_captured".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::LibraryId(direction) => Field { + name: "library_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::TotalFileCount(direction) => Field { + name: "total_file_count".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::TotalBytesUsed(direction) => Field { + name: "total_bytes_used".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::TotalByteCapacity(direction) => Field { + name: "total_byte_capacity".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::TotalUniqueBytes(direction) => Field { + name: "total_unique_bytes".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum LibraryStatisticsCursor { + Id(i32), + DateCaptured(chrono::DateTime), + LibraryId(i32), + TotalFileCount(i32), + TotalBytesUsed(String), + TotalByteCapacity(String), + TotalUniqueBytes(String), +} +impl LibraryStatisticsCursor { + fn to_field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCaptured(value) => Field { + name: "date_captured".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LibraryId(value) => Field { + name: "library_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalFileCount(value) => Field { + name: "total_file_count".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalBytesUsed(value) => Field { + name: "total_bytes_used".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalByteCapacity(value) => Field { + name: "total_byte_capacity".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TotalUniqueBytes(value) => Field { + name: "total_unique_bytes".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } } } pub enum LibraryStatisticsWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + DateCapturedEquals(chrono::DateTime), + DateCapturedInVec(Vec>), + DateCapturedNotInVec(Vec>), + DateCapturedLt(chrono::DateTime), + DateCapturedLte(chrono::DateTime), + DateCapturedGt(chrono::DateTime), + DateCapturedGte(chrono::DateTime), + DateCapturedNot(chrono::DateTime), DateCapturedBefore(chrono::DateTime), DateCapturedAfter(chrono::DateTime), DateCapturedBeforeEquals(chrono::DateTime), DateCapturedAfterEquals(chrono::DateTime), - DateCapturedEquals(chrono::DateTime), - LibraryIdLT(i64), - LibraryIdGT(i64), - LibraryIdLTE(i64), - LibraryIdGTE(i64), - LibraryIdEquals(i64), - TotalFileCountLT(i64), - TotalFileCountGT(i64), - TotalFileCountLTE(i64), - TotalFileCountGTE(i64), - TotalFileCountEquals(i64), + LibraryIdEquals(i32), + LibraryIdInVec(Vec), + LibraryIdNotInVec(Vec), + LibraryIdLt(i32), + LibraryIdLte(i32), + LibraryIdGt(i32), + LibraryIdGte(i32), + LibraryIdNot(i32), + LibraryIdLt(i32), + LibraryIdLte(i32), + LibraryIdGt(i32), + LibraryIdGte(i32), + TotalFileCountEquals(i32), + TotalFileCountInVec(Vec), + TotalFileCountNotInVec(Vec), + TotalFileCountLt(i32), + TotalFileCountLte(i32), + TotalFileCountGt(i32), + TotalFileCountGte(i32), + TotalFileCountNot(i32), + TotalFileCountLt(i32), + TotalFileCountLte(i32), + TotalFileCountGt(i32), + TotalFileCountGte(i32), + TotalBytesUsedEquals(String), + TotalBytesUsedInVec(Vec), + TotalBytesUsedNotInVec(Vec), + TotalBytesUsedLt(String), + TotalBytesUsedLte(String), + TotalBytesUsedGt(String), + TotalBytesUsedGte(String), TotalBytesUsedContains(String), + TotalBytesUsedStartsWith(String), + TotalBytesUsedEndsWith(String), + TotalBytesUsedNot(String), TotalBytesUsedHasPrefix(String), TotalBytesUsedHasSuffix(String), - TotalBytesUsedEquals(String), + TotalByteCapacityEquals(String), + TotalByteCapacityInVec(Vec), + TotalByteCapacityNotInVec(Vec), + TotalByteCapacityLt(String), + TotalByteCapacityLte(String), + TotalByteCapacityGt(String), + TotalByteCapacityGte(String), TotalByteCapacityContains(String), + TotalByteCapacityStartsWith(String), + TotalByteCapacityEndsWith(String), + TotalByteCapacityNot(String), TotalByteCapacityHasPrefix(String), TotalByteCapacityHasSuffix(String), - TotalByteCapacityEquals(String), + TotalUniqueBytesEquals(String), + TotalUniqueBytesInVec(Vec), + TotalUniqueBytesNotInVec(Vec), + TotalUniqueBytesLt(String), + TotalUniqueBytesLte(String), + TotalUniqueBytesGt(String), + TotalUniqueBytesGte(String), TotalUniqueBytesContains(String), + TotalUniqueBytesStartsWith(String), + TotalUniqueBytesEndsWith(String), + TotalUniqueBytesNot(String), TotalUniqueBytesHasPrefix(String), TotalUniqueBytesHasSuffix(String), - TotalUniqueBytesEquals(String), - Not(Vec), - Or(Vec), - And(Vec), } impl LibraryStatisticsWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { name: "id".into(), fields: Some(vec![Field { name: "lt".into(), @@ -2217,16 +5056,7 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdLTE(value) => Field { + Self::IdLte(value) => Field { name: "id".into(), fields: Some(vec![Field { name: "lte".into(), @@ -2235,7 +5065,16 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::IdGTE(value) => Field { + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { name: "id".into(), fields: Some(vec![Field { name: "gte".into(), @@ -2244,8 +5083,53 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::IdEquals(value) => Field { + Self::IdNot(value) => Field { name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCapturedEquals(value) => Field { + name: "date_captured".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -2253,6 +5137,87 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, + Self::DateCapturedInVec(value) => Field { + name: "date_captured".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCapturedNotInVec(value) => Field { + name: "date_captured".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCapturedLt(value) => Field { + name: "date_captured".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCapturedLte(value) => Field { + name: "date_captured".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCapturedGt(value) => Field { + name: "date_captured".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCapturedGte(value) => Field { + name: "date_captured".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCapturedNot(value) => Field { + name: "date_captured".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateCapturedBefore(value) => Field { name: "date_captured".into(), fields: Some(vec![Field { @@ -2289,51 +5254,6 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::DateCapturedEquals(value) => Field { - name: "date_captured".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LibraryIdLT(value) => Field { - name: "library_id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LibraryIdGT(value) => Field { - name: "library_id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LibraryIdLTE(value) => Field { - name: "library_id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LibraryIdGTE(value) => Field { - name: "library_id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, Self::LibraryIdEquals(value) => Field { name: "library_id".into(), fields: Some(vec![Field { @@ -2343,8 +5263,44 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::TotalFileCountLT(value) => Field { - name: "total_file_count".into(), + Self::LibraryIdInVec(value) => Field { + name: "library_id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdNotInVec(value) => Field { + name: "library_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdLt(value) => Field { + name: "library_id".into(), fields: Some(vec![Field { name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -2352,17 +5308,8 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::TotalFileCountGT(value) => Field { - name: "total_file_count".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalFileCountLTE(value) => Field { - name: "total_file_count".into(), + Self::LibraryIdLte(value) => Field { + name: "library_id".into(), fields: Some(vec![Field { name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -2370,8 +5317,62 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::TotalFileCountGTE(value) => Field { - name: "total_file_count".into(), + Self::LibraryIdGt(value) => Field { + name: "library_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdGte(value) => Field { + name: "library_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdNot(value) => Field { + name: "library_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdLt(value) => Field { + name: "library_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdLte(value) => Field { + name: "library_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdGt(value) => Field { + name: "library_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdGte(value) => Field { + name: "library_id".into(), fields: Some(vec![Field { name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -2388,6 +5389,204 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, + Self::TotalFileCountInVec(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountNotInVec(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountLt(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountLte(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountGt(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountGte(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountNot(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountLt(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountLte(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountGt(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFileCountGte(value) => Field { + name: "total_file_count".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedEquals(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedInVec(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedNotInVec(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedLt(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedLte(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedGt(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedGte(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::TotalBytesUsedContains(value) => Field { name: "total_bytes_used".into(), fields: Some(vec![Field { @@ -2397,6 +5596,33 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, + Self::TotalBytesUsedStartsWith(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedEndsWith(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalBytesUsedNot(value) => Field { + name: "total_bytes_used".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::TotalBytesUsedHasPrefix(value) => Field { name: "total_bytes_used".into(), fields: Some(vec![Field { @@ -2415,8 +5641,8 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::TotalBytesUsedEquals(value) => Field { - name: "total_bytes_used".into(), + Self::TotalByteCapacityEquals(value) => Field { + name: "total_byte_capacity".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -2424,6 +5650,78 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, + Self::TotalByteCapacityInVec(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityNotInVec(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityLt(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityLte(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityGt(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityGte(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::TotalByteCapacityContains(value) => Field { name: "total_byte_capacity".into(), fields: Some(vec![Field { @@ -2433,6 +5731,33 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, + Self::TotalByteCapacityStartsWith(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityEndsWith(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalByteCapacityNot(value) => Field { + name: "total_byte_capacity".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::TotalByteCapacityHasPrefix(value) => Field { name: "total_byte_capacity".into(), fields: Some(vec![Field { @@ -2451,8 +5776,8 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::TotalByteCapacityEquals(value) => Field { - name: "total_byte_capacity".into(), + Self::TotalUniqueBytesEquals(value) => Field { + name: "total_unique_bytes".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -2460,6 +5785,78 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, + Self::TotalUniqueBytesInVec(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesNotInVec(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesLt(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesLte(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesGt(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesGte(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::TotalUniqueBytesContains(value) => Field { name: "total_unique_bytes".into(), fields: Some(vec![Field { @@ -2469,6 +5866,33 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, + Self::TotalUniqueBytesStartsWith(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesEndsWith(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalUniqueBytesNot(value) => Field { + name: "total_unique_bytes".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::TotalUniqueBytesHasPrefix(value) => Field { name: "total_unique_bytes".into(), fields: Some(vec![Field { @@ -2487,35 +5911,19 @@ impl LibraryStatisticsWhereParam { }]), ..Default::default() }, - Self::TotalUniqueBytesEquals(value) => Field { - name: "total_unique_bytes".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() + } + } +} +pub enum LibraryStatisticsWhereUniqueParam { + IdEquals(i32), + LibraryIdEquals(i32), +} +impl From for LibraryStatisticsWhereParam { + fn from(value: LibraryStatisticsWhereUniqueParam) -> Self { + match value { + LibraryStatisticsWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + LibraryStatisticsWhereUniqueParam::LibraryIdEquals(value) => { + Self::LibraryIdEquals(value) }, } } @@ -2529,76 +5937,32 @@ impl From> for LibraryStatisticsWhereParam { } } } -pub struct LibraryStatisticsWith { - pub param: LibraryStatisticsWithParam, -} -pub enum LibraryStatisticsWithParam {} -impl From for LibraryStatisticsWith { - fn from(param: LibraryStatisticsWithParam) -> Self { - Self { param } - } -} -impl LibraryStatisticsWithParam { - pub fn output(self) -> Output { - match self {} - } -} -pub enum LibraryStatisticsSetParam { - Id(i64), - DateCaptured(chrono::DateTime), - LibraryId(i64), - TotalFileCount(i64), - TotalBytesUsed(String), - TotalByteCapacity(String), - TotalUniqueBytes(String), -} -impl LibraryStatisticsSetParam { - pub fn field(self) -> Field { - match self { - Self::Id(value) => Field { - name: "id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::DateCaptured(value) => Field { - name: "date_captured".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LibraryId(value) => Field { - name: "library_id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::TotalFileCount(value) => Field { - name: "total_file_count".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::TotalBytesUsed(value) => Field { - name: "total_bytes_used".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::TotalByteCapacity(value) => Field { - name: "total_byte_capacity".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::TotalUniqueBytes(value) => Field { - name: "total_unique_bytes".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - } - } -} pub struct LibraryStatisticsFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> LibraryStatisticsFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> LibraryStatisticsDelete<'a> { LibraryStatisticsDelete { @@ -2611,13 +5975,16 @@ impl<'a> LibraryStatisticsFindMany<'a> { }, } } - pub fn update(mut self, params: Vec) -> LibraryStatisticsUpdateMany<'a> { + pub fn update( + mut self, + params: Vec, + ) -> LibraryStatisticsUpdateMany<'a> { self.query.inputs.push(Input { name: "data".into(), fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -2637,33 +6004,119 @@ impl<'a> LibraryStatisticsFindMany<'a> { method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: LibraryStatisticsOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: LibraryStatisticsWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LibraryStatisticsCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct LibraryStatisticsFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> LibraryStatisticsFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LibraryStatisticsWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: LibraryStatisticsOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LibraryStatisticsCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct LibraryStatisticsFindUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LibraryStatisticsFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> LibraryStatisticsDelete<'a> { LibraryStatisticsDelete { @@ -2675,13 +6128,16 @@ impl<'a> LibraryStatisticsFindUnique<'a> { }, } } - pub fn update(mut self, params: Vec) -> LibraryStatisticsUpdateUnique<'a> { + pub fn update( + mut self, + params: Vec, + ) -> LibraryStatisticsUpdateUnique<'a> { self.query.inputs.push(Input { name: "data".into(), fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -2701,45 +6157,105 @@ impl<'a> LibraryStatisticsFindUnique<'a> { method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LibraryStatisticsWithParam) -> Self { + self.with_params.push(param); self } } pub struct LibraryStatisticsCreateOne<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LibraryStatisticsCreateOne<'a> { - pub async fn exec(self) -> LibraryStatisticsData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: LibraryStatisticsWithParam) -> Self { + self.with_params.push(param); + self } } pub struct LibraryStatisticsUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LibraryStatisticsUpdateUnique<'a> { - pub async fn exec(self) -> LibraryStatisticsData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LibraryStatisticsWithParam) -> Self { + self.with_params.push(param); self } } pub struct LibraryStatisticsUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LibraryStatisticsUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LibraryStatisticsWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LibraryStatisticsUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> LibraryStatisticsUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + library_id: LibraryStatisticsSetLibraryId, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(LibraryStatisticsSetParam::from(library_id).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); self } } @@ -2747,18 +6263,25 @@ pub struct LibraryStatisticsDelete<'a> { query: Query<'a>, } impl<'a> LibraryStatisticsDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) } } pub struct LibraryStatisticsActions<'a> { client: &'a PrismaClient, } impl<'a> LibraryStatisticsActions<'a> { - pub fn find_unique(&self, param: LibraryStatisticsWhereParam) -> LibraryStatisticsFindUnique { - let fields = transform_equals(vec![param.field()]); + pub fn find_unique( + &self, + param: LibraryStatisticsWhereUniqueParam, + ) -> LibraryStatisticsFindUnique { + let param: LibraryStatisticsWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), @@ -2770,10 +6293,17 @@ impl<'a> LibraryStatisticsActions<'a> { ..Default::default() }], }; - LibraryStatisticsFindUnique { query } + LibraryStatisticsFindUnique { + query, + with_params: vec![], + } } - pub fn find_first(&self, params: Vec) -> LibraryStatisticsFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + pub fn find_first( + &self, + params: Vec, + ) -> LibraryStatisticsFindFirst { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -2790,7 +6320,10 @@ impl<'a> LibraryStatisticsActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), @@ -2798,10 +6331,18 @@ impl<'a> LibraryStatisticsActions<'a> { outputs: library_statistics_outputs(), inputs, }; - LibraryStatisticsFindFirst { query } + LibraryStatisticsFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } - pub fn find_many(&self, params: Vec) -> LibraryStatisticsFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + pub fn find_many( + &self, + params: Vec, + ) -> LibraryStatisticsFindMany { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -2812,7 +6353,10 @@ impl<'a> LibraryStatisticsActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), @@ -2820,17 +6364,25 @@ impl<'a> LibraryStatisticsActions<'a> { outputs: library_statistics_outputs(), inputs, }; - LibraryStatisticsFindMany { query } + LibraryStatisticsFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn create_one( &self, library_id: LibraryStatisticsSetLibraryId, params: Vec, ) -> LibraryStatisticsCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(LibraryStatisticsSetParam::from(library_id).field()); + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(LibraryStatisticsSetParam::from(library_id).to_field()); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), @@ -2842,7 +6394,34 @@ impl<'a> LibraryStatisticsActions<'a> { ..Default::default() }], }; - LibraryStatisticsCreateOne { query } + LibraryStatisticsCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one( + &self, + param: LibraryStatisticsWhereUniqueParam, + ) -> LibraryStatisticsUpsertOne { + let param: LibraryStatisticsWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "LibraryStatistics".into(), + outputs: library_statistics_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + LibraryStatisticsUpsertOne { query } } } fn client_outputs() -> Vec { @@ -2861,13 +6440,13 @@ fn client_outputs() -> Vec { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ClientData { #[serde(rename = "id")] - pub id: i64, + pub id: i32, #[serde(rename = "uuid")] pub uuid: String, #[serde(rename = "name")] pub name: String, #[serde(rename = "platform")] - pub platform: i64, + pub platform: i32, #[serde(rename = "version")] pub version: Option, #[serde(rename = "online")] @@ -2911,662 +6490,655 @@ impl Client { } } pub struct ClientIdField {} -pub struct ClientSetId(i64); -impl From for ClientSetParam { - fn from(value: ClientSetId) -> Self { - Self::Id(value.0) +impl ClientIdField { + pub fn set>(&self, value: i32) -> T { + ClientSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + ClientWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> ClientOrderByParam { + ClientOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> ClientCursor { + ClientCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> ClientSetParam { + ClientSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> ClientSetParam { + ClientSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> ClientSetParam { + ClientSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> ClientSetParam { + ClientSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::IdGte(value) } } -impl ClientIdField { - pub fn lt(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - ClientSetId(value).into() +pub struct ClientSetId(i32); +impl From for ClientSetParam { + fn from(value: ClientSetId) -> Self { + Self::SetId(value.0) } } pub struct ClientUuidField {} -pub struct ClientSetUuid(String); -impl From for ClientSetParam { - fn from(value: ClientSetUuid) -> Self { - Self::Uuid(value.0) - } -} impl ClientUuidField { + pub fn set>(&self, value: String) -> T { + ClientSetUuid(value).into() + } + pub fn equals>(&self, value: String) -> T { + ClientWhereUniqueParam::UuidEquals(value).into() + } + pub fn order(&self, direction: Direction) -> ClientOrderByParam { + ClientOrderByParam::Uuid(direction) + } + pub fn cursor(&self, cursor: String) -> ClientCursor { + ClientCursor::Uuid(cursor) + } + pub fn in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::UuidInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::UuidNotInVec(value) + } + pub fn lt(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidLt(value) + } + pub fn lte(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidLte(value) + } + pub fn gt(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidGt(value) + } + pub fn gte(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidGte(value) + } pub fn contains(&self, value: String) -> ClientWhereParam { ClientWhereParam::UuidContains(value) } + pub fn starts_with(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidStartsWith(value) + } + pub fn ends_with(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidEndsWith(value) + } + pub fn not(&self, value: String) -> ClientWhereParam { + ClientWhereParam::UuidNot(value) + } pub fn has_prefix(&self, value: String) -> ClientWhereParam { ClientWhereParam::UuidHasPrefix(value) } pub fn has_suffix(&self, value: String) -> ClientWhereParam { ClientWhereParam::UuidHasSuffix(value) } - pub fn equals(&self, value: String) -> ClientWhereParam { - ClientWhereParam::UuidEquals(value) - } - pub fn set>(&self, value: String) -> T { - ClientSetUuid(value).into() +} +pub struct ClientSetUuid(String); +impl From for ClientSetParam { + fn from(value: ClientSetUuid) -> Self { + Self::SetUuid(value.0) } } pub struct ClientNameField {} -pub struct ClientSetName(String); -impl From for ClientSetParam { - fn from(value: ClientSetName) -> Self { - Self::Name(value.0) - } -} impl ClientNameField { + pub fn set>(&self, value: String) -> T { + ClientSetName(value).into() + } + pub fn equals(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameEquals(value).into() + } + pub fn order(&self, direction: Direction) -> ClientOrderByParam { + ClientOrderByParam::Name(direction) + } + pub fn cursor(&self, cursor: String) -> ClientCursor { + ClientCursor::Name(cursor) + } + pub fn in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::NameInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::NameNotInVec(value) + } + pub fn lt(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameLt(value) + } + pub fn lte(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameLte(value) + } + pub fn gt(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameGt(value) + } + pub fn gte(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameGte(value) + } pub fn contains(&self, value: String) -> ClientWhereParam { ClientWhereParam::NameContains(value) } + pub fn starts_with(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameStartsWith(value) + } + pub fn ends_with(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameEndsWith(value) + } + pub fn not(&self, value: String) -> ClientWhereParam { + ClientWhereParam::NameNot(value) + } pub fn has_prefix(&self, value: String) -> ClientWhereParam { ClientWhereParam::NameHasPrefix(value) } pub fn has_suffix(&self, value: String) -> ClientWhereParam { ClientWhereParam::NameHasSuffix(value) } - pub fn equals(&self, value: String) -> ClientWhereParam { - ClientWhereParam::NameEquals(value) - } - pub fn set>(&self, value: String) -> T { - ClientSetName(value).into() +} +pub struct ClientSetName(String); +impl From for ClientSetParam { + fn from(value: ClientSetName) -> Self { + Self::SetName(value.0) } } pub struct ClientPlatformField {} -pub struct ClientSetPlatform(i64); -impl From for ClientSetParam { - fn from(value: ClientSetPlatform) -> Self { - Self::Platform(value.0) +impl ClientPlatformField { + pub fn set>(&self, value: i32) -> T { + ClientSetPlatform(value).into() + } + pub fn equals(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformEquals(value).into() + } + pub fn order(&self, direction: Direction) -> ClientOrderByParam { + ClientOrderByParam::Platform(direction) + } + pub fn cursor(&self, cursor: i32) -> ClientCursor { + ClientCursor::Platform(cursor) + } + pub fn increment(&self, value: i32) -> ClientSetParam { + ClientSetParam::Platform(value) + } + pub fn decrement(&self, value: i32) -> ClientSetParam { + ClientSetParam::Platform(value) + } + pub fn multiply(&self, value: i32) -> ClientSetParam { + ClientSetParam::Platform(value) + } + pub fn divide(&self, value: i32) -> ClientSetParam { + ClientSetParam::Platform(value) + } + pub fn in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::PlatformInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::PlatformNotInVec(value) + } + pub fn lt(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformLt(value) + } + pub fn lte(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformLte(value) + } + pub fn gt(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformGt(value) + } + pub fn gte(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformGte(value) + } + pub fn not(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformNot(value) + } + pub fn lt(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformLt(value) + } + pub fn lte(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformLte(value) + } + pub fn gt(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformGt(value) + } + pub fn gte(&self, value: i32) -> ClientWhereParam { + ClientWhereParam::PlatformGte(value) } } -impl ClientPlatformField { - pub fn lt(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::PlatformLT(value) - } - pub fn gt(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::PlatformGT(value) - } - pub fn lte(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::PlatformLTE(value) - } - pub fn gte(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::PlatformGTE(value) - } - pub fn equals(&self, value: i64) -> ClientWhereParam { - ClientWhereParam::PlatformEquals(value) - } - pub fn set>(&self, value: i64) -> T { - ClientSetPlatform(value).into() +pub struct ClientSetPlatform(i32); +impl From for ClientSetParam { + fn from(value: ClientSetPlatform) -> Self { + Self::SetPlatform(value.0) } } pub struct ClientVersionField {} -pub struct ClientSetVersion(String); -impl From for ClientSetParam { - fn from(value: ClientSetVersion) -> Self { - Self::Version(value.0) - } -} impl ClientVersionField { + pub fn set>(&self, value: String) -> T { + ClientSetVersion(value).into() + } + pub fn equals(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionEquals(value).into() + } + pub fn order(&self, direction: Direction) -> ClientOrderByParam { + ClientOrderByParam::Version(direction) + } + pub fn cursor(&self, cursor: String) -> ClientCursor { + ClientCursor::Version(cursor) + } + pub fn in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::VersionInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::VersionNotInVec(value) + } + pub fn lt(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionLt(value) + } + pub fn lte(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionLte(value) + } + pub fn gt(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionGt(value) + } + pub fn gte(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionGte(value) + } pub fn contains(&self, value: String) -> ClientWhereParam { ClientWhereParam::VersionContains(value) } + pub fn starts_with(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionStartsWith(value) + } + pub fn ends_with(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionEndsWith(value) + } + pub fn not(&self, value: String) -> ClientWhereParam { + ClientWhereParam::VersionNot(value) + } pub fn has_prefix(&self, value: String) -> ClientWhereParam { ClientWhereParam::VersionHasPrefix(value) } pub fn has_suffix(&self, value: String) -> ClientWhereParam { ClientWhereParam::VersionHasSuffix(value) } - pub fn equals(&self, value: String) -> ClientWhereParam { - ClientWhereParam::VersionEquals(value) - } - pub fn set>(&self, value: String) -> T { - ClientSetVersion(value).into() +} +pub struct ClientSetVersion(String); +impl From for ClientSetParam { + fn from(value: ClientSetVersion) -> Self { + Self::SetVersion(value.0) } } pub struct ClientOnlineField {} -pub struct ClientSetOnline(bool); -impl From for ClientSetParam { - fn from(value: ClientSetOnline) -> Self { - Self::Online(value.0) - } -} impl ClientOnlineField { - pub fn equals(&self, value: bool) -> ClientWhereParam { - ClientWhereParam::OnlineEquals(value) - } pub fn set>(&self, value: bool) -> T { ClientSetOnline(value).into() } -} -pub struct ClientLastSeenField {} -pub struct ClientSetLastSeen(chrono::DateTime); -impl From for ClientSetParam { - fn from(value: ClientSetLastSeen) -> Self { - Self::LastSeen(value.0) + pub fn equals(&self, value: bool) -> ClientWhereParam { + ClientWhereParam::OnlineEquals(value).into() + } + pub fn order(&self, direction: Direction) -> ClientOrderByParam { + ClientOrderByParam::Online(direction) + } + pub fn cursor(&self, cursor: bool) -> ClientCursor { + ClientCursor::Online(cursor) } } +pub struct ClientSetOnline(bool); +impl From for ClientSetParam { + fn from(value: ClientSetOnline) -> Self { + Self::SetOnline(value.0) + } +} +pub struct ClientLastSeenField {} impl ClientLastSeenField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + ClientSetLastSeen(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenEquals(value).into() + } + pub fn order(&self, direction: Direction) -> ClientOrderByParam { + ClientOrderByParam::LastSeen(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> ClientCursor { + ClientCursor::LastSeen(cursor) + } + pub fn in_vec(&self, value: Vec>) -> ClientWhereParam { + ClientWhereParam::LastSeenInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> ClientWhereParam { + ClientWhereParam::LastSeenNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::LastSeenNot(value) + } pub fn before(&self, value: chrono::DateTime) -> ClientWhereParam { ClientWhereParam::LastSeenBefore(value) } pub fn after(&self, value: chrono::DateTime) -> ClientWhereParam { ClientWhereParam::LastSeenAfter(value) } - pub fn before_equals(&self, value: chrono::DateTime) -> ClientWhereParam { + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> ClientWhereParam { ClientWhereParam::LastSeenBeforeEquals(value) } pub fn after_equals(&self, value: chrono::DateTime) -> ClientWhereParam { ClientWhereParam::LastSeenAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> ClientWhereParam { - ClientWhereParam::LastSeenEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - ClientSetLastSeen(value).into() +} +pub struct ClientSetLastSeen(chrono::DateTime); +impl From for ClientSetParam { + fn from(value: ClientSetLastSeen) -> Self { + Self::SetLastSeen(value.0) } } pub struct ClientTimezoneField {} -pub struct ClientSetTimezone(String); -impl From for ClientSetParam { - fn from(value: ClientSetTimezone) -> Self { - Self::Timezone(value.0) - } -} impl ClientTimezoneField { + pub fn set>(&self, value: String) -> T { + ClientSetTimezone(value).into() + } + pub fn equals(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneEquals(value).into() + } + pub fn order(&self, direction: Direction) -> ClientOrderByParam { + ClientOrderByParam::Timezone(direction) + } + pub fn cursor(&self, cursor: String) -> ClientCursor { + ClientCursor::Timezone(cursor) + } + pub fn in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::TimezoneInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> ClientWhereParam { + ClientWhereParam::TimezoneNotInVec(value) + } + pub fn lt(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneLt(value) + } + pub fn lte(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneLte(value) + } + pub fn gt(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneGt(value) + } + pub fn gte(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneGte(value) + } pub fn contains(&self, value: String) -> ClientWhereParam { ClientWhereParam::TimezoneContains(value) } + pub fn starts_with(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneStartsWith(value) + } + pub fn ends_with(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneEndsWith(value) + } + pub fn not(&self, value: String) -> ClientWhereParam { + ClientWhereParam::TimezoneNot(value) + } pub fn has_prefix(&self, value: String) -> ClientWhereParam { ClientWhereParam::TimezoneHasPrefix(value) } pub fn has_suffix(&self, value: String) -> ClientWhereParam { ClientWhereParam::TimezoneHasSuffix(value) } - pub fn equals(&self, value: String) -> ClientWhereParam { - ClientWhereParam::TimezoneEquals(value) - } - pub fn set>(&self, value: String) -> T { - ClientSetTimezone(value).into() +} +pub struct ClientSetTimezone(String); +impl From for ClientSetParam { + fn from(value: ClientSetTimezone) -> Self { + Self::SetTimezone(value.0) } } pub struct ClientDateCreatedField {} -pub struct ClientSetDateCreated(chrono::DateTime); -impl From for ClientSetParam { - fn from(value: ClientSetDateCreated) -> Self { - Self::DateCreated(value.0) - } -} impl ClientDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + ClientSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> ClientOrderByParam { + ClientOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> ClientCursor { + ClientCursor::DateCreated(cursor) + } + pub fn in_vec(&self, value: Vec>) -> ClientWhereParam { + ClientWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> ClientWhereParam { + ClientWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> ClientWhereParam { + ClientWhereParam::DateCreatedNot(value) + } pub fn before(&self, value: chrono::DateTime) -> ClientWhereParam { ClientWhereParam::DateCreatedBefore(value) } pub fn after(&self, value: chrono::DateTime) -> ClientWhereParam { ClientWhereParam::DateCreatedAfter(value) } - pub fn before_equals(&self, value: chrono::DateTime) -> ClientWhereParam { + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> ClientWhereParam { ClientWhereParam::DateCreatedBeforeEquals(value) } pub fn after_equals(&self, value: chrono::DateTime) -> ClientWhereParam { ClientWhereParam::DateCreatedAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> ClientWhereParam { - ClientWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - ClientSetDateCreated(value).into() - } } -pub enum ClientWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), - UuidContains(String), - UuidHasPrefix(String), - UuidHasSuffix(String), - UuidEquals(String), - NameContains(String), - NameHasPrefix(String), - NameHasSuffix(String), - NameEquals(String), - PlatformLT(i64), - PlatformGT(i64), - PlatformLTE(i64), - PlatformGTE(i64), - PlatformEquals(i64), - VersionContains(String), - VersionHasPrefix(String), - VersionHasSuffix(String), - VersionEquals(String), - OnlineEquals(bool), - LastSeenBefore(chrono::DateTime), - LastSeenAfter(chrono::DateTime), - LastSeenBeforeEquals(chrono::DateTime), - LastSeenAfterEquals(chrono::DateTime), - LastSeenEquals(chrono::DateTime), - TimezoneContains(String), - TimezoneHasPrefix(String), - TimezoneHasSuffix(String), - TimezoneEquals(String), - DateCreatedBefore(chrono::DateTime), - DateCreatedAfter(chrono::DateTime), - DateCreatedBeforeEquals(chrono::DateTime), - DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), - Not(Vec), - Or(Vec), - And(Vec), -} -impl ClientWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdEquals(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::UuidContains(value) => Field { - name: "uuid".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::UuidHasPrefix(value) => Field { - name: "uuid".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::UuidHasSuffix(value) => Field { - name: "uuid".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::UuidEquals(value) => Field { - name: "uuid".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameContains(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasPrefix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasSuffix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameEquals(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::PlatformLT(value) => Field { - name: "platform".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::PlatformGT(value) => Field { - name: "platform".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::PlatformLTE(value) => Field { - name: "platform".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::PlatformGTE(value) => Field { - name: "platform".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::PlatformEquals(value) => Field { - name: "platform".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::VersionContains(value) => Field { - name: "version".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::VersionHasPrefix(value) => Field { - name: "version".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::VersionHasSuffix(value) => Field { - name: "version".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::VersionEquals(value) => Field { - name: "version".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::OnlineEquals(value) => Field { - name: "online".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LastSeenBefore(value) => Field { - name: "last_seen".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LastSeenAfter(value) => Field { - name: "last_seen".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LastSeenBeforeEquals(value) => Field { - name: "last_seen".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LastSeenAfterEquals(value) => Field { - name: "last_seen".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LastSeenEquals(value) => Field { - name: "last_seen".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TimezoneContains(value) => Field { - name: "timezone".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TimezoneHasPrefix(value) => Field { - name: "timezone".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TimezoneHasSuffix(value) => Field { - name: "timezone".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TimezoneEquals(value) => Field { - name: "timezone".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBefore(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfter(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBeforeEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfterEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - } +pub struct ClientSetDateCreated(chrono::DateTime); +impl From for ClientSetParam { + fn from(value: ClientSetDateCreated) -> Self { + Self::SetDateCreated(value.0) } } -impl From> for ClientWhereParam { - fn from(op: Operator) -> Self { - match op { - Operator::Not(value) => Self::Not(value), - Operator::And(value) => Self::And(value), - Operator::Or(value) => Self::Or(value), - } - } -} -pub struct ClientWith { - pub param: ClientWithParam, -} pub enum ClientWithParam {} -impl From for ClientWith { - fn from(param: ClientWithParam) -> Self { - Self { param } - } -} impl ClientWithParam { - pub fn output(self) -> Output { + pub fn to_output(self) -> Output { match self {} } } pub enum ClientSetParam { - Id(i64), + SetId(i32), + SetUuid(String), + SetName(String), + SetPlatform(i32), + SetVersion(String), + SetOnline(bool), + SetLastSeen(chrono::DateTime), + SetTimezone(String), + SetDateCreated(chrono::DateTime), +} +impl ClientSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetUuid(value) => Field { + name: "uuid".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetName(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetPlatform(value) => Field { + name: "platform".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetVersion(value) => Field { + name: "version".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetOnline(value) => Field { + name: "online".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetLastSeen(value) => Field { + name: "last_seen".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTimezone(value) => Field { + name: "timezone".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum ClientOrderByParam { + Id(Direction), + Uuid(Direction), + Name(Direction), + Platform(Direction), + Version(Direction), + Online(Direction), + LastSeen(Direction), + Timezone(Direction), + DateCreated(Direction), +} +impl ClientOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Uuid(direction) => Field { + name: "uuid".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Name(direction) => Field { + name: "name".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Platform(direction) => Field { + name: "platform".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Version(direction) => Field { + name: "version".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Online(direction) => Field { + name: "online".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::LastSeen(direction) => Field { + name: "last_seen".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Timezone(direction) => Field { + name: "timezone".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum ClientCursor { + Id(i32), Uuid(String), Name(String), - Platform(i64), + Platform(i32), Version(String), Online(bool), LastSeen(chrono::DateTime), Timezone(String), DateCreated(chrono::DateTime), } -impl ClientSetParam { - pub fn field(self) -> Field { +impl ClientCursor { + fn to_field(self) -> Field { match self { Self::Id(value) => Field { name: "id".into(), @@ -3616,12 +7188,1239 @@ impl ClientSetParam { } } } +pub enum ClientWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + UuidEquals(String), + UuidInVec(Vec), + UuidNotInVec(Vec), + UuidLt(String), + UuidLte(String), + UuidGt(String), + UuidGte(String), + UuidContains(String), + UuidStartsWith(String), + UuidEndsWith(String), + UuidNot(String), + UuidHasPrefix(String), + UuidHasSuffix(String), + NameEquals(String), + NameInVec(Vec), + NameNotInVec(Vec), + NameLt(String), + NameLte(String), + NameGt(String), + NameGte(String), + NameContains(String), + NameStartsWith(String), + NameEndsWith(String), + NameNot(String), + NameHasPrefix(String), + NameHasSuffix(String), + PlatformEquals(i32), + PlatformInVec(Vec), + PlatformNotInVec(Vec), + PlatformLt(i32), + PlatformLte(i32), + PlatformGt(i32), + PlatformGte(i32), + PlatformNot(i32), + PlatformLt(i32), + PlatformLte(i32), + PlatformGt(i32), + PlatformGte(i32), + VersionEquals(String), + VersionInVec(Vec), + VersionNotInVec(Vec), + VersionLt(String), + VersionLte(String), + VersionGt(String), + VersionGte(String), + VersionContains(String), + VersionStartsWith(String), + VersionEndsWith(String), + VersionNot(String), + VersionHasPrefix(String), + VersionHasSuffix(String), + OnlineEquals(bool), + LastSeenEquals(chrono::DateTime), + LastSeenInVec(Vec>), + LastSeenNotInVec(Vec>), + LastSeenLt(chrono::DateTime), + LastSeenLte(chrono::DateTime), + LastSeenGt(chrono::DateTime), + LastSeenGte(chrono::DateTime), + LastSeenNot(chrono::DateTime), + LastSeenBefore(chrono::DateTime), + LastSeenAfter(chrono::DateTime), + LastSeenBeforeEquals(chrono::DateTime), + LastSeenAfterEquals(chrono::DateTime), + TimezoneEquals(String), + TimezoneInVec(Vec), + TimezoneNotInVec(Vec), + TimezoneLt(String), + TimezoneLte(String), + TimezoneGt(String), + TimezoneGte(String), + TimezoneContains(String), + TimezoneStartsWith(String), + TimezoneEndsWith(String), + TimezoneNot(String), + TimezoneHasPrefix(String), + TimezoneHasSuffix(String), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), +} +impl ClientWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidEquals(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidInVec(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidNotInVec(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidLt(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidLte(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidGt(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidGte(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidContains(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidStartsWith(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidEndsWith(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidNot(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidHasPrefix(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::UuidHasSuffix(value) => Field { + name: "uuid".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNotInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameStartsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEndsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNot(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformEquals(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformInVec(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformNotInVec(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformLt(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformLte(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformGt(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformGte(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformNot(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformLt(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformLte(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformGt(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PlatformGte(value) => Field { + name: "platform".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionEquals(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionInVec(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionNotInVec(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionLt(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionLte(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionGt(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionGte(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionContains(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionStartsWith(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionEndsWith(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionNot(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionHasPrefix(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::VersionHasSuffix(value) => Field { + name: "version".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::OnlineEquals(value) => Field { + name: "online".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenEquals(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenInVec(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenNotInVec(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenLt(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenLte(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenGt(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenGte(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenNot(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenBefore(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenAfter(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenBeforeEquals(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LastSeenAfterEquals(value) => Field { + name: "last_seen".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneEquals(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneInVec(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneNotInVec(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneLt(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneLte(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneGt(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneGte(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneContains(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneStartsWith(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneEndsWith(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneNot(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneHasPrefix(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TimezoneHasSuffix(value) => Field { + name: "timezone".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum ClientWhereUniqueParam { + IdEquals(i32), + UuidEquals(String), +} +impl From for ClientWhereParam { + fn from(value: ClientWhereUniqueParam) -> Self { + match value { + ClientWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + ClientWhereUniqueParam::UuidEquals(value) => Self::UuidEquals(value), + } + } +} +impl From> for ClientWhereParam { + fn from(op: Operator) -> Self { + match op { + Operator::Not(value) => Self::Not(value), + Operator::And(value) => Self::And(value), + Operator::Or(value) => Self::Or(value), + } + } +} pub struct ClientFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> ClientFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> ClientDelete<'a> { ClientDelete { @@ -3640,7 +8439,7 @@ impl<'a> ClientFindMany<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -3660,33 +8459,119 @@ impl<'a> ClientFindMany<'a> { method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: ClientOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: ClientWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: ClientCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct ClientFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> ClientFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: ClientWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: ClientOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: ClientCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct ClientFindUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> ClientFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> ClientDelete<'a> { ClientDelete { @@ -3704,7 +8589,7 @@ impl<'a> ClientFindUnique<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -3724,45 +8609,107 @@ impl<'a> ClientFindUnique<'a> { method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: ClientWithParam) -> Self { + self.with_params.push(param); self } } pub struct ClientCreateOne<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> ClientCreateOne<'a> { - pub async fn exec(self) -> ClientData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: ClientWithParam) -> Self { + self.with_params.push(param); + self } } pub struct ClientUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> ClientUpdateUnique<'a> { - pub async fn exec(self) -> ClientData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: ClientWithParam) -> Self { + self.with_params.push(param); self } } pub struct ClientUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> ClientUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: ClientWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct ClientUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> ClientUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + uuid: ClientSetUuid, + name: ClientSetName, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(ClientSetParam::from(uuid).to_field()); + input_fields.push(ClientSetParam::from(name).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); self } } @@ -3770,18 +8717,22 @@ pub struct ClientDelete<'a> { query: Query<'a>, } impl<'a> ClientDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) } } pub struct ClientActions<'a> { client: &'a PrismaClient, } impl<'a> ClientActions<'a> { - pub fn find_unique(&self, param: ClientWhereParam) -> ClientFindUnique { - let fields = transform_equals(vec![param.field()]); + pub fn find_unique(&self, param: ClientWhereUniqueParam) -> ClientFindUnique { + let param: ClientWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), @@ -3793,10 +8744,14 @@ impl<'a> ClientActions<'a> { ..Default::default() }], }; - ClientFindUnique { query } + ClientFindUnique { + query, + with_params: vec![], + } } pub fn find_first(&self, params: Vec) -> ClientFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -3813,7 +8768,10 @@ impl<'a> ClientActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), @@ -3821,10 +8779,15 @@ impl<'a> ClientActions<'a> { outputs: client_outputs(), inputs, }; - ClientFindFirst { query } + ClientFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn find_many(&self, params: Vec) -> ClientFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -3835,7 +8798,10 @@ impl<'a> ClientActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), @@ -3843,14 +8809,27 @@ impl<'a> ClientActions<'a> { outputs: client_outputs(), inputs, }; - ClientFindMany { query } + ClientFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } - pub fn create_one(&self, uuid: ClientSetUuid, name: ClientSetName, params: Vec) -> ClientCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(ClientSetParam::from(uuid).field()); - input_fields.push(ClientSetParam::from(name).field()); + pub fn create_one( + &self, + uuid: ClientSetUuid, + name: ClientSetName, + params: Vec, + ) -> ClientCreateOne { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(ClientSetParam::from(uuid).to_field()); + input_fields.push(ClientSetParam::from(name).to_field()); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), @@ -3862,7 +8841,31 @@ impl<'a> ClientActions<'a> { ..Default::default() }], }; - ClientCreateOne { query } + ClientCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: ClientWhereUniqueParam) -> ClientUpsertOne { + let param: ClientWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Client".into(), + outputs: client_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + ClientUpsertOne { query } } } fn location_outputs() -> Vec { @@ -3884,19 +8887,19 @@ fn location_outputs() -> Vec { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct LocationData { #[serde(rename = "id")] - pub id: i64, + pub id: i32, #[serde(rename = "name")] pub name: Option, #[serde(rename = "local_path")] pub local_path: Option, #[serde(rename = "total_capacity")] - pub total_capacity: Option, + pub total_capacity: Option, #[serde(rename = "available_capacity")] - pub available_capacity: Option, + pub available_capacity: Option, #[serde(rename = "filesystem")] pub filesystem: Option, #[serde(rename = "disk_type")] - pub disk_type: Option, + pub disk_type: Option, #[serde(rename = "is_removable")] pub is_removable: bool, #[serde(rename = "is_ejectable")] @@ -3912,10 +8915,7 @@ pub struct LocationData { } impl LocationData { pub fn file_paths(&self) -> Result<&Vec, String> { - match self.file_paths.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access file_paths but did not fetch it using the .with() syntax".to_string()), - } + match self . file_paths . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access file_paths but did not fetch it using the .with() syntax" . to_string ()) , } } } pub struct Location; @@ -3961,279 +8961,594 @@ impl Location { } } pub struct LocationIdField {} -pub struct LocationSetId(i64); -impl From for LocationSetParam { - fn from(value: LocationSetId) -> Self { - Self::Id(value.0) +impl LocationIdField { + pub fn set>(&self, value: i32) -> T { + LocationSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + LocationWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> LocationCursor { + LocationCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> LocationSetParam { + LocationSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> LocationSetParam { + LocationSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> LocationSetParam { + LocationSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> LocationSetParam { + LocationSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::IdGte(value) } } -impl LocationIdField { - pub fn lt(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LocationSetId(value).into() +pub struct LocationSetId(i32); +impl From for LocationSetParam { + fn from(value: LocationSetId) -> Self { + Self::SetId(value.0) } } pub struct LocationNameField {} -pub struct LocationSetName(String); -impl From for LocationSetParam { - fn from(value: LocationSetName) -> Self { - Self::Name(value.0) - } -} impl LocationNameField { + pub fn set>(&self, value: String) -> T { + LocationSetName(value).into() + } + pub fn equals(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::Name(direction) + } + pub fn cursor(&self, cursor: String) -> LocationCursor { + LocationCursor::Name(cursor) + } + pub fn in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::NameInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::NameNotInVec(value) + } + pub fn lt(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameLt(value) + } + pub fn lte(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameLte(value) + } + pub fn gt(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameGt(value) + } + pub fn gte(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameGte(value) + } pub fn contains(&self, value: String) -> LocationWhereParam { LocationWhereParam::NameContains(value) } + pub fn starts_with(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameEndsWith(value) + } + pub fn not(&self, value: String) -> LocationWhereParam { + LocationWhereParam::NameNot(value) + } pub fn has_prefix(&self, value: String) -> LocationWhereParam { LocationWhereParam::NameHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LocationWhereParam { LocationWhereParam::NameHasSuffix(value) } - pub fn equals(&self, value: String) -> LocationWhereParam { - LocationWhereParam::NameEquals(value) - } - pub fn set>(&self, value: String) -> T { - LocationSetName(value).into() +} +pub struct LocationSetName(String); +impl From for LocationSetParam { + fn from(value: LocationSetName) -> Self { + Self::SetName(value.0) } } pub struct LocationLocalPathField {} -pub struct LocationSetLocalPath(String); -impl From for LocationSetParam { - fn from(value: LocationSetLocalPath) -> Self { - Self::LocalPath(value.0) - } -} impl LocationLocalPathField { + pub fn set>(&self, value: String) -> T { + LocationSetLocalPath(value).into() + } + pub fn equals(&self, value: String) -> LocationWhereParam { + LocationWhereParam::LocalPathEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::LocalPath(direction) + } + pub fn cursor(&self, cursor: String) -> LocationCursor { + LocationCursor::LocalPath(cursor) + } + pub fn in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::LocalPathInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::LocalPathNotInVec(value) + } + pub fn lt(&self, value: String) -> LocationWhereParam { + LocationWhereParam::LocalPathLt(value) + } + pub fn lte(&self, value: String) -> LocationWhereParam { + LocationWhereParam::LocalPathLte(value) + } + pub fn gt(&self, value: String) -> LocationWhereParam { + LocationWhereParam::LocalPathGt(value) + } + pub fn gte(&self, value: String) -> LocationWhereParam { + LocationWhereParam::LocalPathGte(value) + } pub fn contains(&self, value: String) -> LocationWhereParam { LocationWhereParam::LocalPathContains(value) } + pub fn starts_with(&self, value: String) -> LocationWhereParam { + LocationWhereParam::LocalPathStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LocationWhereParam { + LocationWhereParam::LocalPathEndsWith(value) + } + pub fn not(&self, value: String) -> LocationWhereParam { + LocationWhereParam::LocalPathNot(value) + } pub fn has_prefix(&self, value: String) -> LocationWhereParam { LocationWhereParam::LocalPathHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LocationWhereParam { LocationWhereParam::LocalPathHasSuffix(value) } - pub fn equals(&self, value: String) -> LocationWhereParam { - LocationWhereParam::LocalPathEquals(value) - } - pub fn set>(&self, value: String) -> T { - LocationSetLocalPath(value).into() +} +pub struct LocationSetLocalPath(String); +impl From for LocationSetParam { + fn from(value: LocationSetLocalPath) -> Self { + Self::SetLocalPath(value.0) } } pub struct LocationTotalCapacityField {} -pub struct LocationSetTotalCapacity(i64); -impl From for LocationSetParam { - fn from(value: LocationSetTotalCapacity) -> Self { - Self::TotalCapacity(value.0) +impl LocationTotalCapacityField { + pub fn set>(&self, value: i32) -> T { + LocationSetTotalCapacity(value).into() + } + pub fn equals(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::TotalCapacity(direction) + } + pub fn cursor(&self, cursor: i32) -> LocationCursor { + LocationCursor::TotalCapacity(cursor) + } + pub fn increment(&self, value: i32) -> LocationSetParam { + LocationSetParam::TotalCapacity(value) + } + pub fn decrement(&self, value: i32) -> LocationSetParam { + LocationSetParam::TotalCapacity(value) + } + pub fn multiply(&self, value: i32) -> LocationSetParam { + LocationSetParam::TotalCapacity(value) + } + pub fn divide(&self, value: i32) -> LocationSetParam { + LocationSetParam::TotalCapacity(value) + } + pub fn in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::TotalCapacityInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::TotalCapacityNotInVec(value) + } + pub fn lt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityLt(value) + } + pub fn lte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityLte(value) + } + pub fn gt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityGt(value) + } + pub fn gte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityGte(value) + } + pub fn not(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityNot(value) + } + pub fn lt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityLt(value) + } + pub fn lte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityLte(value) + } + pub fn gt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityGt(value) + } + pub fn gte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::TotalCapacityGte(value) } } -impl LocationTotalCapacityField { - pub fn lt(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::TotalCapacityLT(value) - } - pub fn gt(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::TotalCapacityGT(value) - } - pub fn lte(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::TotalCapacityLTE(value) - } - pub fn gte(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::TotalCapacityGTE(value) - } - pub fn equals(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::TotalCapacityEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LocationSetTotalCapacity(value).into() +pub struct LocationSetTotalCapacity(i32); +impl From for LocationSetParam { + fn from(value: LocationSetTotalCapacity) -> Self { + Self::SetTotalCapacity(value.0) } } pub struct LocationAvailableCapacityField {} -pub struct LocationSetAvailableCapacity(i64); -impl From for LocationSetParam { - fn from(value: LocationSetAvailableCapacity) -> Self { - Self::AvailableCapacity(value.0) +impl LocationAvailableCapacityField { + pub fn set>(&self, value: i32) -> T { + LocationSetAvailableCapacity(value).into() + } + pub fn equals(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::AvailableCapacity(direction) + } + pub fn cursor(&self, cursor: i32) -> LocationCursor { + LocationCursor::AvailableCapacity(cursor) + } + pub fn increment(&self, value: i32) -> LocationSetParam { + LocationSetParam::AvailableCapacity(value) + } + pub fn decrement(&self, value: i32) -> LocationSetParam { + LocationSetParam::AvailableCapacity(value) + } + pub fn multiply(&self, value: i32) -> LocationSetParam { + LocationSetParam::AvailableCapacity(value) + } + pub fn divide(&self, value: i32) -> LocationSetParam { + LocationSetParam::AvailableCapacity(value) + } + pub fn in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityNotInVec(value) + } + pub fn lt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityLt(value) + } + pub fn lte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityLte(value) + } + pub fn gt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityGt(value) + } + pub fn gte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityGte(value) + } + pub fn not(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityNot(value) + } + pub fn lt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityLt(value) + } + pub fn lte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityLte(value) + } + pub fn gt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityGt(value) + } + pub fn gte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::AvailableCapacityGte(value) } } -impl LocationAvailableCapacityField { - pub fn lt(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::AvailableCapacityLT(value) - } - pub fn gt(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::AvailableCapacityGT(value) - } - pub fn lte(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::AvailableCapacityLTE(value) - } - pub fn gte(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::AvailableCapacityGTE(value) - } - pub fn equals(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::AvailableCapacityEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LocationSetAvailableCapacity(value).into() +pub struct LocationSetAvailableCapacity(i32); +impl From for LocationSetParam { + fn from(value: LocationSetAvailableCapacity) -> Self { + Self::SetAvailableCapacity(value.0) } } pub struct LocationFilesystemField {} -pub struct LocationSetFilesystem(String); -impl From for LocationSetParam { - fn from(value: LocationSetFilesystem) -> Self { - Self::Filesystem(value.0) - } -} impl LocationFilesystemField { + pub fn set>(&self, value: String) -> T { + LocationSetFilesystem(value).into() + } + pub fn equals(&self, value: String) -> LocationWhereParam { + LocationWhereParam::FilesystemEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::Filesystem(direction) + } + pub fn cursor(&self, cursor: String) -> LocationCursor { + LocationCursor::Filesystem(cursor) + } + pub fn in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::FilesystemInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::FilesystemNotInVec(value) + } + pub fn lt(&self, value: String) -> LocationWhereParam { + LocationWhereParam::FilesystemLt(value) + } + pub fn lte(&self, value: String) -> LocationWhereParam { + LocationWhereParam::FilesystemLte(value) + } + pub fn gt(&self, value: String) -> LocationWhereParam { + LocationWhereParam::FilesystemGt(value) + } + pub fn gte(&self, value: String) -> LocationWhereParam { + LocationWhereParam::FilesystemGte(value) + } pub fn contains(&self, value: String) -> LocationWhereParam { LocationWhereParam::FilesystemContains(value) } + pub fn starts_with(&self, value: String) -> LocationWhereParam { + LocationWhereParam::FilesystemStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LocationWhereParam { + LocationWhereParam::FilesystemEndsWith(value) + } + pub fn not(&self, value: String) -> LocationWhereParam { + LocationWhereParam::FilesystemNot(value) + } pub fn has_prefix(&self, value: String) -> LocationWhereParam { LocationWhereParam::FilesystemHasPrefix(value) } pub fn has_suffix(&self, value: String) -> LocationWhereParam { LocationWhereParam::FilesystemHasSuffix(value) } - pub fn equals(&self, value: String) -> LocationWhereParam { - LocationWhereParam::FilesystemEquals(value) - } - pub fn set>(&self, value: String) -> T { - LocationSetFilesystem(value).into() +} +pub struct LocationSetFilesystem(String); +impl From for LocationSetParam { + fn from(value: LocationSetFilesystem) -> Self { + Self::SetFilesystem(value.0) } } pub struct LocationDiskTypeField {} -pub struct LocationSetDiskType(i64); -impl From for LocationSetParam { - fn from(value: LocationSetDiskType) -> Self { - Self::DiskType(value.0) +impl LocationDiskTypeField { + pub fn set>(&self, value: i32) -> T { + LocationSetDiskType(value).into() + } + pub fn equals(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::DiskType(direction) + } + pub fn cursor(&self, cursor: i32) -> LocationCursor { + LocationCursor::DiskType(cursor) + } + pub fn increment(&self, value: i32) -> LocationSetParam { + LocationSetParam::DiskType(value) + } + pub fn decrement(&self, value: i32) -> LocationSetParam { + LocationSetParam::DiskType(value) + } + pub fn multiply(&self, value: i32) -> LocationSetParam { + LocationSetParam::DiskType(value) + } + pub fn divide(&self, value: i32) -> LocationSetParam { + LocationSetParam::DiskType(value) + } + pub fn in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::DiskTypeInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LocationWhereParam { + LocationWhereParam::DiskTypeNotInVec(value) + } + pub fn lt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeLt(value) + } + pub fn lte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeLte(value) + } + pub fn gt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeGt(value) + } + pub fn gte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeGte(value) + } + pub fn not(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeNot(value) + } + pub fn lt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeLt(value) + } + pub fn lte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeLte(value) + } + pub fn gt(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeGt(value) + } + pub fn gte(&self, value: i32) -> LocationWhereParam { + LocationWhereParam::DiskTypeGte(value) } } -impl LocationDiskTypeField { - pub fn lt(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::DiskTypeLT(value) - } - pub fn gt(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::DiskTypeGT(value) - } - pub fn lte(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::DiskTypeLTE(value) - } - pub fn gte(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::DiskTypeGTE(value) - } - pub fn equals(&self, value: i64) -> LocationWhereParam { - LocationWhereParam::DiskTypeEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LocationSetDiskType(value).into() +pub struct LocationSetDiskType(i32); +impl From for LocationSetParam { + fn from(value: LocationSetDiskType) -> Self { + Self::SetDiskType(value.0) } } pub struct LocationIsRemovableField {} -pub struct LocationSetIsRemovable(bool); -impl From for LocationSetParam { - fn from(value: LocationSetIsRemovable) -> Self { - Self::IsRemovable(value.0) - } -} impl LocationIsRemovableField { - pub fn equals(&self, value: bool) -> LocationWhereParam { - LocationWhereParam::IsRemovableEquals(value) - } pub fn set>(&self, value: bool) -> T { LocationSetIsRemovable(value).into() } + pub fn equals(&self, value: bool) -> LocationWhereParam { + LocationWhereParam::IsRemovableEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::IsRemovable(direction) + } + pub fn cursor(&self, cursor: bool) -> LocationCursor { + LocationCursor::IsRemovable(cursor) + } +} +pub struct LocationSetIsRemovable(bool); +impl From for LocationSetParam { + fn from(value: LocationSetIsRemovable) -> Self { + Self::SetIsRemovable(value.0) + } } pub struct LocationIsEjectableField {} -pub struct LocationSetIsEjectable(bool); -impl From for LocationSetParam { - fn from(value: LocationSetIsEjectable) -> Self { - Self::IsEjectable(value.0) - } -} impl LocationIsEjectableField { - pub fn equals(&self, value: bool) -> LocationWhereParam { - LocationWhereParam::IsEjectableEquals(value) - } pub fn set>(&self, value: bool) -> T { LocationSetIsEjectable(value).into() } + pub fn equals(&self, value: bool) -> LocationWhereParam { + LocationWhereParam::IsEjectableEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::IsEjectable(direction) + } + pub fn cursor(&self, cursor: bool) -> LocationCursor { + LocationCursor::IsEjectable(cursor) + } +} +pub struct LocationSetIsEjectable(bool); +impl From for LocationSetParam { + fn from(value: LocationSetIsEjectable) -> Self { + Self::SetIsEjectable(value.0) + } } pub struct LocationIsRootFilesystemField {} -pub struct LocationSetIsRootFilesystem(bool); -impl From for LocationSetParam { - fn from(value: LocationSetIsRootFilesystem) -> Self { - Self::IsRootFilesystem(value.0) - } -} impl LocationIsRootFilesystemField { - pub fn equals(&self, value: bool) -> LocationWhereParam { - LocationWhereParam::IsRootFilesystemEquals(value) - } pub fn set>(&self, value: bool) -> T { LocationSetIsRootFilesystem(value).into() } + pub fn equals(&self, value: bool) -> LocationWhereParam { + LocationWhereParam::IsRootFilesystemEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::IsRootFilesystem(direction) + } + pub fn cursor(&self, cursor: bool) -> LocationCursor { + LocationCursor::IsRootFilesystem(cursor) + } +} +pub struct LocationSetIsRootFilesystem(bool); +impl From for LocationSetParam { + fn from(value: LocationSetIsRootFilesystem) -> Self { + Self::SetIsRootFilesystem(value.0) + } } pub struct LocationIsOnlineField {} -pub struct LocationSetIsOnline(bool); -impl From for LocationSetParam { - fn from(value: LocationSetIsOnline) -> Self { - Self::IsOnline(value.0) - } -} impl LocationIsOnlineField { - pub fn equals(&self, value: bool) -> LocationWhereParam { - LocationWhereParam::IsOnlineEquals(value) - } pub fn set>(&self, value: bool) -> T { LocationSetIsOnline(value).into() } -} -pub struct LocationDateCreatedField {} -pub struct LocationSetDateCreated(chrono::DateTime); -impl From for LocationSetParam { - fn from(value: LocationSetDateCreated) -> Self { - Self::DateCreated(value.0) + pub fn equals(&self, value: bool) -> LocationWhereParam { + LocationWhereParam::IsOnlineEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::IsOnline(direction) + } + pub fn cursor(&self, cursor: bool) -> LocationCursor { + LocationCursor::IsOnline(cursor) } } +pub struct LocationSetIsOnline(bool); +impl From for LocationSetParam { + fn from(value: LocationSetIsOnline) -> Self { + Self::SetIsOnline(value.0) + } +} +pub struct LocationDateCreatedField {} impl LocationDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + LocationSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LocationOrderByParam { + LocationOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> LocationCursor { + LocationCursor::DateCreated(cursor) + } + pub fn in_vec( + &self, + value: Vec>, + ) -> LocationWhereParam { + LocationWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> LocationWhereParam { + LocationWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> LocationWhereParam { + LocationWhereParam::DateCreatedNot(value) + } pub fn before(&self, value: chrono::DateTime) -> LocationWhereParam { LocationWhereParam::DateCreatedBefore(value) } pub fn after(&self, value: chrono::DateTime) -> LocationWhereParam { LocationWhereParam::DateCreatedAfter(value) } - pub fn before_equals(&self, value: chrono::DateTime) -> LocationWhereParam { + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> LocationWhereParam { LocationWhereParam::DateCreatedBeforeEquals(value) } - pub fn after_equals(&self, value: chrono::DateTime) -> LocationWhereParam { + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> LocationWhereParam { LocationWhereParam::DateCreatedAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> LocationWhereParam { - LocationWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - LocationSetDateCreated(value).into() +} +pub struct LocationSetDateCreated(chrono::DateTime); +impl From for LocationSetParam { + fn from(value: LocationSetDateCreated) -> Self { + Self::SetDateCreated(value.0) } } pub struct LocationFilePathsField {} -pub struct LocationLinkFilePaths(Vec); -impl From for LocationSetParam { - fn from(value: LocationLinkFilePaths) -> Self { - Self::LinkFilePaths(value.0.into_iter().map(|v| v.into()).collect()) - } -} impl LocationFilePathsField { pub fn some(&self, value: Vec) -> LocationWhereParam { LocationWhereParam::FilePathsSome(value) @@ -4241,500 +9556,30 @@ impl LocationFilePathsField { pub fn every(&self, value: Vec) -> LocationWhereParam { LocationWhereParam::FilePathsEvery(value) } - pub fn link>(&self, value: Vec) -> T { - LocationLinkFilePaths(value).into() + pub fn fetch(&self, params: Vec) -> LocationWithParam { + LocationWithParam::FilePaths(params) } - pub fn unlink(&self, params: Vec) -> LocationSetParam { - LocationSetParam::UnlinkFilePaths(params) + pub fn link>( + &self, + params: Vec, + ) -> T { + LocationLinkFilePaths(params).into() } - pub fn fetch(&self, params: Vec) -> LocationWith { - LocationWithParam::FilePaths(params).into() + pub fn unlink(&self, params: Vec) -> LocationSetParam { + LocationSetParam::UnLinkFilePaths(params) } } -pub enum LocationWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), - NameContains(String), - NameHasPrefix(String), - NameHasSuffix(String), - NameEquals(String), - LocalPathContains(String), - LocalPathHasPrefix(String), - LocalPathHasSuffix(String), - LocalPathEquals(String), - TotalCapacityLT(i64), - TotalCapacityGT(i64), - TotalCapacityLTE(i64), - TotalCapacityGTE(i64), - TotalCapacityEquals(i64), - AvailableCapacityLT(i64), - AvailableCapacityGT(i64), - AvailableCapacityLTE(i64), - AvailableCapacityGTE(i64), - AvailableCapacityEquals(i64), - FilesystemContains(String), - FilesystemHasPrefix(String), - FilesystemHasSuffix(String), - FilesystemEquals(String), - DiskTypeLT(i64), - DiskTypeGT(i64), - DiskTypeLTE(i64), - DiskTypeGTE(i64), - DiskTypeEquals(i64), - IsRemovableEquals(bool), - IsEjectableEquals(bool), - IsRootFilesystemEquals(bool), - IsOnlineEquals(bool), - DateCreatedBefore(chrono::DateTime), - DateCreatedAfter(chrono::DateTime), - DateCreatedBeforeEquals(chrono::DateTime), - DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), - FilePathsSome(Vec), - FilePathsEvery(Vec), - Not(Vec), - Or(Vec), - And(Vec), -} -impl LocationWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdEquals(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameContains(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasPrefix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasSuffix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameEquals(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LocalPathContains(value) => Field { - name: "local_path".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LocalPathHasPrefix(value) => Field { - name: "local_path".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LocalPathHasSuffix(value) => Field { - name: "local_path".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LocalPathEquals(value) => Field { - name: "local_path".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalCapacityLT(value) => Field { - name: "total_capacity".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalCapacityGT(value) => Field { - name: "total_capacity".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalCapacityLTE(value) => Field { - name: "total_capacity".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalCapacityGTE(value) => Field { - name: "total_capacity".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalCapacityEquals(value) => Field { - name: "total_capacity".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::AvailableCapacityLT(value) => Field { - name: "available_capacity".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::AvailableCapacityGT(value) => Field { - name: "available_capacity".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::AvailableCapacityLTE(value) => Field { - name: "available_capacity".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::AvailableCapacityGTE(value) => Field { - name: "available_capacity".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::AvailableCapacityEquals(value) => Field { - name: "available_capacity".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FilesystemContains(value) => Field { - name: "filesystem".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FilesystemHasPrefix(value) => Field { - name: "filesystem".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FilesystemHasSuffix(value) => Field { - name: "filesystem".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FilesystemEquals(value) => Field { - name: "filesystem".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DiskTypeLT(value) => Field { - name: "disk_type".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DiskTypeGT(value) => Field { - name: "disk_type".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DiskTypeLTE(value) => Field { - name: "disk_type".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DiskTypeGTE(value) => Field { - name: "disk_type".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DiskTypeEquals(value) => Field { - name: "disk_type".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IsRemovableEquals(value) => Field { - name: "is_removable".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IsEjectableEquals(value) => Field { - name: "is_ejectable".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IsRootFilesystemEquals(value) => Field { - name: "is_root_filesystem".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IsOnlineEquals(value) => Field { - name: "is_online".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBefore(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfter(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBeforeEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfterEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FilePathsSome(value) => Field { - name: "file_paths".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FilePathsEvery(value) => Field { - name: "file_paths".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - } +pub struct LocationLinkFilePaths(Vec); +impl From for LocationSetParam { + fn from(value: LocationLinkFilePaths) -> Self { + Self::LinkFilePaths(value.0) } } -impl From> for LocationWhereParam { - fn from(op: Operator) -> Self { - match op { - Operator::Not(value) => Self::Not(value), - Operator::And(value) => Self::And(value), - Operator::Or(value) => Self::Or(value), - } - } -} -pub struct LocationWith { - pub param: LocationWithParam, -} pub enum LocationWithParam { FilePaths(Vec), } -impl From for LocationWith { - fn from(param: LocationWithParam) -> Self { - Self { param } - } -} impl LocationWithParam { - pub fn output(self) -> Output { + pub fn to_output(self) -> Output { match self { Self::FilePaths(where_params) => Output { name: "file_paths".into(), @@ -4742,7 +9587,12 @@ impl LocationWithParam { inputs: if where_params.len() > 0 { vec![Input { name: "where".into(), - fields: where_params.into_iter().map(|f| f.field()).collect(), + fields: where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), ..Default::default() }] } else { @@ -4754,23 +9604,219 @@ impl LocationWithParam { } } pub enum LocationSetParam { - Id(i64), + SetId(i32), + SetName(String), + SetLocalPath(String), + SetTotalCapacity(i32), + SetAvailableCapacity(i32), + SetFilesystem(String), + SetDiskType(i32), + SetIsRemovable(bool), + SetIsEjectable(bool), + SetIsRootFilesystem(bool), + SetIsOnline(bool), + SetDateCreated(chrono::DateTime), + LinkFilePaths(Vec), + UnLinkFilePaths(Vec), +} +impl LocationSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetName(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetLocalPath(value) => Field { + name: "local_path".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTotalCapacity(value) => Field { + name: "total_capacity".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetAvailableCapacity(value) => Field { + name: "available_capacity".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetFilesystem(value) => Field { + name: "filesystem".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDiskType(value) => Field { + name: "disk_type".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetIsRemovable(value) => Field { + name: "is_removable".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetIsEjectable(value) => Field { + name: "is_ejectable".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetIsRootFilesystem(value) => Field { + name: "is_root_filesystem".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetIsOnline(value) => Field { + name: "is_online".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkFilePaths(where_params) => Field { + name: "file_paths".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkFilePaths(where_params) => Field { + name: "file_paths".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum LocationOrderByParam { + Id(Direction), + Name(Direction), + LocalPath(Direction), + TotalCapacity(Direction), + AvailableCapacity(Direction), + Filesystem(Direction), + DiskType(Direction), + IsRemovable(Direction), + IsEjectable(Direction), + IsRootFilesystem(Direction), + IsOnline(Direction), + DateCreated(Direction), +} +impl LocationOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Name(direction) => Field { + name: "name".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::LocalPath(direction) => Field { + name: "local_path".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::TotalCapacity(direction) => Field { + name: "total_capacity".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::AvailableCapacity(direction) => Field { + name: "available_capacity".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Filesystem(direction) => Field { + name: "filesystem".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DiskType(direction) => Field { + name: "disk_type".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::IsRemovable(direction) => Field { + name: "is_removable".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::IsEjectable(direction) => Field { + name: "is_ejectable".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::IsRootFilesystem(direction) => Field { + name: "is_root_filesystem".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::IsOnline(direction) => Field { + name: "is_online".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum LocationCursor { + Id(i32), Name(String), LocalPath(String), - TotalCapacity(i64), - AvailableCapacity(i64), + TotalCapacity(i32), + AvailableCapacity(i32), Filesystem(String), - DiskType(i64), + DiskType(i32), IsRemovable(bool), IsEjectable(bool), IsRootFilesystem(bool), IsOnline(bool), DateCreated(chrono::DateTime), - LinkFilePaths(Vec), - UnlinkFilePaths(Vec), } -impl LocationSetParam { - pub fn field(self) -> Field { +impl LocationCursor { + fn to_field(self) -> Field { match self { Self::Id(value) => Field { name: "id".into(), @@ -4832,878 +9878,141 @@ impl LocationSetParam { value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }, - Self::LinkFilePaths(where_params) => Field { - name: "file_paths".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - list: true, - wrap_list: true, - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkFilePaths(where_params) => Field { - name: "file_paths".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - list: true, - wrap_list: true, - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - ..Default::default() - }]), - ..Default::default() - }, } } } -pub struct LocationFindMany<'a> { - query: Query<'a>, -} -impl<'a> LocationFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> LocationDelete<'a> { - LocationDelete { - query: Query { - operation: "mutation".into(), - method: "deleteMany".into(), - model: "Location".into(), - outputs: vec![Output::new("count")], - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> LocationUpdateMany<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - LocationUpdateMany { - query: Query { - operation: "mutation".into(), - method: "updateMany".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct LocationFindFirst<'a> { - query: Query<'a>, -} -impl<'a> LocationFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct LocationFindUnique<'a> { - query: Query<'a>, -} -impl<'a> LocationFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> LocationDelete<'a> { - LocationDelete { - query: Query { - operation: "mutation".into(), - method: "deleteOne".into(), - model: "Location".into(), - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> LocationUpdateUnique<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - LocationUpdateUnique { - query: Query { - operation: "mutation".into(), - method: "updateOne".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct LocationCreateOne<'a> { - query: Query<'a>, -} -impl<'a> LocationCreateOne<'a> { - pub async fn exec(self) -> LocationData { - self.query.perform::().await.unwrap() - } -} -pub struct LocationUpdateUnique<'a> { - query: Query<'a>, -} -impl<'a> LocationUpdateUnique<'a> { - pub async fn exec(self) -> LocationData { - self.query.perform::().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct LocationUpdateMany<'a> { - query: Query<'a>, -} -impl<'a> LocationUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct LocationDelete<'a> { - query: Query<'a>, -} -impl<'a> LocationDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count - } -} -pub struct LocationActions<'a> { - client: &'a PrismaClient, -} -impl<'a> LocationActions<'a> { - pub fn find_unique(&self, param: LocationWhereParam) -> LocationFindUnique { - let fields = transform_equals(vec![param.field()]); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findUnique".into(), - model: "Location".into(), - outputs: location_outputs(), - inputs: vec![Input { - name: "where".into(), - fields, - ..Default::default() - }], - }; - LocationFindUnique { query } - } - pub fn find_first(&self, params: Vec) -> LocationFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: vec![Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(where_fields), - ..Default::default() - }], - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findFirst".into(), - model: "Location".into(), - outputs: location_outputs(), - inputs, - }; - LocationFindFirst { query } - } - pub fn find_many(&self, params: Vec) -> LocationFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_fields, - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findMany".into(), - model: "Location".into(), - outputs: location_outputs(), - inputs, - }; - LocationFindMany { query } - } - pub fn create_one(&self, params: Vec) -> LocationCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "mutation".into(), - method: "createOne".into(), - model: "Location".into(), - outputs: location_outputs(), - inputs: vec![Input { - name: "data".into(), - fields: input_fields, - ..Default::default() - }], - }; - LocationCreateOne { query } - } -} -fn file_outputs() -> Vec { - vec![ - Output::new("id"), - Output::new("id_hash"), - Output::new("name"), - Output::new("extension"), - Output::new("checksum"), - Output::new("size_in_bytes"), - Output::new("encryption"), - Output::new("date_created"), - Output::new("date_modified"), - Output::new("date_indexed"), - Output::new("ipfs_id"), - ] -} -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct FileData { - #[serde(rename = "id")] - pub id: i64, - #[serde(rename = "id_hash")] - pub id_hash: String, - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "extension")] - pub extension: Option, - #[serde(rename = "checksum")] - pub checksum: Option, - #[serde(rename = "size_in_bytes")] - pub size_in_bytes: String, - #[serde(rename = "encryption")] - pub encryption: i64, - #[serde(rename = "date_created")] - pub date_created: chrono::DateTime, - #[serde(rename = "date_modified")] - pub date_modified: chrono::DateTime, - #[serde(rename = "date_indexed")] - pub date_indexed: chrono::DateTime, - #[serde(rename = "ipfs_id")] - pub ipfs_id: Option, - #[serde(rename = "file_tags")] - file_tags: Option>, - #[serde(rename = "file_labels")] - file_labels: Option>, - #[serde(rename = "file_paths")] - file_paths: Option>, - #[serde(rename = "comments")] - comments: Option>, -} -impl FileData { - pub fn file_tags(&self) -> Result<&Vec, String> { - match self.file_tags.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access file_tags but did not fetch it using the .with() syntax".to_string()), - } - } - pub fn file_labels(&self) -> Result<&Vec, String> { - match self.file_labels.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access file_labels but did not fetch it using the .with() syntax".to_string()), - } - } - pub fn file_paths(&self) -> Result<&Vec, String> { - match self.file_paths.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access file_paths but did not fetch it using the .with() syntax".to_string()), - } - } - pub fn comments(&self) -> Result<&Vec, String> { - match self.comments.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access comments but did not fetch it using the .with() syntax".to_string()), - } - } -} -pub struct File; -impl File { - pub fn id() -> FileIdField { - FileIdField {} - } - pub fn id_hash() -> FileIdHashField { - FileIdHashField {} - } - pub fn name() -> FileNameField { - FileNameField {} - } - pub fn extension() -> FileExtensionField { - FileExtensionField {} - } - pub fn checksum() -> FileChecksumField { - FileChecksumField {} - } - pub fn size_in_bytes() -> FileSizeInBytesField { - FileSizeInBytesField {} - } - pub fn encryption() -> FileEncryptionField { - FileEncryptionField {} - } - pub fn date_created() -> FileDateCreatedField { - FileDateCreatedField {} - } - pub fn date_modified() -> FileDateModifiedField { - FileDateModifiedField {} - } - pub fn date_indexed() -> FileDateIndexedField { - FileDateIndexedField {} - } - pub fn ipfs_id() -> FileIpfsIdField { - FileIpfsIdField {} - } - pub fn file_tags() -> FileFileTagsField { - FileFileTagsField {} - } - pub fn file_labels() -> FileFileLabelsField { - FileFileLabelsField {} - } - pub fn file_paths() -> FileFilePathsField { - FileFilePathsField {} - } - pub fn comments() -> FileCommentsField { - FileCommentsField {} - } -} -pub struct FileIdField {} -pub struct FileSetId(i64); -impl From for FileSetParam { - fn from(value: FileSetId) -> Self { - Self::Id(value.0) - } -} -impl FileIdField { - pub fn lt(&self, value: i64) -> FileWhereParam { - FileWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> FileWhereParam { - FileWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> FileWhereParam { - FileWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> FileWhereParam { - FileWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> FileWhereParam { - FileWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - FileSetId(value).into() - } -} -pub struct FileIdHashField {} -pub struct FileSetIdHash(String); -impl From for FileSetParam { - fn from(value: FileSetIdHash) -> Self { - Self::IdHash(value.0) - } -} -impl FileIdHashField { - pub fn contains(&self, value: String) -> FileWhereParam { - FileWhereParam::IdHashContains(value) - } - pub fn has_prefix(&self, value: String) -> FileWhereParam { - FileWhereParam::IdHashHasPrefix(value) - } - pub fn has_suffix(&self, value: String) -> FileWhereParam { - FileWhereParam::IdHashHasSuffix(value) - } - pub fn equals(&self, value: String) -> FileWhereParam { - FileWhereParam::IdHashEquals(value) - } - pub fn set>(&self, value: String) -> T { - FileSetIdHash(value).into() - } -} -pub struct FileNameField {} -pub struct FileSetName(String); -impl From for FileSetParam { - fn from(value: FileSetName) -> Self { - Self::Name(value.0) - } -} -impl FileNameField { - pub fn contains(&self, value: String) -> FileWhereParam { - FileWhereParam::NameContains(value) - } - pub fn has_prefix(&self, value: String) -> FileWhereParam { - FileWhereParam::NameHasPrefix(value) - } - pub fn has_suffix(&self, value: String) -> FileWhereParam { - FileWhereParam::NameHasSuffix(value) - } - pub fn equals(&self, value: String) -> FileWhereParam { - FileWhereParam::NameEquals(value) - } - pub fn set>(&self, value: String) -> T { - FileSetName(value).into() - } -} -pub struct FileExtensionField {} -pub struct FileSetExtension(String); -impl From for FileSetParam { - fn from(value: FileSetExtension) -> Self { - Self::Extension(value.0) - } -} -impl FileExtensionField { - pub fn contains(&self, value: String) -> FileWhereParam { - FileWhereParam::ExtensionContains(value) - } - pub fn has_prefix(&self, value: String) -> FileWhereParam { - FileWhereParam::ExtensionHasPrefix(value) - } - pub fn has_suffix(&self, value: String) -> FileWhereParam { - FileWhereParam::ExtensionHasSuffix(value) - } - pub fn equals(&self, value: String) -> FileWhereParam { - FileWhereParam::ExtensionEquals(value) - } - pub fn set>(&self, value: String) -> T { - FileSetExtension(value).into() - } -} -pub struct FileChecksumField {} -pub struct FileSetChecksum(String); -impl From for FileSetParam { - fn from(value: FileSetChecksum) -> Self { - Self::Checksum(value.0) - } -} -impl FileChecksumField { - pub fn contains(&self, value: String) -> FileWhereParam { - FileWhereParam::ChecksumContains(value) - } - pub fn has_prefix(&self, value: String) -> FileWhereParam { - FileWhereParam::ChecksumHasPrefix(value) - } - pub fn has_suffix(&self, value: String) -> FileWhereParam { - FileWhereParam::ChecksumHasSuffix(value) - } - pub fn equals(&self, value: String) -> FileWhereParam { - FileWhereParam::ChecksumEquals(value) - } - pub fn set>(&self, value: String) -> T { - FileSetChecksum(value).into() - } -} -pub struct FileSizeInBytesField {} -pub struct FileSetSizeInBytes(String); -impl From for FileSetParam { - fn from(value: FileSetSizeInBytes) -> Self { - Self::SizeInBytes(value.0) - } -} -impl FileSizeInBytesField { - pub fn contains(&self, value: String) -> FileWhereParam { - FileWhereParam::SizeInBytesContains(value) - } - pub fn has_prefix(&self, value: String) -> FileWhereParam { - FileWhereParam::SizeInBytesHasPrefix(value) - } - pub fn has_suffix(&self, value: String) -> FileWhereParam { - FileWhereParam::SizeInBytesHasSuffix(value) - } - pub fn equals(&self, value: String) -> FileWhereParam { - FileWhereParam::SizeInBytesEquals(value) - } - pub fn set>(&self, value: String) -> T { - FileSetSizeInBytes(value).into() - } -} -pub struct FileEncryptionField {} -pub struct FileSetEncryption(i64); -impl From for FileSetParam { - fn from(value: FileSetEncryption) -> Self { - Self::Encryption(value.0) - } -} -impl FileEncryptionField { - pub fn lt(&self, value: i64) -> FileWhereParam { - FileWhereParam::EncryptionLT(value) - } - pub fn gt(&self, value: i64) -> FileWhereParam { - FileWhereParam::EncryptionGT(value) - } - pub fn lte(&self, value: i64) -> FileWhereParam { - FileWhereParam::EncryptionLTE(value) - } - pub fn gte(&self, value: i64) -> FileWhereParam { - FileWhereParam::EncryptionGTE(value) - } - pub fn equals(&self, value: i64) -> FileWhereParam { - FileWhereParam::EncryptionEquals(value) - } - pub fn set>(&self, value: i64) -> T { - FileSetEncryption(value).into() - } -} -pub struct FileDateCreatedField {} -pub struct FileSetDateCreated(chrono::DateTime); -impl From for FileSetParam { - fn from(value: FileSetDateCreated) -> Self { - Self::DateCreated(value.0) - } -} -impl FileDateCreatedField { - pub fn before(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateCreatedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateCreatedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateCreatedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateCreatedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - FileSetDateCreated(value).into() - } -} -pub struct FileDateModifiedField {} -pub struct FileSetDateModified(chrono::DateTime); -impl From for FileSetParam { - fn from(value: FileSetDateModified) -> Self { - Self::DateModified(value.0) - } -} -impl FileDateModifiedField { - pub fn before(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateModifiedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateModifiedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateModifiedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateModifiedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateModifiedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - FileSetDateModified(value).into() - } -} -pub struct FileDateIndexedField {} -pub struct FileSetDateIndexed(chrono::DateTime); -impl From for FileSetParam { - fn from(value: FileSetDateIndexed) -> Self { - Self::DateIndexed(value.0) - } -} -impl FileDateIndexedField { - pub fn before(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateIndexedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateIndexedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateIndexedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateIndexedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> FileWhereParam { - FileWhereParam::DateIndexedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - FileSetDateIndexed(value).into() - } -} -pub struct FileIpfsIdField {} -pub struct FileSetIpfsId(String); -impl From for FileSetParam { - fn from(value: FileSetIpfsId) -> Self { - Self::IpfsId(value.0) - } -} -impl FileIpfsIdField { - pub fn contains(&self, value: String) -> FileWhereParam { - FileWhereParam::IpfsIdContains(value) - } - pub fn has_prefix(&self, value: String) -> FileWhereParam { - FileWhereParam::IpfsIdHasPrefix(value) - } - pub fn has_suffix(&self, value: String) -> FileWhereParam { - FileWhereParam::IpfsIdHasSuffix(value) - } - pub fn equals(&self, value: String) -> FileWhereParam { - FileWhereParam::IpfsIdEquals(value) - } - pub fn set>(&self, value: String) -> T { - FileSetIpfsId(value).into() - } -} -pub struct FileFileTagsField {} -pub struct FileLinkFileTags(Vec); -impl From for FileSetParam { - fn from(value: FileLinkFileTags) -> Self { - Self::LinkFileTags(value.0.into_iter().map(|v| v.into()).collect()) - } -} -impl FileFileTagsField { - pub fn some(&self, value: Vec) -> FileWhereParam { - FileWhereParam::FileTagsSome(value) - } - pub fn every(&self, value: Vec) -> FileWhereParam { - FileWhereParam::FileTagsEvery(value) - } - pub fn link>(&self, value: Vec) -> T { - FileLinkFileTags(value).into() - } - pub fn unlink(&self, params: Vec) -> FileSetParam { - FileSetParam::UnlinkFileTags(params) - } - pub fn fetch(&self, params: Vec) -> FileWith { - FileWithParam::FileTags(params).into() - } -} -pub struct FileFileLabelsField {} -pub struct FileLinkFileLabels(Vec); -impl From for FileSetParam { - fn from(value: FileLinkFileLabels) -> Self { - Self::LinkFileLabels(value.0.into_iter().map(|v| v.into()).collect()) - } -} -impl FileFileLabelsField { - pub fn some(&self, value: Vec) -> FileWhereParam { - FileWhereParam::FileLabelsSome(value) - } - pub fn every(&self, value: Vec) -> FileWhereParam { - FileWhereParam::FileLabelsEvery(value) - } - pub fn link>(&self, value: Vec) -> T { - FileLinkFileLabels(value).into() - } - pub fn unlink(&self, params: Vec) -> FileSetParam { - FileSetParam::UnlinkFileLabels(params) - } - pub fn fetch(&self, params: Vec) -> FileWith { - FileWithParam::FileLabels(params).into() - } -} -pub struct FileFilePathsField {} -pub struct FileLinkFilePaths(Vec); -impl From for FileSetParam { - fn from(value: FileLinkFilePaths) -> Self { - Self::LinkFilePaths(value.0.into_iter().map(|v| v.into()).collect()) - } -} -impl FileFilePathsField { - pub fn some(&self, value: Vec) -> FileWhereParam { - FileWhereParam::FilePathsSome(value) - } - pub fn every(&self, value: Vec) -> FileWhereParam { - FileWhereParam::FilePathsEvery(value) - } - pub fn link>(&self, value: Vec) -> T { - FileLinkFilePaths(value).into() - } - pub fn unlink(&self, params: Vec) -> FileSetParam { - FileSetParam::UnlinkFilePaths(params) - } - pub fn fetch(&self, params: Vec) -> FileWith { - FileWithParam::FilePaths(params).into() - } -} -pub struct FileCommentsField {} -pub struct FileLinkComments(Vec); -impl From for FileSetParam { - fn from(value: FileLinkComments) -> Self { - Self::LinkComments(value.0.into_iter().map(|v| v.into()).collect()) - } -} -impl FileCommentsField { - pub fn some(&self, value: Vec) -> FileWhereParam { - FileWhereParam::CommentsSome(value) - } - pub fn every(&self, value: Vec) -> FileWhereParam { - FileWhereParam::CommentsEvery(value) - } - pub fn link>(&self, value: Vec) -> T { - FileLinkComments(value).into() - } - pub fn unlink(&self, params: Vec) -> FileSetParam { - FileSetParam::UnlinkComments(params) - } - pub fn fetch(&self, params: Vec) -> FileWith { - FileWithParam::Comments(params).into() - } -} -pub enum FileWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), - IdHashContains(String), - IdHashHasPrefix(String), - IdHashHasSuffix(String), - IdHashEquals(String), +pub enum LocationWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + NameEquals(String), + NameInVec(Vec), + NameNotInVec(Vec), + NameLt(String), + NameLte(String), + NameGt(String), + NameGte(String), NameContains(String), + NameStartsWith(String), + NameEndsWith(String), + NameNot(String), NameHasPrefix(String), NameHasSuffix(String), - NameEquals(String), - ExtensionContains(String), - ExtensionHasPrefix(String), - ExtensionHasSuffix(String), - ExtensionEquals(String), - ChecksumContains(String), - ChecksumHasPrefix(String), - ChecksumHasSuffix(String), - ChecksumEquals(String), - SizeInBytesContains(String), - SizeInBytesHasPrefix(String), - SizeInBytesHasSuffix(String), - SizeInBytesEquals(String), - EncryptionLT(i64), - EncryptionGT(i64), - EncryptionLTE(i64), - EncryptionGTE(i64), - EncryptionEquals(i64), + LocalPathEquals(String), + LocalPathInVec(Vec), + LocalPathNotInVec(Vec), + LocalPathLt(String), + LocalPathLte(String), + LocalPathGt(String), + LocalPathGte(String), + LocalPathContains(String), + LocalPathStartsWith(String), + LocalPathEndsWith(String), + LocalPathNot(String), + LocalPathHasPrefix(String), + LocalPathHasSuffix(String), + TotalCapacityEquals(i32), + TotalCapacityInVec(Vec), + TotalCapacityNotInVec(Vec), + TotalCapacityLt(i32), + TotalCapacityLte(i32), + TotalCapacityGt(i32), + TotalCapacityGte(i32), + TotalCapacityNot(i32), + TotalCapacityLt(i32), + TotalCapacityLte(i32), + TotalCapacityGt(i32), + TotalCapacityGte(i32), + AvailableCapacityEquals(i32), + AvailableCapacityInVec(Vec), + AvailableCapacityNotInVec(Vec), + AvailableCapacityLt(i32), + AvailableCapacityLte(i32), + AvailableCapacityGt(i32), + AvailableCapacityGte(i32), + AvailableCapacityNot(i32), + AvailableCapacityLt(i32), + AvailableCapacityLte(i32), + AvailableCapacityGt(i32), + AvailableCapacityGte(i32), + FilesystemEquals(String), + FilesystemInVec(Vec), + FilesystemNotInVec(Vec), + FilesystemLt(String), + FilesystemLte(String), + FilesystemGt(String), + FilesystemGte(String), + FilesystemContains(String), + FilesystemStartsWith(String), + FilesystemEndsWith(String), + FilesystemNot(String), + FilesystemHasPrefix(String), + FilesystemHasSuffix(String), + DiskTypeEquals(i32), + DiskTypeInVec(Vec), + DiskTypeNotInVec(Vec), + DiskTypeLt(i32), + DiskTypeLte(i32), + DiskTypeGt(i32), + DiskTypeGte(i32), + DiskTypeNot(i32), + DiskTypeLt(i32), + DiskTypeLte(i32), + DiskTypeGt(i32), + DiskTypeGte(i32), + IsRemovableEquals(bool), + IsEjectableEquals(bool), + IsRootFilesystemEquals(bool), + IsOnlineEquals(bool), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), DateCreatedBefore(chrono::DateTime), DateCreatedAfter(chrono::DateTime), DateCreatedBeforeEquals(chrono::DateTime), DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), - DateModifiedBefore(chrono::DateTime), - DateModifiedAfter(chrono::DateTime), - DateModifiedBeforeEquals(chrono::DateTime), - DateModifiedAfterEquals(chrono::DateTime), - DateModifiedEquals(chrono::DateTime), - DateIndexedBefore(chrono::DateTime), - DateIndexedAfter(chrono::DateTime), - DateIndexedBeforeEquals(chrono::DateTime), - DateIndexedAfterEquals(chrono::DateTime), - DateIndexedEquals(chrono::DateTime), - IpfsIdContains(String), - IpfsIdHasPrefix(String), - IpfsIdHasSuffix(String), - IpfsIdEquals(String), - FileTagsSome(Vec), - FileTagsEvery(Vec), - FileLabelsSome(Vec), - FileLabelsEvery(Vec), FilePathsSome(Vec), FilePathsEvery(Vec), - CommentsSome(Vec), - CommentsEvery(Vec), - Not(Vec), - Or(Vec), - And(Vec), } -impl FileWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), +impl LocationWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, Self::IdEquals(value) => Field { @@ -5715,35 +10024,125 @@ impl FileWhereParam { }]), ..Default::default() }, - Self::IdHashContains(value) => Field { - name: "id_hash".into(), + Self::IdInVec(value) => Field { + name: "id".into(), fields: Some(vec![Field { - name: "contains".into(), + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }]), ..Default::default() }, - Self::IdHashHasPrefix(value) => Field { - name: "id_hash".into(), + Self::IdLte(value) => Field { + name: "id".into(), fields: Some(vec![Field { - name: "starts_with".into(), + name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }]), ..Default::default() }, - Self::IdHashHasSuffix(value) => Field { - name: "id_hash".into(), + Self::IdGt(value) => Field { + name: "id".into(), fields: Some(vec![Field { - name: "ends_with".into(), + name: "gt".into(), value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }]), ..Default::default() }, - Self::IdHashEquals(value) => Field { - name: "id_hash".into(), + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -5751,6 +10150,78 @@ impl FileWhereParam { }]), ..Default::default() }, + Self::NameInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNotInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::NameContains(value) => Field { name: "name".into(), fields: Some(vec![Field { @@ -5760,6 +10231,33 @@ impl FileWhereParam { }]), ..Default::default() }, + Self::NameStartsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEndsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNot(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::NameHasPrefix(value) => Field { name: "name".into(), fields: Some(vec![Field { @@ -5778,8 +10276,8 @@ impl FileWhereParam { }]), ..Default::default() }, - Self::NameEquals(value) => Field { - name: "name".into(), + Self::LocalPathEquals(value) => Field { + name: "local_path".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -5787,116 +10285,44 @@ impl FileWhereParam { }]), ..Default::default() }, - Self::ExtensionContains(value) => Field { - name: "extension".into(), + Self::LocalPathInVec(value) => Field { + name: "local_path".into(), fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::ExtensionHasPrefix(value) => Field { - name: "extension".into(), + Self::LocalPathNotInVec(value) => Field { + name: "local_path".into(), fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::ExtensionHasSuffix(value) => Field { - name: "extension".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ExtensionEquals(value) => Field { - name: "extension".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ChecksumContains(value) => Field { - name: "checksum".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ChecksumHasPrefix(value) => Field { - name: "checksum".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ChecksumHasSuffix(value) => Field { - name: "checksum".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ChecksumEquals(value) => Field { - name: "checksum".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SizeInBytesContains(value) => Field { - name: "size_in_bytes".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SizeInBytesHasPrefix(value) => Field { - name: "size_in_bytes".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SizeInBytesHasSuffix(value) => Field { - name: "size_in_bytes".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SizeInBytesEquals(value) => Field { - name: "size_in_bytes".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionLT(value) => Field { - name: "encryption".into(), + Self::LocalPathLt(value) => Field { + name: "local_path".into(), fields: Some(vec![Field { name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -5904,17 +10330,8 @@ impl FileWhereParam { }]), ..Default::default() }, - Self::EncryptionGT(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionLTE(value) => Field { - name: "encryption".into(), + Self::LocalPathLte(value) => Field { + name: "local_path".into(), fields: Some(vec![Field { name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -5922,8 +10339,17 @@ impl FileWhereParam { }]), ..Default::default() }, - Self::EncryptionGTE(value) => Field { - name: "encryption".into(), + Self::LocalPathGt(value) => Field { + name: "local_path".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocalPathGte(value) => Field { + name: "local_path".into(), fields: Some(vec![Field { name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -5931,8 +10357,62 @@ impl FileWhereParam { }]), ..Default::default() }, - Self::EncryptionEquals(value) => Field { - name: "encryption".into(), + Self::LocalPathContains(value) => Field { + name: "local_path".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocalPathStartsWith(value) => Field { + name: "local_path".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocalPathEndsWith(value) => Field { + name: "local_path".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocalPathNot(value) => Field { + name: "local_path".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocalPathHasPrefix(value) => Field { + name: "local_path".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocalPathHasSuffix(value) => Field { + name: "local_path".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityEquals(value) => Field { + name: "total_capacity".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -5940,6 +10420,636 @@ impl FileWhereParam { }]), ..Default::default() }, + Self::TotalCapacityInVec(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityNotInVec(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityLt(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityLte(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityGt(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityGte(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityNot(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityLt(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityLte(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityGt(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalCapacityGte(value) => Field { + name: "total_capacity".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityEquals(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityInVec(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityNotInVec(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityLt(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityLte(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityGt(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityGte(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityNot(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityLt(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityLte(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityGt(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::AvailableCapacityGte(value) => Field { + name: "available_capacity".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemEquals(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemInVec(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemNotInVec(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemLt(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemLte(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemGt(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemGte(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemContains(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemStartsWith(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemEndsWith(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemNot(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemHasPrefix(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilesystemHasSuffix(value) => Field { + name: "filesystem".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeEquals(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeInVec(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeNotInVec(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeLt(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeLte(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeGt(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeGte(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeNot(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeLt(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeLte(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeGt(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DiskTypeGte(value) => Field { + name: "disk_type".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsRemovableEquals(value) => Field { + name: "is_removable".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsEjectableEquals(value) => Field { + name: "is_ejectable".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsRootFilesystemEquals(value) => Field { + name: "is_root_filesystem".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IsOnlineEquals(value) => Field { + name: "is_online".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateCreatedBefore(value) => Field { name: "date_created".into(), fields: Some(vec![Field { @@ -5976,6 +11086,2846 @@ impl FileWhereParam { }]), ..Default::default() }, + Self::FilePathsSome(value) => Field { + name: "file_paths".into(), + fields: Some(vec![Field { + name: "some".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FilePathsEvery(value) => Field { + name: "file_paths".into(), + fields: Some(vec![Field { + name: "every".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum LocationWhereUniqueParam { + IdEquals(i32), +} +impl From for LocationWhereParam { + fn from(value: LocationWhereUniqueParam) -> Self { + match value { + LocationWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + } + } +} +impl From> for LocationWhereParam { + fn from(op: Operator) -> Self { + match op { + Operator::Not(value) => Self::Not(value), + Operator::And(value) => Self::And(value), + Operator::Or(value) => Self::Or(value), + } + } +} +pub struct LocationFindMany<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> LocationFindMany<'a> { + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> LocationDelete<'a> { + LocationDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Location".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> LocationUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + LocationUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn order_by(mut self, param: LocationOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: LocationWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LocationCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct LocationFindFirst<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> LocationFindFirst<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: LocationWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: LocationOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LocationCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct LocationFindUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> LocationFindUnique<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> LocationDelete<'a> { + LocationDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Location".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> LocationUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + LocationUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn with(mut self, param: LocationWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LocationCreateOne<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> LocationCreateOne<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: LocationWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LocationUpdateUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> LocationUpdateUnique<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn with(mut self, param: LocationWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LocationUpdateMany<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> LocationUpdateMany<'a> { + pub async fn exec(self) -> QueryResult> { + self.query.perform().await + } + pub fn with(mut self, param: LocationWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LocationUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> LocationUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create(mut self, params: Vec) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + self + } +} +pub struct LocationDelete<'a> { + query: Query<'a>, +} +impl<'a> LocationDelete<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) + } +} +pub struct LocationActions<'a> { + client: &'a PrismaClient, +} +impl<'a> LocationActions<'a> { + pub fn find_unique(&self, param: LocationWhereUniqueParam) -> LocationFindUnique { + let param: LocationWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Location".into(), + outputs: location_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + LocationFindUnique { + query, + with_params: vec![], + } + } + pub fn find_first(&self, params: Vec) -> LocationFindFirst { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Location".into(), + outputs: location_outputs(), + inputs, + }; + LocationFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn find_many(&self, params: Vec) -> LocationFindMany { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Location".into(), + outputs: location_outputs(), + inputs, + }; + LocationFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn create_one(&self, params: Vec) -> LocationCreateOne { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Location".into(), + outputs: location_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + LocationCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: LocationWhereUniqueParam) -> LocationUpsertOne { + let param: LocationWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Location".into(), + outputs: location_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + LocationUpsertOne { query } + } +} +fn file_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("kind"), + Output::new("size_in_bytes"), + Output::new("partial_checksum"), + Output::new("checksum"), + Output::new("encryption"), + Output::new("ipfs_id"), + Output::new("date_created"), + Output::new("date_modified"), + Output::new("date_indexed"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct FileData { + #[serde(rename = "id")] + pub id: i32, + #[serde(rename = "kind")] + pub kind: i32, + #[serde(rename = "size_in_bytes")] + pub size_in_bytes: String, + #[serde(rename = "partial_checksum")] + pub partial_checksum: String, + #[serde(rename = "checksum")] + pub checksum: Option, + #[serde(rename = "encryption")] + pub encryption: i32, + #[serde(rename = "ipfs_id")] + pub ipfs_id: Option, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "date_modified")] + pub date_modified: chrono::DateTime, + #[serde(rename = "date_indexed")] + pub date_indexed: chrono::DateTime, + #[serde(rename = "file_tags")] + file_tags: Option>, + #[serde(rename = "file_labels")] + file_labels: Option>, + #[serde(rename = "file_paths")] + file_paths: Option>, + #[serde(rename = "comments")] + comments: Option>, +} +impl FileData { + pub fn file_tags(&self) -> Result<&Vec, String> { + match self . file_tags . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access file_tags but did not fetch it using the .with() syntax" . to_string ()) , } + } + pub fn file_labels(&self) -> Result<&Vec, String> { + match self . file_labels . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access file_labels but did not fetch it using the .with() syntax" . to_string ()) , } + } + pub fn file_paths(&self) -> Result<&Vec, String> { + match self . file_paths . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access file_paths but did not fetch it using the .with() syntax" . to_string ()) , } + } + pub fn comments(&self) -> Result<&Vec, String> { + match self . comments . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access comments but did not fetch it using the .with() syntax" . to_string ()) , } + } +} +pub struct File; +impl File { + pub fn id() -> FileIdField { + FileIdField {} + } + pub fn kind() -> FileKindField { + FileKindField {} + } + pub fn size_in_bytes() -> FileSizeInBytesField { + FileSizeInBytesField {} + } + pub fn partial_checksum() -> FilePartialChecksumField { + FilePartialChecksumField {} + } + pub fn checksum() -> FileChecksumField { + FileChecksumField {} + } + pub fn encryption() -> FileEncryptionField { + FileEncryptionField {} + } + pub fn ipfs_id() -> FileIpfsIdField { + FileIpfsIdField {} + } + pub fn date_created() -> FileDateCreatedField { + FileDateCreatedField {} + } + pub fn date_modified() -> FileDateModifiedField { + FileDateModifiedField {} + } + pub fn date_indexed() -> FileDateIndexedField { + FileDateIndexedField {} + } + pub fn file_tags() -> FileFileTagsField { + FileFileTagsField {} + } + pub fn file_labels() -> FileFileLabelsField { + FileFileLabelsField {} + } + pub fn file_paths() -> FileFilePathsField { + FileFilePathsField {} + } + pub fn comments() -> FileCommentsField { + FileCommentsField {} + } +} +pub struct FileIdField {} +impl FileIdField { + pub fn set>(&self, value: i32) -> T { + FileSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + FileWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> FileCursor { + FileCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> FileSetParam { + FileSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> FileSetParam { + FileSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> FileSetParam { + FileSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> FileSetParam { + FileSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> FileWhereParam { + FileWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> FileWhereParam { + FileWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> FileWhereParam { + FileWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> FileWhereParam { + FileWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> FileWhereParam { + FileWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> FileWhereParam { + FileWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> FileWhereParam { + FileWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> FileWhereParam { + FileWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> FileWhereParam { + FileWhereParam::IdGte(value) + } +} +pub struct FileSetId(i32); +impl From for FileSetParam { + fn from(value: FileSetId) -> Self { + Self::SetId(value.0) + } +} +pub struct FileKindField {} +impl FileKindField { + pub fn set>(&self, value: i32) -> T { + FileSetKind(value).into() + } + pub fn equals(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::Kind(direction) + } + pub fn cursor(&self, cursor: i32) -> FileCursor { + FileCursor::Kind(cursor) + } + pub fn increment(&self, value: i32) -> FileSetParam { + FileSetParam::Kind(value) + } + pub fn decrement(&self, value: i32) -> FileSetParam { + FileSetParam::Kind(value) + } + pub fn multiply(&self, value: i32) -> FileSetParam { + FileSetParam::Kind(value) + } + pub fn divide(&self, value: i32) -> FileSetParam { + FileSetParam::Kind(value) + } + pub fn in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::KindInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::KindNotInVec(value) + } + pub fn lt(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindLt(value) + } + pub fn lte(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindLte(value) + } + pub fn gt(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindGt(value) + } + pub fn gte(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindGte(value) + } + pub fn not(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindNot(value) + } + pub fn lt(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindLt(value) + } + pub fn lte(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindLte(value) + } + pub fn gt(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindGt(value) + } + pub fn gte(&self, value: i32) -> FileWhereParam { + FileWhereParam::KindGte(value) + } +} +pub struct FileSetKind(i32); +impl From for FileSetParam { + fn from(value: FileSetKind) -> Self { + Self::SetKind(value.0) + } +} +pub struct FileSizeInBytesField {} +impl FileSizeInBytesField { + pub fn set>(&self, value: String) -> T { + FileSetSizeInBytes(value).into() + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::SizeInBytes(direction) + } + pub fn cursor(&self, cursor: String) -> FileCursor { + FileCursor::SizeInBytes(cursor) + } + pub fn in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::SizeInBytesInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::SizeInBytesNotInVec(value) + } + pub fn lt(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesLt(value) + } + pub fn lte(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesLte(value) + } + pub fn gt(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesGt(value) + } + pub fn gte(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesGte(value) + } + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesContains(value) + } + pub fn starts_with(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesStartsWith(value) + } + pub fn ends_with(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesEndsWith(value) + } + pub fn not(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesNot(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::SizeInBytesHasSuffix(value) + } +} +pub struct FileSetSizeInBytes(String); +impl From for FileSetParam { + fn from(value: FileSetSizeInBytes) -> Self { + Self::SetSizeInBytes(value.0) + } +} +pub struct FilePartialChecksumField {} +impl FilePartialChecksumField { + pub fn set>(&self, value: String) -> T { + FileSetPartialChecksum(value).into() + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::PartialChecksum(direction) + } + pub fn cursor(&self, cursor: String) -> FileCursor { + FileCursor::PartialChecksum(cursor) + } + pub fn in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::PartialChecksumInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::PartialChecksumNotInVec(value) + } + pub fn lt(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumLt(value) + } + pub fn lte(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumLte(value) + } + pub fn gt(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumGt(value) + } + pub fn gte(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumGte(value) + } + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumContains(value) + } + pub fn starts_with(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumStartsWith(value) + } + pub fn ends_with(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumEndsWith(value) + } + pub fn not(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumNot(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::PartialChecksumHasSuffix(value) + } +} +pub struct FileSetPartialChecksum(String); +impl From for FileSetParam { + fn from(value: FileSetPartialChecksum) -> Self { + Self::SetPartialChecksum(value.0) + } +} +pub struct FileChecksumField {} +impl FileChecksumField { + pub fn set>(&self, value: String) -> T { + FileSetChecksum(value).into() + } + pub fn equals>(&self, value: String) -> T { + FileWhereUniqueParam::ChecksumEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::Checksum(direction) + } + pub fn cursor(&self, cursor: String) -> FileCursor { + FileCursor::Checksum(cursor) + } + pub fn in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::ChecksumInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::ChecksumNotInVec(value) + } + pub fn lt(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumLt(value) + } + pub fn lte(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumLte(value) + } + pub fn gt(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumGt(value) + } + pub fn gte(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumGte(value) + } + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumContains(value) + } + pub fn starts_with(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumStartsWith(value) + } + pub fn ends_with(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumEndsWith(value) + } + pub fn not(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumNot(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::ChecksumHasSuffix(value) + } +} +pub struct FileSetChecksum(String); +impl From for FileSetParam { + fn from(value: FileSetChecksum) -> Self { + Self::SetChecksum(value.0) + } +} +pub struct FileEncryptionField {} +impl FileEncryptionField { + pub fn set>(&self, value: i32) -> T { + FileSetEncryption(value).into() + } + pub fn equals(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::Encryption(direction) + } + pub fn cursor(&self, cursor: i32) -> FileCursor { + FileCursor::Encryption(cursor) + } + pub fn increment(&self, value: i32) -> FileSetParam { + FileSetParam::Encryption(value) + } + pub fn decrement(&self, value: i32) -> FileSetParam { + FileSetParam::Encryption(value) + } + pub fn multiply(&self, value: i32) -> FileSetParam { + FileSetParam::Encryption(value) + } + pub fn divide(&self, value: i32) -> FileSetParam { + FileSetParam::Encryption(value) + } + pub fn in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::EncryptionInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::EncryptionNotInVec(value) + } + pub fn lt(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionGte(value) + } + pub fn not(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionNot(value) + } + pub fn lt(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> FileWhereParam { + FileWhereParam::EncryptionGte(value) + } +} +pub struct FileSetEncryption(i32); +impl From for FileSetParam { + fn from(value: FileSetEncryption) -> Self { + Self::SetEncryption(value.0) + } +} +pub struct FileIpfsIdField {} +impl FileIpfsIdField { + pub fn set>(&self, value: String) -> T { + FileSetIpfsId(value).into() + } + pub fn equals(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::IpfsId(direction) + } + pub fn cursor(&self, cursor: String) -> FileCursor { + FileCursor::IpfsId(cursor) + } + pub fn in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::IpfsIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FileWhereParam { + FileWhereParam::IpfsIdNotInVec(value) + } + pub fn lt(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdLt(value) + } + pub fn lte(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdLte(value) + } + pub fn gt(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdGt(value) + } + pub fn gte(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdGte(value) + } + pub fn contains(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdContains(value) + } + pub fn starts_with(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdStartsWith(value) + } + pub fn ends_with(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdEndsWith(value) + } + pub fn not(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdNot(value) + } + pub fn has_prefix(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FileWhereParam { + FileWhereParam::IpfsIdHasSuffix(value) + } +} +pub struct FileSetIpfsId(String); +impl From for FileSetParam { + fn from(value: FileSetIpfsId) -> Self { + Self::SetIpfsId(value.0) + } +} +pub struct FileDateCreatedField {} +impl FileDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + FileSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> FileCursor { + FileCursor::DateCreated(cursor) + } + pub fn in_vec(&self, value: Vec>) -> FileWhereParam { + FileWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> FileWhereParam { + FileWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateCreatedAfterEquals(value) + } +} +pub struct FileSetDateCreated(chrono::DateTime); +impl From for FileSetParam { + fn from(value: FileSetDateCreated) -> Self { + Self::SetDateCreated(value.0) + } +} +pub struct FileDateModifiedField {} +impl FileDateModifiedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + FileSetDateModified(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::DateModified(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> FileCursor { + FileCursor::DateModified(cursor) + } + pub fn in_vec(&self, value: Vec>) -> FileWhereParam { + FileWhereParam::DateModifiedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> FileWhereParam { + FileWhereParam::DateModifiedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateModifiedAfterEquals(value) + } +} +pub struct FileSetDateModified(chrono::DateTime); +impl From for FileSetParam { + fn from(value: FileSetDateModified) -> Self { + Self::SetDateModified(value.0) + } +} +pub struct FileDateIndexedField {} +impl FileDateIndexedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + FileSetDateIndexed(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FileOrderByParam { + FileOrderByParam::DateIndexed(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> FileCursor { + FileCursor::DateIndexed(cursor) + } + pub fn in_vec(&self, value: Vec>) -> FileWhereParam { + FileWhereParam::DateIndexedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> FileWhereParam { + FileWhereParam::DateIndexedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> FileWhereParam { + FileWhereParam::DateIndexedAfterEquals(value) + } +} +pub struct FileSetDateIndexed(chrono::DateTime); +impl From for FileSetParam { + fn from(value: FileSetDateIndexed) -> Self { + Self::SetDateIndexed(value.0) + } +} +pub struct FileFileTagsField {} +impl FileFileTagsField { + pub fn some(&self, value: Vec) -> FileWhereParam { + FileWhereParam::FileTagsSome(value) + } + pub fn every(&self, value: Vec) -> FileWhereParam { + FileWhereParam::FileTagsEvery(value) + } + pub fn fetch(&self, params: Vec) -> FileWithParam { + FileWithParam::FileTags(params) + } + pub fn link>( + &self, + params: Vec, + ) -> T { + FileLinkFileTags(params).into() + } + pub fn unlink(&self, params: Vec) -> FileSetParam { + FileSetParam::UnLinkFileTags(params) + } +} +pub struct FileLinkFileTags(Vec); +impl From for FileSetParam { + fn from(value: FileLinkFileTags) -> Self { + Self::LinkFileTags(value.0) + } +} +pub struct FileFileLabelsField {} +impl FileFileLabelsField { + pub fn some(&self, value: Vec) -> FileWhereParam { + FileWhereParam::FileLabelsSome(value) + } + pub fn every(&self, value: Vec) -> FileWhereParam { + FileWhereParam::FileLabelsEvery(value) + } + pub fn fetch(&self, params: Vec) -> FileWithParam { + FileWithParam::FileLabels(params) + } + pub fn link>( + &self, + params: Vec, + ) -> T { + FileLinkFileLabels(params).into() + } + pub fn unlink(&self, params: Vec) -> FileSetParam { + FileSetParam::UnLinkFileLabels(params) + } +} +pub struct FileLinkFileLabels(Vec); +impl From for FileSetParam { + fn from(value: FileLinkFileLabels) -> Self { + Self::LinkFileLabels(value.0) + } +} +pub struct FileFilePathsField {} +impl FileFilePathsField { + pub fn some(&self, value: Vec) -> FileWhereParam { + FileWhereParam::FilePathsSome(value) + } + pub fn every(&self, value: Vec) -> FileWhereParam { + FileWhereParam::FilePathsEvery(value) + } + pub fn fetch(&self, params: Vec) -> FileWithParam { + FileWithParam::FilePaths(params) + } + pub fn link>( + &self, + params: Vec, + ) -> T { + FileLinkFilePaths(params).into() + } + pub fn unlink(&self, params: Vec) -> FileSetParam { + FileSetParam::UnLinkFilePaths(params) + } +} +pub struct FileLinkFilePaths(Vec); +impl From for FileSetParam { + fn from(value: FileLinkFilePaths) -> Self { + Self::LinkFilePaths(value.0) + } +} +pub struct FileCommentsField {} +impl FileCommentsField { + pub fn some(&self, value: Vec) -> FileWhereParam { + FileWhereParam::CommentsSome(value) + } + pub fn every(&self, value: Vec) -> FileWhereParam { + FileWhereParam::CommentsEvery(value) + } + pub fn fetch(&self, params: Vec) -> FileWithParam { + FileWithParam::Comments(params) + } + pub fn link>( + &self, + params: Vec, + ) -> T { + FileLinkComments(params).into() + } + pub fn unlink(&self, params: Vec) -> FileSetParam { + FileSetParam::UnLinkComments(params) + } +} +pub struct FileLinkComments(Vec); +impl From for FileSetParam { + fn from(value: FileLinkComments) -> Self { + Self::LinkComments(value.0) + } +} +pub enum FileWithParam { + FileTags(Vec), + FileLabels(Vec), + FilePaths(Vec), + Comments(Vec), +} +impl FileWithParam { + pub fn to_output(self) -> Output { + match self { + Self::FileTags(where_params) => Output { + name: "file_tags".into(), + outputs: tag_on_file_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + Self::FileLabels(where_params) => Output { + name: "file_labels".into(), + outputs: label_on_file_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + Self::FilePaths(where_params) => Output { + name: "file_paths".into(), + outputs: file_path_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + Self::Comments(where_params) => Output { + name: "comments".into(), + outputs: comment_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + } + } +} +pub enum FileSetParam { + SetId(i32), + SetKind(i32), + SetSizeInBytes(String), + SetPartialChecksum(String), + SetChecksum(String), + SetEncryption(i32), + SetIpfsId(String), + SetDateCreated(chrono::DateTime), + SetDateModified(chrono::DateTime), + SetDateIndexed(chrono::DateTime), + LinkFileTags(Vec), + UnLinkFileTags(Vec), + LinkFileLabels(Vec), + UnLinkFileLabels(Vec), + LinkFilePaths(Vec), + UnLinkFilePaths(Vec), + LinkComments(Vec), + UnLinkComments(Vec), +} +impl FileSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetKind(value) => Field { + name: "kind".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetSizeInBytes(value) => Field { + name: "size_in_bytes".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetPartialChecksum(value) => Field { + name: "partial_checksum".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetChecksum(value) => Field { + name: "checksum".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetEncryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetIpfsId(value) => Field { + name: "ipfs_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateIndexed(value) => Field { + name: "date_indexed".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkFileTags(where_params) => Field { + name: "file_tags".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkFileTags(where_params) => Field { + name: "file_tags".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + Self::LinkFileLabels(where_params) => Field { + name: "file_labels".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkFileLabels(where_params) => Field { + name: "file_labels".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + Self::LinkFilePaths(where_params) => Field { + name: "file_paths".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkFilePaths(where_params) => Field { + name: "file_paths".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + Self::LinkComments(where_params) => Field { + name: "comments".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkComments(where_params) => Field { + name: "comments".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum FileOrderByParam { + Id(Direction), + Kind(Direction), + SizeInBytes(Direction), + PartialChecksum(Direction), + Checksum(Direction), + Encryption(Direction), + IpfsId(Direction), + DateCreated(Direction), + DateModified(Direction), + DateIndexed(Direction), +} +impl FileOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Kind(direction) => Field { + name: "kind".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::SizeInBytes(direction) => Field { + name: "size_in_bytes".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::PartialChecksum(direction) => Field { + name: "partial_checksum".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Checksum(direction) => Field { + name: "checksum".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Encryption(direction) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::IpfsId(direction) => Field { + name: "ipfs_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateModified(direction) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateIndexed(direction) => Field { + name: "date_indexed".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum FileCursor { + Id(i32), + Kind(i32), + SizeInBytes(String), + PartialChecksum(String), + Checksum(String), + Encryption(i32), + IpfsId(String), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), + DateIndexed(chrono::DateTime), +} +impl FileCursor { + fn to_field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Kind(value) => Field { + name: "kind".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SizeInBytes(value) => Field { + name: "size_in_bytes".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::PartialChecksum(value) => Field { + name: "partial_checksum".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Checksum(value) => Field { + name: "checksum".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Encryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::IpfsId(value) => Field { + name: "ipfs_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateIndexed(value) => Field { + name: "date_indexed".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum FileWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + KindEquals(i32), + KindInVec(Vec), + KindNotInVec(Vec), + KindLt(i32), + KindLte(i32), + KindGt(i32), + KindGte(i32), + KindNot(i32), + KindLt(i32), + KindLte(i32), + KindGt(i32), + KindGte(i32), + SizeInBytesEquals(String), + SizeInBytesInVec(Vec), + SizeInBytesNotInVec(Vec), + SizeInBytesLt(String), + SizeInBytesLte(String), + SizeInBytesGt(String), + SizeInBytesGte(String), + SizeInBytesContains(String), + SizeInBytesStartsWith(String), + SizeInBytesEndsWith(String), + SizeInBytesNot(String), + SizeInBytesHasPrefix(String), + SizeInBytesHasSuffix(String), + PartialChecksumEquals(String), + PartialChecksumInVec(Vec), + PartialChecksumNotInVec(Vec), + PartialChecksumLt(String), + PartialChecksumLte(String), + PartialChecksumGt(String), + PartialChecksumGte(String), + PartialChecksumContains(String), + PartialChecksumStartsWith(String), + PartialChecksumEndsWith(String), + PartialChecksumNot(String), + PartialChecksumHasPrefix(String), + PartialChecksumHasSuffix(String), + ChecksumEquals(String), + ChecksumInVec(Vec), + ChecksumNotInVec(Vec), + ChecksumLt(String), + ChecksumLte(String), + ChecksumGt(String), + ChecksumGte(String), + ChecksumContains(String), + ChecksumStartsWith(String), + ChecksumEndsWith(String), + ChecksumNot(String), + ChecksumHasPrefix(String), + ChecksumHasSuffix(String), + EncryptionEquals(i32), + EncryptionInVec(Vec), + EncryptionNotInVec(Vec), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + EncryptionNot(i32), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + IpfsIdEquals(String), + IpfsIdInVec(Vec), + IpfsIdNotInVec(Vec), + IpfsIdLt(String), + IpfsIdLte(String), + IpfsIdGt(String), + IpfsIdGte(String), + IpfsIdContains(String), + IpfsIdStartsWith(String), + IpfsIdEndsWith(String), + IpfsIdNot(String), + IpfsIdHasPrefix(String), + IpfsIdHasSuffix(String), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + DateModifiedInVec(Vec>), + DateModifiedNotInVec(Vec>), + DateModifiedLt(chrono::DateTime), + DateModifiedLte(chrono::DateTime), + DateModifiedGt(chrono::DateTime), + DateModifiedGte(chrono::DateTime), + DateModifiedNot(chrono::DateTime), + DateModifiedBefore(chrono::DateTime), + DateModifiedAfter(chrono::DateTime), + DateModifiedBeforeEquals(chrono::DateTime), + DateModifiedAfterEquals(chrono::DateTime), + DateIndexedEquals(chrono::DateTime), + DateIndexedInVec(Vec>), + DateIndexedNotInVec(Vec>), + DateIndexedLt(chrono::DateTime), + DateIndexedLte(chrono::DateTime), + DateIndexedGt(chrono::DateTime), + DateIndexedGte(chrono::DateTime), + DateIndexedNot(chrono::DateTime), + DateIndexedBefore(chrono::DateTime), + DateIndexedAfter(chrono::DateTime), + DateIndexedBeforeEquals(chrono::DateTime), + DateIndexedAfterEquals(chrono::DateTime), + FileTagsSome(Vec), + FileTagsEvery(Vec), + FileLabelsSome(Vec), + FileLabelsEvery(Vec), + FilePathsSome(Vec), + FilePathsEvery(Vec), + CommentsSome(Vec), + CommentsEvery(Vec), +} +impl FileWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindEquals(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindInVec(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindNotInVec(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindLt(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindLte(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindGt(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindGte(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindNot(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindLt(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindLte(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindGt(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::KindGte(value) => Field { + name: "kind".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesEquals(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesInVec(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesNotInVec(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesLt(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesLte(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesGt(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesGte(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesContains(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesStartsWith(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesEndsWith(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesNot(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesHasPrefix(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SizeInBytesHasSuffix(value) => Field { + name: "size_in_bytes".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumEquals(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumInVec(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumNotInVec(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumLt(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumLte(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumGt(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumGte(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumContains(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumStartsWith(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumEndsWith(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumNot(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumHasPrefix(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PartialChecksumHasSuffix(value) => Field { + name: "partial_checksum".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumEquals(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumInVec(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumNotInVec(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumLt(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumLte(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumGt(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumGte(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumContains(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumStartsWith(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumEndsWith(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumNot(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumHasPrefix(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ChecksumHasSuffix(value) => Field { + name: "checksum".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionEquals(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionInVec(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNotInVec(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNot(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdEquals(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdInVec(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdNotInVec(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdLt(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdLte(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdGt(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdGte(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdContains(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdStartsWith(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdEndsWith(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdNot(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdHasPrefix(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IpfsIdHasSuffix(value) => Field { + name: "ipfs_id".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateCreatedEquals(value) => Field { name: "date_created".into(), fields: Some(vec![Field { @@ -5985,6 +13935,213 @@ impl FileWhereParam { }]), ..Default::default() }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNotInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNot(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateModifiedBefore(value) => Field { name: "date_modified".into(), fields: Some(vec![Field { @@ -6021,8 +14178,8 @@ impl FileWhereParam { }]), ..Default::default() }, - Self::DateModifiedEquals(value) => Field { - name: "date_modified".into(), + Self::DateIndexedEquals(value) => Field { + name: "date_indexed".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -6030,6 +14187,87 @@ impl FileWhereParam { }]), ..Default::default() }, + Self::DateIndexedInVec(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedNotInVec(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedLt(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedLte(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedGt(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedGte(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedNot(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateIndexedBefore(value) => Field { name: "date_indexed".into(), fields: Some(vec![Field { @@ -6066,56 +14304,11 @@ impl FileWhereParam { }]), ..Default::default() }, - Self::DateIndexedEquals(value) => Field { - name: "date_indexed".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IpfsIdContains(value) => Field { - name: "ipfs_id".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IpfsIdHasPrefix(value) => Field { - name: "ipfs_id".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IpfsIdHasSuffix(value) => Field { - name: "ipfs_id".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IpfsIdEquals(value) => Field { - name: "ipfs_id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, Self::FileTagsSome(value) => Field { name: "file_tags".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "some".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() @@ -6123,8 +14316,8 @@ impl FileWhereParam { Self::FileTagsEvery(value) => Field { name: "file_tags".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "every".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() @@ -6132,8 +14325,8 @@ impl FileWhereParam { Self::FileLabelsSome(value) => Field { name: "file_labels".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "some".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() @@ -6141,8 +14334,8 @@ impl FileWhereParam { Self::FileLabelsEvery(value) => Field { name: "file_labels".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "every".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() @@ -6150,8 +14343,8 @@ impl FileWhereParam { Self::FilePathsSome(value) => Field { name: "file_paths".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "some".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() @@ -6159,8 +14352,8 @@ impl FileWhereParam { Self::FilePathsEvery(value) => Field { name: "file_paths".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "every".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() @@ -6168,8 +14361,8 @@ impl FileWhereParam { Self::CommentsSome(value) => Field { name: "comments".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "some".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() @@ -6177,33 +14370,24 @@ impl FileWhereParam { Self::CommentsEvery(value) => Field { name: "comments".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "every".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, + } + } +} +pub enum FileWhereUniqueParam { + IdEquals(i32), + ChecksumEquals(String), +} +impl From for FileWhereParam { + fn from(value: FileWhereUniqueParam) -> Self { + match value { + FileWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + FileWhereUniqueParam::ChecksumEquals(value) => Self::ChecksumEquals(value), } } } @@ -6216,274 +14400,32 @@ impl From> for FileWhereParam { } } } -pub struct FileWith { - pub param: FileWithParam, -} -pub enum FileWithParam { - FileTags(Vec), - FileLabels(Vec), - FilePaths(Vec), - Comments(Vec), -} -impl From for FileWith { - fn from(param: FileWithParam) -> Self { - Self { param } - } -} -impl FileWithParam { - pub fn output(self) -> Output { - match self { - Self::FileTags(where_params) => Output { - name: "file_tags".into(), - outputs: tag_on_file_outputs(), - inputs: if where_params.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_params.into_iter().map(|f| f.field()).collect(), - ..Default::default() - }] - } else { - vec![] - }, - ..Default::default() - }, - Self::FileLabels(where_params) => Output { - name: "file_labels".into(), - outputs: label_on_file_outputs(), - inputs: if where_params.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_params.into_iter().map(|f| f.field()).collect(), - ..Default::default() - }] - } else { - vec![] - }, - ..Default::default() - }, - Self::FilePaths(where_params) => Output { - name: "file_paths".into(), - outputs: file_path_outputs(), - inputs: if where_params.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_params.into_iter().map(|f| f.field()).collect(), - ..Default::default() - }] - } else { - vec![] - }, - ..Default::default() - }, - Self::Comments(where_params) => Output { - name: "comments".into(), - outputs: comment_outputs(), - inputs: if where_params.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_params.into_iter().map(|f| f.field()).collect(), - ..Default::default() - }] - } else { - vec![] - }, - ..Default::default() - }, - } - } -} -pub enum FileSetParam { - Id(i64), - IdHash(String), - Name(String), - Extension(String), - Checksum(String), - SizeInBytes(String), - Encryption(i64), - DateCreated(chrono::DateTime), - DateModified(chrono::DateTime), - DateIndexed(chrono::DateTime), - IpfsId(String), - LinkFileTags(Vec), - UnlinkFileTags(Vec), - LinkFileLabels(Vec), - UnlinkFileLabels(Vec), - LinkFilePaths(Vec), - UnlinkFilePaths(Vec), - LinkComments(Vec), - UnlinkComments(Vec), -} -impl FileSetParam { - pub fn field(self) -> Field { - match self { - Self::Id(value) => Field { - name: "id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::IdHash(value) => Field { - name: "id_hash".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::Name(value) => Field { - name: "name".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::Extension(value) => Field { - name: "extension".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::Checksum(value) => Field { - name: "checksum".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::SizeInBytes(value) => Field { - name: "size_in_bytes".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::Encryption(value) => Field { - name: "encryption".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::DateCreated(value) => Field { - name: "date_created".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::DateModified(value) => Field { - name: "date_modified".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::DateIndexed(value) => Field { - name: "date_indexed".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::IpfsId(value) => Field { - name: "ipfs_id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LinkFileTags(where_params) => Field { - name: "file_tags".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - list: true, - wrap_list: true, - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkFileTags(where_params) => Field { - name: "file_tags".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - list: true, - wrap_list: true, - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - ..Default::default() - }]), - ..Default::default() - }, - Self::LinkFileLabels(where_params) => Field { - name: "file_labels".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - list: true, - wrap_list: true, - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkFileLabels(where_params) => Field { - name: "file_labels".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - list: true, - wrap_list: true, - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - ..Default::default() - }]), - ..Default::default() - }, - Self::LinkFilePaths(where_params) => Field { - name: "file_paths".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - list: true, - wrap_list: true, - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkFilePaths(where_params) => Field { - name: "file_paths".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - list: true, - wrap_list: true, - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - ..Default::default() - }]), - ..Default::default() - }, - Self::LinkComments(where_params) => Field { - name: "comments".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - list: true, - wrap_list: true, - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkComments(where_params) => Field { - name: "comments".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - list: true, - wrap_list: true, - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - ..Default::default() - }]), - ..Default::default() - }, - } - } -} pub struct FileFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> FileFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> FileDelete<'a> { FileDelete { @@ -6502,7 +14444,7 @@ impl<'a> FileFindMany<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -6522,33 +14464,119 @@ impl<'a> FileFindMany<'a> { method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: FileOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: FileWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: FileCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct FileFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> FileFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: FileWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: FileOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: FileCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct FileFindUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> FileFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> FileDelete<'a> { FileDelete { @@ -6566,7 +14594,7 @@ impl<'a> FileFindUnique<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -6586,45 +14614,107 @@ impl<'a> FileFindUnique<'a> { method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: FileWithParam) -> Self { + self.with_params.push(param); self } } pub struct FileCreateOne<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> FileCreateOne<'a> { - pub async fn exec(self) -> FileData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: FileWithParam) -> Self { + self.with_params.push(param); + self } } pub struct FileUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> FileUpdateUnique<'a> { - pub async fn exec(self) -> FileData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: FileWithParam) -> Self { + self.with_params.push(param); self } } pub struct FileUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> FileUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: FileWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct FileUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> FileUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + size_in_bytes: FileSetSizeInBytes, + partial_checksum: FileSetPartialChecksum, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(FileSetParam::from(size_in_bytes).to_field()); + input_fields.push(FileSetParam::from(partial_checksum).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); self } } @@ -6632,18 +14722,22 @@ pub struct FileDelete<'a> { query: Query<'a>, } impl<'a> FileDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) } } pub struct FileActions<'a> { client: &'a PrismaClient, } impl<'a> FileActions<'a> { - pub fn find_unique(&self, param: FileWhereParam) -> FileFindUnique { - let fields = transform_equals(vec![param.field()]); + pub fn find_unique(&self, param: FileWhereUniqueParam) -> FileFindUnique { + let param: FileWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), @@ -6655,10 +14749,14 @@ impl<'a> FileActions<'a> { ..Default::default() }], }; - FileFindUnique { query } + FileFindUnique { + query, + with_params: vec![], + } } pub fn find_first(&self, params: Vec) -> FileFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -6675,7 +14773,10 @@ impl<'a> FileActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), @@ -6683,10 +14784,15 @@ impl<'a> FileActions<'a> { outputs: file_outputs(), inputs, }; - FileFindFirst { query } + FileFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn find_many(&self, params: Vec) -> FileFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -6697,7 +14803,10 @@ impl<'a> FileActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), @@ -6705,21 +14814,27 @@ impl<'a> FileActions<'a> { outputs: file_outputs(), inputs, }; - FileFindMany { query } + FileFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn create_one( &self, - id_hash: FileSetIdHash, - name: FileSetName, size_in_bytes: FileSetSizeInBytes, + partial_checksum: FileSetPartialChecksum, params: Vec, ) -> FileCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(FileSetParam::from(id_hash).field()); - input_fields.push(FileSetParam::from(name).field()); - input_fields.push(FileSetParam::from(size_in_bytes).field()); + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(FileSetParam::from(size_in_bytes).to_field()); + input_fields.push(FileSetParam::from(partial_checksum).to_field()); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), @@ -6731,63 +14846,105 @@ impl<'a> FileActions<'a> { ..Default::default() }], }; - FileCreateOne { query } + FileCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: FileWhereUniqueParam) -> FileUpsertOne { + let param: FileWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "File".into(), + outputs: file_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + FileUpsertOne { query } } } fn file_path_outputs() -> Vec { vec![ Output::new("id"), Output::new("is_dir"), + Output::new("location_id"), Output::new("materialized_path"), + Output::new("name"), + Output::new("extension"), Output::new("file_id"), Output::new("parent_id"), - Output::new("location_id"), - Output::new("date_indexed"), + Output::new("encryption"), Output::new("permissions"), + Output::new("date_created"), + Output::new("date_modified"), + Output::new("date_indexed"), ] } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct FilePathData { #[serde(rename = "id")] - pub id: i64, + pub id: i32, #[serde(rename = "is_dir")] pub is_dir: bool, + #[serde(rename = "location_id")] + pub location_id: i32, #[serde(rename = "materialized_path")] pub materialized_path: String, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "extension")] + pub extension: Option, #[serde(rename = "file_id")] - pub file_id: Option, - #[serde(rename = "file")] - pub file: Box>, + pub file_id: Option, #[serde(rename = "parent_id")] - pub parent_id: Option, - #[serde(rename = "parent")] - pub parent: Box>, - #[serde(rename = "children")] - children: Option>, - #[serde(rename = "location_id")] - pub location_id: i64, - #[serde(rename = "location")] - pub location: Box>, - #[serde(rename = "date_indexed")] - pub date_indexed: chrono::DateTime, + pub parent_id: Option, + #[serde(rename = "encryption")] + pub encryption: i32, #[serde(rename = "permissions")] pub permissions: Option, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "date_modified")] + pub date_modified: chrono::DateTime, + #[serde(rename = "date_indexed")] + pub date_indexed: chrono::DateTime, + #[serde(rename = "file")] + file: Option>, + #[serde(rename = "location")] + location: Option>, + #[serde(rename = "parent")] + parent: Option>, + #[serde(rename = "children")] + children: Option>, } impl FilePathData { - pub fn file(&self) -> Option<&FileData> { - self.file.as_ref().as_ref() - } - pub fn parent(&self) -> Option<&FilePathData> { - self.parent.as_ref().as_ref() - } - pub fn children(&self) -> Result<&Vec, String> { - match self.children.as_ref() { + pub fn file(&self) -> Result<&FileData, String> { + match self.file.as_ref() { Some(v) => Ok(v), - None => Err("attempted to access children but did not fetch it using the .with() syntax".to_string()), + None => Err( + "Attempted to access file but did not fetch it using the .with() syntax" + .to_string(), + ), } } - pub fn location(&self) -> Option<&LocationData> { - self.location.as_ref().as_ref() + pub fn location(&self) -> Result<&LocationData, String> { + match self . location . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access location but did not fetch it using the .with() syntax" . to_string ()) , } + } + pub fn parent(&self) -> Result<&FilePathData, String> { + match self . parent . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access parent but did not fetch it using the .with() syntax" . to_string ()) , } + } + pub fn children(&self) -> Result<&Vec, String> { + match self . children . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access children but did not fetch it using the .with() syntax" . to_string ()) , } } } pub struct FilePath; @@ -6798,17 +14955,44 @@ impl FilePath { pub fn is_dir() -> FilePathIsDirField { FilePathIsDirField {} } + pub fn location_id() -> FilePathLocationIdField { + FilePathLocationIdField {} + } pub fn materialized_path() -> FilePathMaterializedPathField { FilePathMaterializedPathField {} } + pub fn name() -> FilePathNameField { + FilePathNameField {} + } + pub fn extension() -> FilePathExtensionField { + FilePathExtensionField {} + } pub fn file_id() -> FilePathFileIdField { FilePathFileIdField {} } + pub fn parent_id() -> FilePathParentIdField { + FilePathParentIdField {} + } + pub fn encryption() -> FilePathEncryptionField { + FilePathEncryptionField {} + } + pub fn permissions() -> FilePathPermissionsField { + FilePathPermissionsField {} + } + pub fn date_created() -> FilePathDateCreatedField { + FilePathDateCreatedField {} + } + pub fn date_modified() -> FilePathDateModifiedField { + FilePathDateModifiedField {} + } + pub fn date_indexed() -> FilePathDateIndexedField { + FilePathDateIndexedField {} + } pub fn file() -> FilePathFileField { FilePathFileField {} } - pub fn parent_id() -> FilePathParentIdField { - FilePathParentIdField {} + pub fn location() -> FilePathLocationField { + FilePathLocationField {} } pub fn parent() -> FilePathParentField { FilePathParentField {} @@ -6816,352 +15000,1527 @@ impl FilePath { pub fn children() -> FilePathChildrenField { FilePathChildrenField {} } - pub fn location_id() -> FilePathLocationIdField { - FilePathLocationIdField {} - } - pub fn location() -> FilePathLocationField { - FilePathLocationField {} - } - pub fn date_indexed() -> FilePathDateIndexedField { - FilePathDateIndexedField {} - } - pub fn permissions() -> FilePathPermissionsField { - FilePathPermissionsField {} - } } pub struct FilePathIdField {} -pub struct FilePathSetId(i64); -impl From for FilePathSetParam { - fn from(value: FilePathSetId) -> Self { - Self::Id(value.0) +impl FilePathIdField { + pub fn set>(&self, value: i32) -> T { + FilePathSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + FilePathWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> FilePathCursor { + FilePathCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::IdGte(value) } } -impl FilePathIdField { - pub fn lt(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - FilePathSetId(value).into() +pub struct FilePathSetId(i32); +impl From for FilePathSetParam { + fn from(value: FilePathSetId) -> Self { + Self::SetId(value.0) } } pub struct FilePathIsDirField {} -pub struct FilePathSetIsDir(bool); -impl From for FilePathSetParam { - fn from(value: FilePathSetIsDir) -> Self { - Self::IsDir(value.0) - } -} impl FilePathIsDirField { - pub fn equals(&self, value: bool) -> FilePathWhereParam { - FilePathWhereParam::IsDirEquals(value) - } pub fn set>(&self, value: bool) -> T { FilePathSetIsDir(value).into() } -} -pub struct FilePathMaterializedPathField {} -pub struct FilePathSetMaterializedPath(String); -impl From for FilePathSetParam { - fn from(value: FilePathSetMaterializedPath) -> Self { - Self::MaterializedPath(value.0) + pub fn equals(&self, value: bool) -> FilePathWhereParam { + FilePathWhereParam::IsDirEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::IsDir(direction) + } + pub fn cursor(&self, cursor: bool) -> FilePathCursor { + FilePathCursor::IsDir(cursor) } } +pub struct FilePathSetIsDir(bool); +impl From for FilePathSetParam { + fn from(value: FilePathSetIsDir) -> Self { + Self::SetIsDir(value.0) + } +} +pub struct FilePathLocationIdField {} +impl FilePathLocationIdField { + pub fn set>(&self, value: i32) -> T { + FilePathSetLocationId(value).into() + } + pub fn equals(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::LocationId(direction) + } + pub fn cursor(&self, cursor: i32) -> FilePathCursor { + FilePathCursor::LocationId(cursor) + } + pub fn increment(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::LocationId(value) + } + pub fn decrement(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::LocationId(value) + } + pub fn multiply(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::LocationId(value) + } + pub fn divide(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::LocationId(value) + } + pub fn in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::LocationIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::LocationIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdGte(value) + } + pub fn not(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdNot(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::LocationIdGte(value) + } +} +pub struct FilePathSetLocationId(i32); +impl From for FilePathSetParam { + fn from(value: FilePathSetLocationId) -> Self { + Self::SetLocationId(value.0) + } +} +pub struct FilePathMaterializedPathField {} impl FilePathMaterializedPathField { + pub fn set>(&self, value: String) -> T { + FilePathSetMaterializedPath(value).into() + } + pub fn equals(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::MaterializedPath(direction) + } + pub fn cursor(&self, cursor: String) -> FilePathCursor { + FilePathCursor::MaterializedPath(cursor) + } + pub fn in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathNotInVec(value) + } + pub fn lt(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathLt(value) + } + pub fn lte(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathLte(value) + } + pub fn gt(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathGt(value) + } + pub fn gte(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathGte(value) + } pub fn contains(&self, value: String) -> FilePathWhereParam { FilePathWhereParam::MaterializedPathContains(value) } + pub fn starts_with(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathStartsWith(value) + } + pub fn ends_with(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathEndsWith(value) + } + pub fn not(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::MaterializedPathNot(value) + } pub fn has_prefix(&self, value: String) -> FilePathWhereParam { FilePathWhereParam::MaterializedPathHasPrefix(value) } pub fn has_suffix(&self, value: String) -> FilePathWhereParam { FilePathWhereParam::MaterializedPathHasSuffix(value) } - pub fn equals(&self, value: String) -> FilePathWhereParam { - FilePathWhereParam::MaterializedPathEquals(value) +} +pub struct FilePathSetMaterializedPath(String); +impl From for FilePathSetParam { + fn from(value: FilePathSetMaterializedPath) -> Self { + Self::SetMaterializedPath(value.0) } - pub fn set>(&self, value: String) -> T { - FilePathSetMaterializedPath(value).into() +} +pub struct FilePathNameField {} +impl FilePathNameField { + pub fn set>(&self, value: String) -> T { + FilePathSetName(value).into() + } + pub fn equals(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::Name(direction) + } + pub fn cursor(&self, cursor: String) -> FilePathCursor { + FilePathCursor::Name(cursor) + } + pub fn in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::NameInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::NameNotInVec(value) + } + pub fn lt(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameLt(value) + } + pub fn lte(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameLte(value) + } + pub fn gt(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameGt(value) + } + pub fn gte(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameGte(value) + } + pub fn contains(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameContains(value) + } + pub fn starts_with(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameStartsWith(value) + } + pub fn ends_with(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameEndsWith(value) + } + pub fn not(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameNot(value) + } + pub fn has_prefix(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::NameHasSuffix(value) + } +} +pub struct FilePathSetName(String); +impl From for FilePathSetParam { + fn from(value: FilePathSetName) -> Self { + Self::SetName(value.0) + } +} +pub struct FilePathExtensionField {} +impl FilePathExtensionField { + pub fn set>(&self, value: String) -> T { + FilePathSetExtension(value).into() + } + pub fn equals(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::Extension(direction) + } + pub fn cursor(&self, cursor: String) -> FilePathCursor { + FilePathCursor::Extension(cursor) + } + pub fn in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::ExtensionInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::ExtensionNotInVec(value) + } + pub fn lt(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionLt(value) + } + pub fn lte(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionLte(value) + } + pub fn gt(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionGt(value) + } + pub fn gte(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionGte(value) + } + pub fn contains(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionContains(value) + } + pub fn starts_with(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionStartsWith(value) + } + pub fn ends_with(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionEndsWith(value) + } + pub fn not(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionNot(value) + } + pub fn has_prefix(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::ExtensionHasSuffix(value) + } +} +pub struct FilePathSetExtension(String); +impl From for FilePathSetParam { + fn from(value: FilePathSetExtension) -> Self { + Self::SetExtension(value.0) } } pub struct FilePathFileIdField {} -pub struct FilePathSetFileId(i64); -impl From for FilePathSetParam { - fn from(value: FilePathSetFileId) -> Self { - Self::FileId(value.0) - } -} impl FilePathFileIdField { - pub fn lt(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::FileIdLT(value) - } - pub fn gt(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::FileIdGT(value) - } - pub fn lte(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::FileIdLTE(value) - } - pub fn gte(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::FileIdGTE(value) - } - pub fn equals(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::FileIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { + pub fn set>(&self, value: i32) -> T { FilePathSetFileId(value).into() } -} -pub struct FilePathFileField {} -pub struct FilePathLinkFile(FileWhereParam); -impl From for FilePathSetParam { - fn from(value: FilePathLinkFile) -> Self { - Self::LinkFile(value.0) + pub fn equals(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::FileId(direction) + } + pub fn cursor(&self, cursor: i32) -> FilePathCursor { + FilePathCursor::FileId(cursor) + } + pub fn increment(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::FileId(value) + } + pub fn decrement(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::FileId(value) + } + pub fn multiply(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::FileId(value) + } + pub fn divide(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::FileId(value) + } + pub fn in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::FileIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::FileIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdGte(value) + } + pub fn not(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdNot(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::FileIdGte(value) } } -impl FilePathFileField { - pub fn is(&self, value: Vec) -> FilePathWhereParam { - FilePathWhereParam::FileIs(value) - } - pub fn link>(&self, value: FileWhereParam) -> T { - FilePathLinkFile(value).into() - } - pub fn fetch(&self) -> FilePathWith { - FilePathWithParam::File.into() - } - pub fn unlink(&self) -> FilePathSetParam { - FilePathSetParam::UnlinkFile +pub struct FilePathSetFileId(i32); +impl From for FilePathSetParam { + fn from(value: FilePathSetFileId) -> Self { + Self::SetFileId(value.0) } } pub struct FilePathParentIdField {} -pub struct FilePathSetParentId(i64); -impl From for FilePathSetParam { - fn from(value: FilePathSetParentId) -> Self { - Self::ParentId(value.0) - } -} impl FilePathParentIdField { - pub fn lt(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::ParentIdLT(value) - } - pub fn gt(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::ParentIdGT(value) - } - pub fn lte(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::ParentIdLTE(value) - } - pub fn gte(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::ParentIdGTE(value) - } - pub fn equals(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::ParentIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { + pub fn set>(&self, value: i32) -> T { FilePathSetParentId(value).into() } -} -pub struct FilePathParentField {} -pub struct FilePathLinkParent(FilePathWhereParam); -impl From for FilePathSetParam { - fn from(value: FilePathLinkParent) -> Self { - Self::LinkParent(value.0) + pub fn equals(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::ParentId(direction) + } + pub fn cursor(&self, cursor: i32) -> FilePathCursor { + FilePathCursor::ParentId(cursor) + } + pub fn increment(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::ParentId(value) + } + pub fn decrement(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::ParentId(value) + } + pub fn multiply(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::ParentId(value) + } + pub fn divide(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::ParentId(value) + } + pub fn in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::ParentIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::ParentIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdGte(value) + } + pub fn not(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdNot(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::ParentIdGte(value) } } -impl FilePathParentField { - pub fn is(&self, value: Vec) -> FilePathWhereParam { - FilePathWhereParam::ParentIs(value) - } - pub fn link>(&self, value: FilePathWhereParam) -> T { - FilePathLinkParent(value).into() - } - pub fn fetch(&self) -> FilePathWith { - FilePathWithParam::Parent.into() - } - pub fn unlink(&self) -> FilePathSetParam { - FilePathSetParam::UnlinkParent +pub struct FilePathSetParentId(i32); +impl From for FilePathSetParam { + fn from(value: FilePathSetParentId) -> Self { + Self::SetParentId(value.0) } } -pub struct FilePathChildrenField {} -pub struct FilePathLinkChildren(Vec); -impl From for FilePathSetParam { - fn from(value: FilePathLinkChildren) -> Self { - Self::LinkChildren(value.0.into_iter().map(|v| v.into()).collect()) +pub struct FilePathEncryptionField {} +impl FilePathEncryptionField { + pub fn set>(&self, value: i32) -> T { + FilePathSetEncryption(value).into() + } + pub fn equals(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::Encryption(direction) + } + pub fn cursor(&self, cursor: i32) -> FilePathCursor { + FilePathCursor::Encryption(cursor) + } + pub fn increment(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::Encryption(value) + } + pub fn decrement(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::Encryption(value) + } + pub fn multiply(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::Encryption(value) + } + pub fn divide(&self, value: i32) -> FilePathSetParam { + FilePathSetParam::Encryption(value) + } + pub fn in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::EncryptionInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::EncryptionNotInVec(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionGte(value) + } + pub fn not(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionNot(value) + } + pub fn lt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> FilePathWhereParam { + FilePathWhereParam::EncryptionGte(value) } } -impl FilePathChildrenField { - pub fn some(&self, value: Vec) -> FilePathWhereParam { - FilePathWhereParam::ChildrenSome(value) - } - pub fn every(&self, value: Vec) -> FilePathWhereParam { - FilePathWhereParam::ChildrenEvery(value) - } - pub fn link>(&self, value: Vec) -> T { - FilePathLinkChildren(value).into() - } - pub fn unlink(&self, params: Vec) -> FilePathSetParam { - FilePathSetParam::UnlinkChildren(params) - } - pub fn fetch(&self, params: Vec) -> FilePathWith { - FilePathWithParam::Children(params).into() - } -} -pub struct FilePathLocationIdField {} -pub struct FilePathSetLocationId(i64); -impl From for FilePathSetParam { - fn from(value: FilePathSetLocationId) -> Self { - Self::LocationId(value.0) - } -} -impl FilePathLocationIdField { - pub fn lt(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::LocationIdLT(value) - } - pub fn gt(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::LocationIdGT(value) - } - pub fn lte(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::LocationIdLTE(value) - } - pub fn gte(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::LocationIdGTE(value) - } - pub fn equals(&self, value: i64) -> FilePathWhereParam { - FilePathWhereParam::LocationIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - FilePathSetLocationId(value).into() - } -} -pub struct FilePathLocationField {} -pub struct FilePathLinkLocation(LocationWhereParam); -impl From for FilePathSetParam { - fn from(value: FilePathLinkLocation) -> Self { - Self::LinkLocation(value.0) - } -} -impl FilePathLocationField { - pub fn is(&self, value: Vec) -> FilePathWhereParam { - FilePathWhereParam::LocationIs(value) - } - pub fn link>(&self, value: LocationWhereParam) -> T { - FilePathLinkLocation(value).into() - } - pub fn fetch(&self) -> FilePathWith { - FilePathWithParam::Location.into() - } - pub fn unlink(&self) -> FilePathSetParam { - FilePathSetParam::UnlinkLocation - } -} -pub struct FilePathDateIndexedField {} -pub struct FilePathSetDateIndexed(chrono::DateTime); -impl From for FilePathSetParam { - fn from(value: FilePathSetDateIndexed) -> Self { - Self::DateIndexed(value.0) - } -} -impl FilePathDateIndexedField { - pub fn before(&self, value: chrono::DateTime) -> FilePathWhereParam { - FilePathWhereParam::DateIndexedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> FilePathWhereParam { - FilePathWhereParam::DateIndexedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> FilePathWhereParam { - FilePathWhereParam::DateIndexedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> FilePathWhereParam { - FilePathWhereParam::DateIndexedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> FilePathWhereParam { - FilePathWhereParam::DateIndexedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - FilePathSetDateIndexed(value).into() +pub struct FilePathSetEncryption(i32); +impl From for FilePathSetParam { + fn from(value: FilePathSetEncryption) -> Self { + Self::SetEncryption(value.0) } } pub struct FilePathPermissionsField {} -pub struct FilePathSetPermissions(String); -impl From for FilePathSetParam { - fn from(value: FilePathSetPermissions) -> Self { - Self::Permissions(value.0) - } -} impl FilePathPermissionsField { + pub fn set>(&self, value: String) -> T { + FilePathSetPermissions(value).into() + } + pub fn equals(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::PermissionsEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::Permissions(direction) + } + pub fn cursor(&self, cursor: String) -> FilePathCursor { + FilePathCursor::Permissions(cursor) + } + pub fn in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::PermissionsInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::PermissionsNotInVec(value) + } + pub fn lt(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::PermissionsLt(value) + } + pub fn lte(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::PermissionsLte(value) + } + pub fn gt(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::PermissionsGt(value) + } + pub fn gte(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::PermissionsGte(value) + } pub fn contains(&self, value: String) -> FilePathWhereParam { FilePathWhereParam::PermissionsContains(value) } + pub fn starts_with(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::PermissionsStartsWith(value) + } + pub fn ends_with(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::PermissionsEndsWith(value) + } + pub fn not(&self, value: String) -> FilePathWhereParam { + FilePathWhereParam::PermissionsNot(value) + } pub fn has_prefix(&self, value: String) -> FilePathWhereParam { FilePathWhereParam::PermissionsHasPrefix(value) } pub fn has_suffix(&self, value: String) -> FilePathWhereParam { FilePathWhereParam::PermissionsHasSuffix(value) } - pub fn equals(&self, value: String) -> FilePathWhereParam { - FilePathWhereParam::PermissionsEquals(value) +} +pub struct FilePathSetPermissions(String); +impl From for FilePathSetParam { + fn from(value: FilePathSetPermissions) -> Self { + Self::SetPermissions(value.0) } - pub fn set>(&self, value: String) -> T { - FilePathSetPermissions(value).into() +} +pub struct FilePathDateCreatedField {} +impl FilePathDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + FilePathSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> FilePathCursor { + FilePathCursor::DateCreated(cursor) + } + pub fn in_vec( + &self, + value: Vec>, + ) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedAfter(value) + } + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> FilePathWhereParam { + FilePathWhereParam::DateCreatedAfterEquals(value) + } +} +pub struct FilePathSetDateCreated(chrono::DateTime); +impl From for FilePathSetParam { + fn from(value: FilePathSetDateCreated) -> Self { + Self::SetDateCreated(value.0) + } +} +pub struct FilePathDateModifiedField {} +impl FilePathDateModifiedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + FilePathSetDateModified(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::DateModified(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> FilePathCursor { + FilePathCursor::DateModified(cursor) + } + pub fn in_vec( + &self, + value: Vec>, + ) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedAfter(value) + } + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedBeforeEquals(value) + } + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> FilePathWhereParam { + FilePathWhereParam::DateModifiedAfterEquals(value) + } +} +pub struct FilePathSetDateModified(chrono::DateTime); +impl From for FilePathSetParam { + fn from(value: FilePathSetDateModified) -> Self { + Self::SetDateModified(value.0) + } +} +pub struct FilePathDateIndexedField {} +impl FilePathDateIndexedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + FilePathSetDateIndexed(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> FilePathOrderByParam { + FilePathOrderByParam::DateIndexed(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> FilePathCursor { + FilePathCursor::DateIndexed(cursor) + } + pub fn in_vec( + &self, + value: Vec>, + ) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedAfter(value) + } + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedBeforeEquals(value) + } + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> FilePathWhereParam { + FilePathWhereParam::DateIndexedAfterEquals(value) + } +} +pub struct FilePathSetDateIndexed(chrono::DateTime); +impl From for FilePathSetParam { + fn from(value: FilePathSetDateIndexed) -> Self { + Self::SetDateIndexed(value.0) + } +} +pub struct FilePathFileField {} +impl FilePathFileField { + pub fn is(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::FileIs(value) + } + pub fn fetch(&self) -> FilePathWithParam { + FilePathWithParam::File + } + pub fn link>(&self, value: FileWhereUniqueParam) -> T { + FilePathLinkFile(value).into() + } + pub fn unlink(&self) -> FilePathSetParam { + FilePathSetParam::UnLinkFile + } +} +pub struct FilePathLinkFile(FileWhereUniqueParam); +impl From for FilePathSetParam { + fn from(value: FilePathLinkFile) -> Self { + Self::LinkFile(value.0) + } +} +pub struct FilePathLocationField {} +impl FilePathLocationField { + pub fn is(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::LocationIs(value) + } + pub fn fetch(&self) -> FilePathWithParam { + FilePathWithParam::Location + } + pub fn link>( + &self, + value: LocationWhereUniqueParam, + ) -> T { + FilePathLinkLocation(value).into() + } + pub fn unlink(&self) -> FilePathSetParam { + FilePathSetParam::UnLinkLocation + } +} +pub struct FilePathLinkLocation(LocationWhereUniqueParam); +impl From for FilePathSetParam { + fn from(value: FilePathLinkLocation) -> Self { + Self::LinkLocation(value.0) + } +} +pub struct FilePathParentField {} +impl FilePathParentField { + pub fn is(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::ParentIs(value) + } + pub fn fetch(&self) -> FilePathWithParam { + FilePathWithParam::Parent + } + pub fn link>( + &self, + value: FilePathWhereUniqueParam, + ) -> T { + FilePathLinkParent(value).into() + } + pub fn unlink(&self) -> FilePathSetParam { + FilePathSetParam::UnLinkParent + } +} +pub struct FilePathLinkParent(FilePathWhereUniqueParam); +impl From for FilePathSetParam { + fn from(value: FilePathLinkParent) -> Self { + Self::LinkParent(value.0) + } +} +pub struct FilePathChildrenField {} +impl FilePathChildrenField { + pub fn some(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::ChildrenSome(value) + } + pub fn every(&self, value: Vec) -> FilePathWhereParam { + FilePathWhereParam::ChildrenEvery(value) + } + pub fn fetch(&self, params: Vec) -> FilePathWithParam { + FilePathWithParam::Children(params) + } + pub fn link>( + &self, + params: Vec, + ) -> T { + FilePathLinkChildren(params).into() + } + pub fn unlink(&self, params: Vec) -> FilePathSetParam { + FilePathSetParam::UnLinkChildren(params) + } +} +pub struct FilePathLinkChildren(Vec); +impl From for FilePathSetParam { + fn from(value: FilePathLinkChildren) -> Self { + Self::LinkChildren(value.0) + } +} +pub enum FilePathWithParam { + File, + Location, + Parent, + Children(Vec), +} +impl FilePathWithParam { + pub fn to_output(self) -> Output { + match self { + Self::File => Output { + name: "file".into(), + outputs: file_outputs(), + ..Default::default() + }, + Self::Location => Output { + name: "location".into(), + outputs: location_outputs(), + ..Default::default() + }, + Self::Parent => Output { + name: "parent".into(), + outputs: file_path_outputs(), + ..Default::default() + }, + Self::Children(where_params) => Output { + name: "children".into(), + outputs: file_path_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + } + } +} +pub enum FilePathSetParam { + SetId(i32), + SetIsDir(bool), + SetLocationId(i32), + SetMaterializedPath(String), + SetName(String), + SetExtension(String), + SetFileId(i32), + SetParentId(i32), + SetEncryption(i32), + SetPermissions(String), + SetDateCreated(chrono::DateTime), + SetDateModified(chrono::DateTime), + SetDateIndexed(chrono::DateTime), + LinkFile(FileWhereUniqueParam), + UnLinkFile, + LinkLocation(LocationWhereUniqueParam), + UnLinkLocation, + LinkParent(FilePathWhereUniqueParam), + UnLinkParent, + LinkChildren(Vec), + UnLinkChildren(Vec), +} +impl FilePathSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetIsDir(value) => Field { + name: "is_dir".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetLocationId(value) => Field { + name: "location_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetMaterializedPath(value) => Field { + name: "materialized_path".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetName(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetExtension(value) => Field { + name: "extension".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetFileId(value) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetParentId(value) => Field { + name: "parent_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetEncryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetPermissions(value) => Field { + name: "permissions".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateIndexed(value) => Field { + name: "date_indexed".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkFile(where_param) => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![Into::::into( + where_param, + ) + .to_field()])), + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkFile => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + value: Some(true.into()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LinkLocation(where_param) => Field { + name: "location".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![ + Into::::into(where_param).to_field(), + ])), + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkLocation => Field { + name: "location".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + value: Some(true.into()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LinkParent(where_param) => Field { + name: "parent".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![ + Into::::into(where_param).to_field(), + ])), + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkParent => Field { + name: "parent".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + value: Some(true.into()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LinkChildren(where_params) => Field { + name: "children".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkChildren(where_params) => Field { + name: "children".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum FilePathOrderByParam { + Id(Direction), + IsDir(Direction), + LocationId(Direction), + MaterializedPath(Direction), + Name(Direction), + Extension(Direction), + FileId(Direction), + ParentId(Direction), + Encryption(Direction), + Permissions(Direction), + DateCreated(Direction), + DateModified(Direction), + DateIndexed(Direction), +} +impl FilePathOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::IsDir(direction) => Field { + name: "is_dir".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::LocationId(direction) => Field { + name: "location_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::MaterializedPath(direction) => Field { + name: "materialized_path".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Name(direction) => Field { + name: "name".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Extension(direction) => Field { + name: "extension".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::FileId(direction) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::ParentId(direction) => Field { + name: "parent_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Encryption(direction) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Permissions(direction) => Field { + name: "permissions".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateModified(direction) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateIndexed(direction) => Field { + name: "date_indexed".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum FilePathCursor { + Id(i32), + IsDir(bool), + LocationId(i32), + MaterializedPath(String), + Name(String), + Extension(String), + FileId(i32), + ParentId(i32), + Encryption(i32), + Permissions(String), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), + DateIndexed(chrono::DateTime), +} +impl FilePathCursor { + fn to_field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::IsDir(value) => Field { + name: "is_dir".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LocationId(value) => Field { + name: "location_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::MaterializedPath(value) => Field { + name: "materialized_path".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Extension(value) => Field { + name: "extension".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::FileId(value) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::ParentId(value) => Field { + name: "parent_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Encryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Permissions(value) => Field { + name: "permissions".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateIndexed(value) => Field { + name: "date_indexed".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } } } pub enum FilePathWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), IsDirEquals(bool), + LocationIdEquals(i32), + LocationIdInVec(Vec), + LocationIdNotInVec(Vec), + LocationIdLt(i32), + LocationIdLte(i32), + LocationIdGt(i32), + LocationIdGte(i32), + LocationIdNot(i32), + LocationIdLt(i32), + LocationIdLte(i32), + LocationIdGt(i32), + LocationIdGte(i32), + MaterializedPathEquals(String), + MaterializedPathInVec(Vec), + MaterializedPathNotInVec(Vec), + MaterializedPathLt(String), + MaterializedPathLte(String), + MaterializedPathGt(String), + MaterializedPathGte(String), MaterializedPathContains(String), + MaterializedPathStartsWith(String), + MaterializedPathEndsWith(String), + MaterializedPathNot(String), MaterializedPathHasPrefix(String), MaterializedPathHasSuffix(String), - MaterializedPathEquals(String), - FileIdLT(i64), - FileIdGT(i64), - FileIdLTE(i64), - FileIdGTE(i64), - FileIdEquals(i64), - FileIs(Vec), - ParentIdLT(i64), - ParentIdGT(i64), - ParentIdLTE(i64), - ParentIdGTE(i64), - ParentIdEquals(i64), - ParentIs(Vec), - ChildrenSome(Vec), - ChildrenEvery(Vec), - LocationIdLT(i64), - LocationIdGT(i64), - LocationIdLTE(i64), - LocationIdGTE(i64), - LocationIdEquals(i64), - LocationIs(Vec), + NameEquals(String), + NameInVec(Vec), + NameNotInVec(Vec), + NameLt(String), + NameLte(String), + NameGt(String), + NameGte(String), + NameContains(String), + NameStartsWith(String), + NameEndsWith(String), + NameNot(String), + NameHasPrefix(String), + NameHasSuffix(String), + ExtensionEquals(String), + ExtensionInVec(Vec), + ExtensionNotInVec(Vec), + ExtensionLt(String), + ExtensionLte(String), + ExtensionGt(String), + ExtensionGte(String), + ExtensionContains(String), + ExtensionStartsWith(String), + ExtensionEndsWith(String), + ExtensionNot(String), + ExtensionHasPrefix(String), + ExtensionHasSuffix(String), + FileIdEquals(i32), + FileIdInVec(Vec), + FileIdNotInVec(Vec), + FileIdLt(i32), + FileIdLte(i32), + FileIdGt(i32), + FileIdGte(i32), + FileIdNot(i32), + FileIdLt(i32), + FileIdLte(i32), + FileIdGt(i32), + FileIdGte(i32), + ParentIdEquals(i32), + ParentIdInVec(Vec), + ParentIdNotInVec(Vec), + ParentIdLt(i32), + ParentIdLte(i32), + ParentIdGt(i32), + ParentIdGte(i32), + ParentIdNot(i32), + ParentIdLt(i32), + ParentIdLte(i32), + ParentIdGt(i32), + ParentIdGte(i32), + EncryptionEquals(i32), + EncryptionInVec(Vec), + EncryptionNotInVec(Vec), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + EncryptionNot(i32), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + PermissionsEquals(String), + PermissionsInVec(Vec), + PermissionsNotInVec(Vec), + PermissionsLt(String), + PermissionsLte(String), + PermissionsGt(String), + PermissionsGte(String), + PermissionsContains(String), + PermissionsStartsWith(String), + PermissionsEndsWith(String), + PermissionsNot(String), + PermissionsHasPrefix(String), + PermissionsHasSuffix(String), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + DateModifiedInVec(Vec>), + DateModifiedNotInVec(Vec>), + DateModifiedLt(chrono::DateTime), + DateModifiedLte(chrono::DateTime), + DateModifiedGt(chrono::DateTime), + DateModifiedGte(chrono::DateTime), + DateModifiedNot(chrono::DateTime), + DateModifiedBefore(chrono::DateTime), + DateModifiedAfter(chrono::DateTime), + DateModifiedBeforeEquals(chrono::DateTime), + DateModifiedAfterEquals(chrono::DateTime), + DateIndexedEquals(chrono::DateTime), + DateIndexedInVec(Vec>), + DateIndexedNotInVec(Vec>), + DateIndexedLt(chrono::DateTime), + DateIndexedLte(chrono::DateTime), + DateIndexedGt(chrono::DateTime), + DateIndexedGte(chrono::DateTime), + DateIndexedNot(chrono::DateTime), DateIndexedBefore(chrono::DateTime), DateIndexedAfter(chrono::DateTime), DateIndexedBeforeEquals(chrono::DateTime), DateIndexedAfterEquals(chrono::DateTime), - DateIndexedEquals(chrono::DateTime), - PermissionsContains(String), - PermissionsHasPrefix(String), - PermissionsHasSuffix(String), - PermissionsEquals(String), - Not(Vec), - Or(Vec), - And(Vec), + FileIs(Vec), + LocationIs(Vec), + ParentIs(Vec), + ChildrenSome(Vec), + ChildrenEvery(Vec), } impl FilePathWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { name: "id".into(), fields: Some(vec![Field { name: "lt".into(), @@ -7170,16 +16529,7 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdLTE(value) => Field { + Self::IdLte(value) => Field { name: "id".into(), fields: Some(vec![Field { name: "lte".into(), @@ -7188,7 +16538,16 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::IdGTE(value) => Field { + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { name: "id".into(), fields: Some(vec![Field { name: "gte".into(), @@ -7197,10 +16556,46 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::IdEquals(value) => Field { + Self::IdNot(value) => Field { name: "id".into(), fields: Some(vec![Field { - name: "equals".into(), + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }]), @@ -7215,6 +16610,213 @@ impl FilePathWhereParam { }]), ..Default::default() }, + Self::LocationIdEquals(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdInVec(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdNotInVec(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdLt(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdLte(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdGt(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdGte(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdNot(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdLt(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdLte(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdGt(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LocationIdGte(value) => Field { + name: "location_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathEquals(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathInVec(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathNotInVec(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathLt(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathLte(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathGt(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathGte(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::MaterializedPathContains(value) => Field { name: "materialized_path".into(), fields: Some(vec![Field { @@ -7224,6 +16826,33 @@ impl FilePathWhereParam { }]), ..Default::default() }, + Self::MaterializedPathStartsWith(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathEndsWith(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::MaterializedPathNot(value) => Field { + name: "materialized_path".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::MaterializedPathHasPrefix(value) => Field { name: "materialized_path".into(), fields: Some(vec![Field { @@ -7242,8 +16871,8 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::MaterializedPathEquals(value) => Field { - name: "materialized_path".into(), + Self::NameEquals(value) => Field { + name: "name".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7251,8 +16880,44 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::FileIdLT(value) => Field { - name: "file_id".into(), + Self::NameInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNotInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLt(value) => Field { + name: "name".into(), fields: Some(vec![Field { name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7260,17 +16925,8 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::FileIdGT(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdLTE(value) => Field { - name: "file_id".into(), + Self::NameLte(value) => Field { + name: "name".into(), fields: Some(vec![Field { name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7278,8 +16934,17 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::FileIdGTE(value) => Field { - name: "file_id".into(), + Self::NameGt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGte(value) => Field { + name: "name".into(), fields: Some(vec![Field { name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7287,6 +16952,195 @@ impl FilePathWhereParam { }]), ..Default::default() }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameStartsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEndsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNot(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionEquals(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionInVec(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionNotInVec(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionLt(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionLte(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionGt(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionGte(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionContains(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionStartsWith(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionEndsWith(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionNot(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionHasPrefix(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ExtensionHasSuffix(value) => Field { + name: "extension".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::FileIdEquals(value) => Field { name: "file_id".into(), fields: Some(vec![Field { @@ -7296,17 +17150,44 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::FileIs(value) => Field { - name: "file".into(), + Self::FileIdInVec(value) => Field { + name: "file_id".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::ParentIdLT(value) => Field { - name: "parent_id".into(), + Self::FileIdNotInVec(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLt(value) => Field { + name: "file_id".into(), fields: Some(vec![Field { name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7314,17 +17195,8 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::ParentIdGT(value) => Field { - name: "parent_id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ParentIdLTE(value) => Field { - name: "parent_id".into(), + Self::FileIdLte(value) => Field { + name: "file_id".into(), fields: Some(vec![Field { name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7332,8 +17204,62 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::ParentIdGTE(value) => Field { - name: "parent_id".into(), + Self::FileIdGt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdNot(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGte(value) => Field { + name: "file_id".into(), fields: Some(vec![Field { name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7350,35 +17276,44 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::ParentIs(value) => Field { - name: "parent".into(), + Self::ParentIdInVec(value) => Field { + name: "parent_id".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::ChildrenSome(value) => Field { - name: "children".into(), + Self::ParentIdNotInVec(value) => Field { + name: "parent_id".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::ChildrenEvery(value) => Field { - name: "children".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LocationIdLT(value) => Field { - name: "location_id".into(), + Self::ParentIdLt(value) => Field { + name: "parent_id".into(), fields: Some(vec![Field { name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7386,17 +17321,8 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::LocationIdGT(value) => Field { - name: "location_id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LocationIdLTE(value) => Field { - name: "location_id".into(), + Self::ParentIdLte(value) => Field { + name: "parent_id".into(), fields: Some(vec![Field { name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7404,8 +17330,17 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::LocationIdGTE(value) => Field { - name: "location_id".into(), + Self::ParentIdGt(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdGte(value) => Field { + name: "parent_id".into(), fields: Some(vec![Field { name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7413,8 +17348,53 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::LocationIdEquals(value) => Field { - name: "location_id".into(), + Self::ParentIdNot(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdLt(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdLte(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdGt(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ParentIdGte(value) => Field { + name: "parent_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionEquals(value) => Field { + name: "encryption".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -7422,11 +17402,596 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::LocationIs(value) => Field { - name: "location".into(), + Self::EncryptionInVec(value) => Field { + name: "encryption".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNotInVec(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNot(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsEquals(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsInVec(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsNotInVec(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsLt(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsLte(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsGt(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsGte(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsContains(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsStartsWith(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsEndsWith(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsNot(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsHasPrefix(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::PermissionsHasSuffix(value) => Field { + name: "permissions".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNotInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNot(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBefore(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfter(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBeforeEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfterEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedEquals(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedInVec(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedNotInVec(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedLt(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedLte(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedGt(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedGte(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateIndexedNot(value) => Field { + name: "date_indexed".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }]), ..Default::default() @@ -7467,72 +18032,61 @@ impl FilePathWhereParam { }]), ..Default::default() }, - Self::DateIndexedEquals(value) => Field { - name: "date_indexed".into(), + Self::FileIs(value) => Field { + name: "file".into(), fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "is".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() }, - Self::PermissionsContains(value) => Field { - name: "permissions".into(), + Self::LocationIs(value) => Field { + name: "location".into(), fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "is".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() }, - Self::PermissionsHasPrefix(value) => Field { - name: "permissions".into(), + Self::ParentIs(value) => Field { + name: "parent".into(), fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "is".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() }, - Self::PermissionsHasSuffix(value) => Field { - name: "permissions".into(), + Self::ChildrenSome(value) => Field { + name: "children".into(), fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "some".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() }, - Self::PermissionsEquals(value) => Field { - name: "permissions".into(), + Self::ChildrenEvery(value) => Field { + name: "children".into(), fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "every".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, + } + } +} +pub enum FilePathWhereUniqueParam { + IdEquals(i32), +} +impl From for FilePathWhereParam { + fn from(value: FilePathWhereUniqueParam) -> Self { + match value { + FilePathWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), } } } @@ -7545,205 +18099,32 @@ impl From> for FilePathWhereParam { } } } -pub struct FilePathWith { - pub param: FilePathWithParam, -} -pub enum FilePathWithParam { - File, - Parent, - Children(Vec), - Location, -} -impl From for FilePathWith { - fn from(param: FilePathWithParam) -> Self { - Self { param } - } -} -impl FilePathWithParam { - pub fn output(self) -> Output { - match self { - Self::File => Output { - name: "file".into(), - outputs: file_outputs(), - ..Default::default() - }, - Self::Parent => Output { - name: "parent".into(), - outputs: file_path_outputs(), - ..Default::default() - }, - Self::Children(where_params) => Output { - name: "children".into(), - outputs: file_path_outputs(), - inputs: if where_params.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_params.into_iter().map(|f| f.field()).collect(), - ..Default::default() - }] - } else { - vec![] - }, - ..Default::default() - }, - Self::Location => Output { - name: "location".into(), - outputs: location_outputs(), - ..Default::default() - }, - } - } -} -pub enum FilePathSetParam { - Id(i64), - IsDir(bool), - MaterializedPath(String), - FileId(i64), - LinkFile(FileWhereParam), - UnlinkFile, - ParentId(i64), - LinkParent(FilePathWhereParam), - UnlinkParent, - LinkChildren(Vec), - UnlinkChildren(Vec), - LocationId(i64), - LinkLocation(LocationWhereParam), - UnlinkLocation, - DateIndexed(chrono::DateTime), - Permissions(String), -} -impl FilePathSetParam { - pub fn field(self) -> Field { - match self { - Self::Id(value) => Field { - name: "id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::IsDir(value) => Field { - name: "is_dir".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::MaterializedPath(value) => Field { - name: "materialized_path".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::FileId(value) => Field { - name: "file_id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LinkFile(where_param) => Field { - name: "file".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals(vec![where_param.field()])), - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkFile => Field { - name: "file".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - value: Some(true.into()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ParentId(value) => Field { - name: "parent_id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LinkParent(where_param) => Field { - name: "parent".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals(vec![where_param.field()])), - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkParent => Field { - name: "parent".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - value: Some(true.into()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LinkChildren(where_params) => Field { - name: "children".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - list: true, - wrap_list: true, - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkChildren(where_params) => Field { - name: "children".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - list: true, - wrap_list: true, - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - ..Default::default() - }]), - ..Default::default() - }, - Self::LocationId(value) => Field { - name: "location_id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LinkLocation(where_param) => Field { - name: "location".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals(vec![where_param.field()])), - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkLocation => Field { - name: "location".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - value: Some(true.into()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateIndexed(value) => Field { - name: "date_indexed".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::Permissions(value) => Field { - name: "permissions".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - } - } -} pub struct FilePathFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> FilePathFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> FilePathDelete<'a> { FilePathDelete { @@ -7762,7 +18143,7 @@ impl<'a> FilePathFindMany<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -7782,33 +18163,119 @@ impl<'a> FilePathFindMany<'a> { method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: FilePathOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: FilePathWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: FilePathCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct FilePathFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> FilePathFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: FilePathWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: FilePathOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: FilePathCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct FilePathFindUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> FilePathFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> FilePathDelete<'a> { FilePathDelete { @@ -7826,7 +18293,7 @@ impl<'a> FilePathFindUnique<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -7846,45 +18313,107 @@ impl<'a> FilePathFindUnique<'a> { method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: FilePathWithParam) -> Self { + self.with_params.push(param); self } } pub struct FilePathCreateOne<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> FilePathCreateOne<'a> { - pub async fn exec(self) -> FilePathData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: FilePathWithParam) -> Self { + self.with_params.push(param); + self } } pub struct FilePathUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> FilePathUpdateUnique<'a> { - pub async fn exec(self) -> FilePathData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: FilePathWithParam) -> Self { + self.with_params.push(param); self } } pub struct FilePathUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> FilePathUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: FilePathWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct FilePathUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> FilePathUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + materialized_path: FilePathSetMaterializedPath, + name: FilePathSetName, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(FilePathSetParam::from(materialized_path).to_field()); + input_fields.push(FilePathSetParam::from(name).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); self } } @@ -7892,18 +18421,22 @@ pub struct FilePathDelete<'a> { query: Query<'a>, } impl<'a> FilePathDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) } } pub struct FilePathActions<'a> { client: &'a PrismaClient, } impl<'a> FilePathActions<'a> { - pub fn find_unique(&self, param: FilePathWhereParam) -> FilePathFindUnique { - let fields = transform_equals(vec![param.field()]); + pub fn find_unique(&self, param: FilePathWhereUniqueParam) -> FilePathFindUnique { + let param: FilePathWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), @@ -7915,10 +18448,14 @@ impl<'a> FilePathActions<'a> { ..Default::default() }], }; - FilePathFindUnique { query } + FilePathFindUnique { + query, + with_params: vec![], + } } pub fn find_first(&self, params: Vec) -> FilePathFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -7935,7 +18472,10 @@ impl<'a> FilePathActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), @@ -7943,10 +18483,15 @@ impl<'a> FilePathActions<'a> { outputs: file_path_outputs(), inputs, }; - FilePathFindFirst { query } + FilePathFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn find_many(&self, params: Vec) -> FilePathFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -7957,7 +18502,10 @@ impl<'a> FilePathActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), @@ -7965,17 +18513,27 @@ impl<'a> FilePathActions<'a> { outputs: file_path_outputs(), inputs, }; - FilePathFindMany { query } + FilePathFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn create_one( &self, materialized_path: FilePathSetMaterializedPath, + name: FilePathSetName, params: Vec, ) -> FilePathCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(FilePathSetParam::from(materialized_path).field()); + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(FilePathSetParam::from(materialized_path).to_field()); + input_fields.push(FilePathSetParam::from(name).to_field()); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), @@ -7987,7 +18545,31 @@ impl<'a> FilePathActions<'a> { ..Default::default() }], }; - FilePathCreateOne { query } + FilePathCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: FilePathWhereUniqueParam) -> FilePathUpsertOne { + let param: FilePathWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "FilePath".into(), + outputs: file_path_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + FilePathUpsertOne { query } } } fn tag_outputs() -> Vec { @@ -8004,15 +18586,15 @@ fn tag_outputs() -> Vec { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct TagData { #[serde(rename = "id")] - pub id: i64, + pub id: i32, #[serde(rename = "name")] pub name: Option, #[serde(rename = "encryption")] - pub encryption: Option, + pub encryption: Option, #[serde(rename = "total_files")] - pub total_files: Option, + pub total_files: Option, #[serde(rename = "redundancy_goal")] - pub redundancy_goal: Option, + pub redundancy_goal: Option, #[serde(rename = "date_created")] pub date_created: chrono::DateTime, #[serde(rename = "date_modified")] @@ -8022,10 +18604,7 @@ pub struct TagData { } impl TagData { pub fn tag_files(&self) -> Result<&Vec, String> { - match self.tag_files.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access tag_files but did not fetch it using the .with() syntax".to_string()), - } + match self . tag_files . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access tag_files but did not fetch it using the .with() syntax" . to_string ()) , } } } pub struct Tag; @@ -8056,145 +18635,364 @@ impl Tag { } } pub struct TagIdField {} -pub struct TagSetId(i64); -impl From for TagSetParam { - fn from(value: TagSetId) -> Self { - Self::Id(value.0) +impl TagIdField { + pub fn set>(&self, value: i32) -> T { + TagSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + TagWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOrderByParam { + TagOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> TagCursor { + TagCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> TagSetParam { + TagSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> TagSetParam { + TagSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> TagSetParam { + TagSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> TagSetParam { + TagSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> TagWhereParam { + TagWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> TagWhereParam { + TagWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> TagWhereParam { + TagWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> TagWhereParam { + TagWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> TagWhereParam { + TagWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> TagWhereParam { + TagWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> TagWhereParam { + TagWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> TagWhereParam { + TagWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> TagWhereParam { + TagWhereParam::IdGte(value) } } -impl TagIdField { - pub fn lt(&self, value: i64) -> TagWhereParam { - TagWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> TagWhereParam { - TagWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> TagWhereParam { - TagWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> TagWhereParam { - TagWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> TagWhereParam { - TagWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - TagSetId(value).into() +pub struct TagSetId(i32); +impl From for TagSetParam { + fn from(value: TagSetId) -> Self { + Self::SetId(value.0) } } pub struct TagNameField {} -pub struct TagSetName(String); -impl From for TagSetParam { - fn from(value: TagSetName) -> Self { - Self::Name(value.0) - } -} impl TagNameField { + pub fn set>(&self, value: String) -> T { + TagSetName(value).into() + } + pub fn equals(&self, value: String) -> TagWhereParam { + TagWhereParam::NameEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOrderByParam { + TagOrderByParam::Name(direction) + } + pub fn cursor(&self, cursor: String) -> TagCursor { + TagCursor::Name(cursor) + } + pub fn in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::NameInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::NameNotInVec(value) + } + pub fn lt(&self, value: String) -> TagWhereParam { + TagWhereParam::NameLt(value) + } + pub fn lte(&self, value: String) -> TagWhereParam { + TagWhereParam::NameLte(value) + } + pub fn gt(&self, value: String) -> TagWhereParam { + TagWhereParam::NameGt(value) + } + pub fn gte(&self, value: String) -> TagWhereParam { + TagWhereParam::NameGte(value) + } pub fn contains(&self, value: String) -> TagWhereParam { TagWhereParam::NameContains(value) } + pub fn starts_with(&self, value: String) -> TagWhereParam { + TagWhereParam::NameStartsWith(value) + } + pub fn ends_with(&self, value: String) -> TagWhereParam { + TagWhereParam::NameEndsWith(value) + } + pub fn not(&self, value: String) -> TagWhereParam { + TagWhereParam::NameNot(value) + } pub fn has_prefix(&self, value: String) -> TagWhereParam { TagWhereParam::NameHasPrefix(value) } pub fn has_suffix(&self, value: String) -> TagWhereParam { TagWhereParam::NameHasSuffix(value) } - pub fn equals(&self, value: String) -> TagWhereParam { - TagWhereParam::NameEquals(value) - } - pub fn set>(&self, value: String) -> T { - TagSetName(value).into() +} +pub struct TagSetName(String); +impl From for TagSetParam { + fn from(value: TagSetName) -> Self { + Self::SetName(value.0) } } pub struct TagEncryptionField {} -pub struct TagSetEncryption(i64); -impl From for TagSetParam { - fn from(value: TagSetEncryption) -> Self { - Self::Encryption(value.0) +impl TagEncryptionField { + pub fn set>(&self, value: i32) -> T { + TagSetEncryption(value).into() + } + pub fn equals(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOrderByParam { + TagOrderByParam::Encryption(direction) + } + pub fn cursor(&self, cursor: i32) -> TagCursor { + TagCursor::Encryption(cursor) + } + pub fn increment(&self, value: i32) -> TagSetParam { + TagSetParam::Encryption(value) + } + pub fn decrement(&self, value: i32) -> TagSetParam { + TagSetParam::Encryption(value) + } + pub fn multiply(&self, value: i32) -> TagSetParam { + TagSetParam::Encryption(value) + } + pub fn divide(&self, value: i32) -> TagSetParam { + TagSetParam::Encryption(value) + } + pub fn in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::EncryptionInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::EncryptionNotInVec(value) + } + pub fn lt(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionGte(value) + } + pub fn not(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionNot(value) + } + pub fn lt(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> TagWhereParam { + TagWhereParam::EncryptionGte(value) } } -impl TagEncryptionField { - pub fn lt(&self, value: i64) -> TagWhereParam { - TagWhereParam::EncryptionLT(value) - } - pub fn gt(&self, value: i64) -> TagWhereParam { - TagWhereParam::EncryptionGT(value) - } - pub fn lte(&self, value: i64) -> TagWhereParam { - TagWhereParam::EncryptionLTE(value) - } - pub fn gte(&self, value: i64) -> TagWhereParam { - TagWhereParam::EncryptionGTE(value) - } - pub fn equals(&self, value: i64) -> TagWhereParam { - TagWhereParam::EncryptionEquals(value) - } - pub fn set>(&self, value: i64) -> T { - TagSetEncryption(value).into() +pub struct TagSetEncryption(i32); +impl From for TagSetParam { + fn from(value: TagSetEncryption) -> Self { + Self::SetEncryption(value.0) } } pub struct TagTotalFilesField {} -pub struct TagSetTotalFiles(i64); -impl From for TagSetParam { - fn from(value: TagSetTotalFiles) -> Self { - Self::TotalFiles(value.0) +impl TagTotalFilesField { + pub fn set>(&self, value: i32) -> T { + TagSetTotalFiles(value).into() + } + pub fn equals(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOrderByParam { + TagOrderByParam::TotalFiles(direction) + } + pub fn cursor(&self, cursor: i32) -> TagCursor { + TagCursor::TotalFiles(cursor) + } + pub fn increment(&self, value: i32) -> TagSetParam { + TagSetParam::TotalFiles(value) + } + pub fn decrement(&self, value: i32) -> TagSetParam { + TagSetParam::TotalFiles(value) + } + pub fn multiply(&self, value: i32) -> TagSetParam { + TagSetParam::TotalFiles(value) + } + pub fn divide(&self, value: i32) -> TagSetParam { + TagSetParam::TotalFiles(value) + } + pub fn in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::TotalFilesInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::TotalFilesNotInVec(value) + } + pub fn lt(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesLt(value) + } + pub fn lte(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesLte(value) + } + pub fn gt(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesGt(value) + } + pub fn gte(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesGte(value) + } + pub fn not(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesNot(value) + } + pub fn lt(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesLt(value) + } + pub fn lte(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesLte(value) + } + pub fn gt(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesGt(value) + } + pub fn gte(&self, value: i32) -> TagWhereParam { + TagWhereParam::TotalFilesGte(value) } } -impl TagTotalFilesField { - pub fn lt(&self, value: i64) -> TagWhereParam { - TagWhereParam::TotalFilesLT(value) - } - pub fn gt(&self, value: i64) -> TagWhereParam { - TagWhereParam::TotalFilesGT(value) - } - pub fn lte(&self, value: i64) -> TagWhereParam { - TagWhereParam::TotalFilesLTE(value) - } - pub fn gte(&self, value: i64) -> TagWhereParam { - TagWhereParam::TotalFilesGTE(value) - } - pub fn equals(&self, value: i64) -> TagWhereParam { - TagWhereParam::TotalFilesEquals(value) - } - pub fn set>(&self, value: i64) -> T { - TagSetTotalFiles(value).into() +pub struct TagSetTotalFiles(i32); +impl From for TagSetParam { + fn from(value: TagSetTotalFiles) -> Self { + Self::SetTotalFiles(value.0) } } pub struct TagRedundancyGoalField {} -pub struct TagSetRedundancyGoal(i64); -impl From for TagSetParam { - fn from(value: TagSetRedundancyGoal) -> Self { - Self::RedundancyGoal(value.0) +impl TagRedundancyGoalField { + pub fn set>(&self, value: i32) -> T { + TagSetRedundancyGoal(value).into() + } + pub fn equals(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOrderByParam { + TagOrderByParam::RedundancyGoal(direction) + } + pub fn cursor(&self, cursor: i32) -> TagCursor { + TagCursor::RedundancyGoal(cursor) + } + pub fn increment(&self, value: i32) -> TagSetParam { + TagSetParam::RedundancyGoal(value) + } + pub fn decrement(&self, value: i32) -> TagSetParam { + TagSetParam::RedundancyGoal(value) + } + pub fn multiply(&self, value: i32) -> TagSetParam { + TagSetParam::RedundancyGoal(value) + } + pub fn divide(&self, value: i32) -> TagSetParam { + TagSetParam::RedundancyGoal(value) + } + pub fn in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::RedundancyGoalInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> TagWhereParam { + TagWhereParam::RedundancyGoalNotInVec(value) + } + pub fn lt(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalLt(value) + } + pub fn lte(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalLte(value) + } + pub fn gt(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalGt(value) + } + pub fn gte(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalGte(value) + } + pub fn not(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalNot(value) + } + pub fn lt(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalLt(value) + } + pub fn lte(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalLte(value) + } + pub fn gt(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalGt(value) + } + pub fn gte(&self, value: i32) -> TagWhereParam { + TagWhereParam::RedundancyGoalGte(value) } } -impl TagRedundancyGoalField { - pub fn lt(&self, value: i64) -> TagWhereParam { - TagWhereParam::RedundancyGoalLT(value) - } - pub fn gt(&self, value: i64) -> TagWhereParam { - TagWhereParam::RedundancyGoalGT(value) - } - pub fn lte(&self, value: i64) -> TagWhereParam { - TagWhereParam::RedundancyGoalLTE(value) - } - pub fn gte(&self, value: i64) -> TagWhereParam { - TagWhereParam::RedundancyGoalGTE(value) - } - pub fn equals(&self, value: i64) -> TagWhereParam { - TagWhereParam::RedundancyGoalEquals(value) - } - pub fn set>(&self, value: i64) -> T { - TagSetRedundancyGoal(value).into() +pub struct TagSetRedundancyGoal(i32); +impl From for TagSetParam { + fn from(value: TagSetRedundancyGoal) -> Self { + Self::SetRedundancyGoal(value.0) } } pub struct TagDateCreatedField {} -pub struct TagSetDateCreated(chrono::DateTime); -impl From for TagSetParam { - fn from(value: TagSetDateCreated) -> Self { - Self::DateCreated(value.0) - } -} impl TagDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + TagSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOrderByParam { + TagOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> TagCursor { + TagCursor::DateCreated(cursor) + } + pub fn in_vec(&self, value: Vec>) -> TagWhereParam { + TagWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec(&self, value: Vec>) -> TagWhereParam { + TagWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateCreatedNot(value) + } pub fn before(&self, value: chrono::DateTime) -> TagWhereParam { TagWhereParam::DateCreatedBefore(value) } @@ -8207,21 +19005,51 @@ impl TagDateCreatedField { pub fn after_equals(&self, value: chrono::DateTime) -> TagWhereParam { TagWhereParam::DateCreatedAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> TagWhereParam { - TagWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - TagSetDateCreated(value).into() +} +pub struct TagSetDateCreated(chrono::DateTime); +impl From for TagSetParam { + fn from(value: TagSetDateCreated) -> Self { + Self::SetDateCreated(value.0) } } pub struct TagDateModifiedField {} -pub struct TagSetDateModified(chrono::DateTime); -impl From for TagSetParam { - fn from(value: TagSetDateModified) -> Self { - Self::DateModified(value.0) - } -} impl TagDateModifiedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + TagSetDateModified(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOrderByParam { + TagOrderByParam::DateModified(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> TagCursor { + TagCursor::DateModified(cursor) + } + pub fn in_vec(&self, value: Vec>) -> TagWhereParam { + TagWhereParam::DateModifiedInVec(value) + } + pub fn not_in_vec(&self, value: Vec>) -> TagWhereParam { + TagWhereParam::DateModifiedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> TagWhereParam { + TagWhereParam::DateModifiedNot(value) + } pub fn before(&self, value: chrono::DateTime) -> TagWhereParam { TagWhereParam::DateModifiedBefore(value) } @@ -8234,20 +19062,14 @@ impl TagDateModifiedField { pub fn after_equals(&self, value: chrono::DateTime) -> TagWhereParam { TagWhereParam::DateModifiedAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> TagWhereParam { - TagWhereParam::DateModifiedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - TagSetDateModified(value).into() +} +pub struct TagSetDateModified(chrono::DateTime); +impl From for TagSetParam { + fn from(value: TagSetDateModified) -> Self { + Self::SetDateModified(value.0) } } pub struct TagTagFilesField {} -pub struct TagLinkTagFiles(Vec); -impl From for TagSetParam { - fn from(value: TagLinkTagFiles) -> Self { - Self::LinkTagFiles(value.0.into_iter().map(|v| v.into()).collect()) - } -} impl TagTagFilesField { pub fn some(&self, value: Vec) -> TagWhereParam { TagWhereParam::TagFilesSome(value) @@ -8255,430 +19077,30 @@ impl TagTagFilesField { pub fn every(&self, value: Vec) -> TagWhereParam { TagWhereParam::TagFilesEvery(value) } - pub fn link>(&self, value: Vec) -> T { - TagLinkTagFiles(value).into() + pub fn fetch(&self, params: Vec) -> TagWithParam { + TagWithParam::TagFiles(params) } - pub fn unlink(&self, params: Vec) -> TagSetParam { - TagSetParam::UnlinkTagFiles(params) + pub fn link>( + &self, + params: Vec, + ) -> T { + TagLinkTagFiles(params).into() } - pub fn fetch(&self, params: Vec) -> TagWith { - TagWithParam::TagFiles(params).into() + pub fn unlink(&self, params: Vec) -> TagSetParam { + TagSetParam::UnLinkTagFiles(params) } } -pub enum TagWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), - NameContains(String), - NameHasPrefix(String), - NameHasSuffix(String), - NameEquals(String), - EncryptionLT(i64), - EncryptionGT(i64), - EncryptionLTE(i64), - EncryptionGTE(i64), - EncryptionEquals(i64), - TotalFilesLT(i64), - TotalFilesGT(i64), - TotalFilesLTE(i64), - TotalFilesGTE(i64), - TotalFilesEquals(i64), - RedundancyGoalLT(i64), - RedundancyGoalGT(i64), - RedundancyGoalLTE(i64), - RedundancyGoalGTE(i64), - RedundancyGoalEquals(i64), - DateCreatedBefore(chrono::DateTime), - DateCreatedAfter(chrono::DateTime), - DateCreatedBeforeEquals(chrono::DateTime), - DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), - DateModifiedBefore(chrono::DateTime), - DateModifiedAfter(chrono::DateTime), - DateModifiedBeforeEquals(chrono::DateTime), - DateModifiedAfterEquals(chrono::DateTime), - DateModifiedEquals(chrono::DateTime), - TagFilesSome(Vec), - TagFilesEvery(Vec), - Not(Vec), - Or(Vec), - And(Vec), -} -impl TagWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdEquals(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameContains(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasPrefix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasSuffix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameEquals(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionLT(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionGT(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionLTE(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionGTE(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionEquals(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalFilesLT(value) => Field { - name: "total_files".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalFilesGT(value) => Field { - name: "total_files".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalFilesLTE(value) => Field { - name: "total_files".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalFilesGTE(value) => Field { - name: "total_files".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TotalFilesEquals(value) => Field { - name: "total_files".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::RedundancyGoalLT(value) => Field { - name: "redundancy_goal".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::RedundancyGoalGT(value) => Field { - name: "redundancy_goal".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::RedundancyGoalLTE(value) => Field { - name: "redundancy_goal".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::RedundancyGoalGTE(value) => Field { - name: "redundancy_goal".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::RedundancyGoalEquals(value) => Field { - name: "redundancy_goal".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBefore(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfter(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBeforeEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfterEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedBefore(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedAfter(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedBeforeEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedAfterEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TagFilesSome(value) => Field { - name: "tag_files".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TagFilesEvery(value) => Field { - name: "tag_files".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - } +pub struct TagLinkTagFiles(Vec); +impl From for TagSetParam { + fn from(value: TagLinkTagFiles) -> Self { + Self::LinkTagFiles(value.0) } } -impl From> for TagWhereParam { - fn from(op: Operator) -> Self { - match op { - Operator::Not(value) => Self::Not(value), - Operator::And(value) => Self::And(value), - Operator::Or(value) => Self::Or(value), - } - } -} -pub struct TagWith { - pub param: TagWithParam, -} pub enum TagWithParam { TagFiles(Vec), } -impl From for TagWith { - fn from(param: TagWithParam) -> Self { - Self { param } - } -} impl TagWithParam { - pub fn output(self) -> Output { + pub fn to_output(self) -> Output { match self { Self::TagFiles(where_params) => Output { name: "tag_files".into(), @@ -8686,7 +19108,12 @@ impl TagWithParam { inputs: if where_params.len() > 0 { vec![Input { name: "where".into(), - fields: where_params.into_iter().map(|f| f.field()).collect(), + fields: where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), ..Default::default() }] } else { @@ -8698,18 +19125,154 @@ impl TagWithParam { } } pub enum TagSetParam { - Id(i64), - Name(String), - Encryption(i64), - TotalFiles(i64), - RedundancyGoal(i64), - DateCreated(chrono::DateTime), - DateModified(chrono::DateTime), - LinkTagFiles(Vec), - UnlinkTagFiles(Vec), + SetId(i32), + SetName(String), + SetEncryption(i32), + SetTotalFiles(i32), + SetRedundancyGoal(i32), + SetDateCreated(chrono::DateTime), + SetDateModified(chrono::DateTime), + LinkTagFiles(Vec), + UnLinkTagFiles(Vec), } impl TagSetParam { - pub fn field(self) -> Field { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetName(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetEncryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTotalFiles(value) => Field { + name: "total_files".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetRedundancyGoal(value) => Field { + name: "redundancy_goal".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkTagFiles(where_params) => Field { + name: "tag_files".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkTagFiles(where_params) => Field { + name: "tag_files".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum TagOrderByParam { + Id(Direction), + Name(Direction), + Encryption(Direction), + TotalFiles(Direction), + RedundancyGoal(Direction), + DateCreated(Direction), + DateModified(Direction), +} +impl TagOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Name(direction) => Field { + name: "name".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Encryption(direction) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::TotalFiles(direction) => Field { + name: "total_files".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::RedundancyGoal(direction) => Field { + name: "redundancy_goal".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateModified(direction) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum TagCursor { + Id(i32), + Name(String), + Encryption(i32), + TotalFiles(i32), + RedundancyGoal(i32), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), +} +impl TagCursor { + fn to_field(self) -> Field { match self { Self::Id(value) => Field { name: "id".into(), @@ -8746,1229 +19309,123 @@ impl TagSetParam { value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }, - Self::LinkTagFiles(where_params) => Field { - name: "tag_files".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - list: true, - wrap_list: true, - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkTagFiles(where_params) => Field { - name: "tag_files".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - list: true, - wrap_list: true, - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - ..Default::default() - }]), - ..Default::default() - }, } } } -pub struct TagFindMany<'a> { - query: Query<'a>, -} -impl<'a> TagFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> TagDelete<'a> { - TagDelete { - query: Query { - operation: "mutation".into(), - method: "deleteMany".into(), - model: "Tag".into(), - outputs: vec![Output::new("count")], - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> TagUpdateMany<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - TagUpdateMany { - query: Query { - operation: "mutation".into(), - method: "updateMany".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagFindFirst<'a> { - query: Query<'a>, -} -impl<'a> TagFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagFindUnique<'a> { - query: Query<'a>, -} -impl<'a> TagFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> TagDelete<'a> { - TagDelete { - query: Query { - operation: "mutation".into(), - method: "deleteOne".into(), - model: "Tag".into(), - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> TagUpdateUnique<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - TagUpdateUnique { - query: Query { - operation: "mutation".into(), - method: "updateOne".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagCreateOne<'a> { - query: Query<'a>, -} -impl<'a> TagCreateOne<'a> { - pub async fn exec(self) -> TagData { - self.query.perform::().await.unwrap() - } -} -pub struct TagUpdateUnique<'a> { - query: Query<'a>, -} -impl<'a> TagUpdateUnique<'a> { - pub async fn exec(self) -> TagData { - self.query.perform::().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagUpdateMany<'a> { - query: Query<'a>, -} -impl<'a> TagUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagDelete<'a> { - query: Query<'a>, -} -impl<'a> TagDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count - } -} -pub struct TagActions<'a> { - client: &'a PrismaClient, -} -impl<'a> TagActions<'a> { - pub fn find_unique(&self, param: TagWhereParam) -> TagFindUnique { - let fields = transform_equals(vec![param.field()]); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findUnique".into(), - model: "Tag".into(), - outputs: tag_outputs(), - inputs: vec![Input { - name: "where".into(), - fields, - ..Default::default() - }], - }; - TagFindUnique { query } - } - pub fn find_first(&self, params: Vec) -> TagFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: vec![Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(where_fields), - ..Default::default() - }], - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findFirst".into(), - model: "Tag".into(), - outputs: tag_outputs(), - inputs, - }; - TagFindFirst { query } - } - pub fn find_many(&self, params: Vec) -> TagFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_fields, - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findMany".into(), - model: "Tag".into(), - outputs: tag_outputs(), - inputs, - }; - TagFindMany { query } - } - pub fn create_one(&self, params: Vec) -> TagCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "mutation".into(), - method: "createOne".into(), - model: "Tag".into(), - outputs: tag_outputs(), - inputs: vec![Input { - name: "data".into(), - fields: input_fields, - ..Default::default() - }], - }; - TagCreateOne { query } - } -} -fn tag_on_file_outputs() -> Vec { - vec![ - Output::new("date_created"), - Output::new("tag_id"), - Output::new("file_id"), - ] -} -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct TagOnFileData { - #[serde(rename = "date_created")] - pub date_created: chrono::DateTime, - #[serde(rename = "tag_id")] - pub tag_id: i64, - #[serde(rename = "tag")] - tag: Box>, - #[serde(rename = "file_id")] - pub file_id: i64, - #[serde(rename = "file")] - file: Box>, -} -impl TagOnFileData { - pub fn tag(&self) -> Result<&TagData, String> { - match self.tag.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access tag but did not fetch it using the .with() syntax".to_string()), - } - } - pub fn file(&self) -> Result<&FileData, String> { - match self.file.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access file but did not fetch it using the .with() syntax".to_string()), - } - } -} -pub struct TagOnFile; -impl TagOnFile { - pub fn date_created() -> TagOnFileDateCreatedField { - TagOnFileDateCreatedField {} - } - pub fn tag_id() -> TagOnFileTagIdField { - TagOnFileTagIdField {} - } - pub fn tag() -> TagOnFileTagField { - TagOnFileTagField {} - } - pub fn file_id() -> TagOnFileFileIdField { - TagOnFileFileIdField {} - } - pub fn file() -> TagOnFileFileField { - TagOnFileFileField {} - } -} -pub struct TagOnFileDateCreatedField {} -pub struct TagOnFileSetDateCreated(chrono::DateTime); -impl From for TagOnFileSetParam { - fn from(value: TagOnFileSetDateCreated) -> Self { - Self::DateCreated(value.0) - } -} -impl TagOnFileDateCreatedField { - pub fn before(&self, value: chrono::DateTime) -> TagOnFileWhereParam { - TagOnFileWhereParam::DateCreatedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> TagOnFileWhereParam { - TagOnFileWhereParam::DateCreatedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> TagOnFileWhereParam { - TagOnFileWhereParam::DateCreatedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> TagOnFileWhereParam { - TagOnFileWhereParam::DateCreatedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> TagOnFileWhereParam { - TagOnFileWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - TagOnFileSetDateCreated(value).into() - } -} -pub struct TagOnFileTagIdField {} -pub struct TagOnFileSetTagId(i64); -impl From for TagOnFileSetParam { - fn from(value: TagOnFileSetTagId) -> Self { - Self::TagId(value.0) - } -} -impl TagOnFileTagIdField { - pub fn lt(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::TagIdLT(value) - } - pub fn gt(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::TagIdGT(value) - } - pub fn lte(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::TagIdLTE(value) - } - pub fn gte(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::TagIdGTE(value) - } - pub fn equals(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::TagIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - TagOnFileSetTagId(value).into() - } -} -pub struct TagOnFileTagField {} -pub struct TagOnFileLinkTag(TagWhereParam); -impl From for TagOnFileSetParam { - fn from(value: TagOnFileLinkTag) -> Self { - Self::LinkTag(value.0) - } -} -impl TagOnFileTagField { - pub fn is(&self, value: Vec) -> TagOnFileWhereParam { - TagOnFileWhereParam::TagIs(value) - } - pub fn link>(&self, value: TagWhereParam) -> T { - TagOnFileLinkTag(value).into() - } - pub fn fetch(&self) -> TagOnFileWith { - TagOnFileWithParam::Tag.into() - } -} -pub struct TagOnFileFileIdField {} -pub struct TagOnFileSetFileId(i64); -impl From for TagOnFileSetParam { - fn from(value: TagOnFileSetFileId) -> Self { - Self::FileId(value.0) - } -} -impl TagOnFileFileIdField { - pub fn lt(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::FileIdLT(value) - } - pub fn gt(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::FileIdGT(value) - } - pub fn lte(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::FileIdLTE(value) - } - pub fn gte(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::FileIdGTE(value) - } - pub fn equals(&self, value: i64) -> TagOnFileWhereParam { - TagOnFileWhereParam::FileIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - TagOnFileSetFileId(value).into() - } -} -pub struct TagOnFileFileField {} -pub struct TagOnFileLinkFile(FileWhereParam); -impl From for TagOnFileSetParam { - fn from(value: TagOnFileLinkFile) -> Self { - Self::LinkFile(value.0) - } -} -impl TagOnFileFileField { - pub fn is(&self, value: Vec) -> TagOnFileWhereParam { - TagOnFileWhereParam::FileIs(value) - } - pub fn link>(&self, value: FileWhereParam) -> T { - TagOnFileLinkFile(value).into() - } - pub fn fetch(&self) -> TagOnFileWith { - TagOnFileWithParam::File.into() - } -} -pub enum TagOnFileWhereParam { - DateCreatedBefore(chrono::DateTime), - DateCreatedAfter(chrono::DateTime), - DateCreatedBeforeEquals(chrono::DateTime), - DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), - TagIdLT(i64), - TagIdGT(i64), - TagIdLTE(i64), - TagIdGTE(i64), - TagIdEquals(i64), - TagIs(Vec), - FileIdLT(i64), - FileIdGT(i64), - FileIdLTE(i64), - FileIdGTE(i64), - FileIdEquals(i64), - FileIs(Vec), - Not(Vec), - Or(Vec), - And(Vec), -} -impl TagOnFileWhereParam { - pub fn field(self) -> Field { - match self { - Self::DateCreatedBefore(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfter(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBeforeEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfterEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TagIdLT(value) => Field { - name: "tag_id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TagIdGT(value) => Field { - name: "tag_id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TagIdLTE(value) => Field { - name: "tag_id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TagIdGTE(value) => Field { - name: "tag_id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TagIdEquals(value) => Field { - name: "tag_id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TagIs(value) => Field { - name: "tag".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdLT(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdGT(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdLTE(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdGTE(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdEquals(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIs(value) => Field { - name: "file".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - } - } -} -impl From> for TagOnFileWhereParam { - fn from(op: Operator) -> Self { - match op { - Operator::Not(value) => Self::Not(value), - Operator::And(value) => Self::And(value), - Operator::Or(value) => Self::Or(value), - } - } -} -pub struct TagOnFileWith { - pub param: TagOnFileWithParam, -} -pub enum TagOnFileWithParam { - Tag, - File, -} -impl From for TagOnFileWith { - fn from(param: TagOnFileWithParam) -> Self { - Self { param } - } -} -impl TagOnFileWithParam { - pub fn output(self) -> Output { - match self { - Self::Tag => Output { - name: "tag".into(), - outputs: tag_outputs(), - ..Default::default() - }, - Self::File => Output { - name: "file".into(), - outputs: file_outputs(), - ..Default::default() - }, - } - } -} -pub enum TagOnFileSetParam { - DateCreated(chrono::DateTime), - TagId(i64), - LinkTag(TagWhereParam), - FileId(i64), - LinkFile(FileWhereParam), -} -impl TagOnFileSetParam { - pub fn field(self) -> Field { - match self { - Self::DateCreated(value) => Field { - name: "date_created".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::TagId(value) => Field { - name: "tag_id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LinkTag(where_param) => Field { - name: "tag".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals(vec![where_param.field()])), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileId(value) => Field { - name: "file_id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LinkFile(where_param) => Field { - name: "file".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals(vec![where_param.field()])), - ..Default::default() - }]), - ..Default::default() - }, - } - } -} -pub struct TagOnFileFindMany<'a> { - query: Query<'a>, -} -impl<'a> TagOnFileFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> TagOnFileDelete<'a> { - TagOnFileDelete { - query: Query { - operation: "mutation".into(), - method: "deleteMany".into(), - model: "TagOnFile".into(), - outputs: vec![Output::new("count")], - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> TagOnFileUpdateMany<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - TagOnFileUpdateMany { - query: Query { - operation: "mutation".into(), - method: "updateMany".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagOnFileFindFirst<'a> { - query: Query<'a>, -} -impl<'a> TagOnFileFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagOnFileFindUnique<'a> { - query: Query<'a>, -} -impl<'a> TagOnFileFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> TagOnFileDelete<'a> { - TagOnFileDelete { - query: Query { - operation: "mutation".into(), - method: "deleteOne".into(), - model: "TagOnFile".into(), - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> TagOnFileUpdateUnique<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - TagOnFileUpdateUnique { - query: Query { - operation: "mutation".into(), - method: "updateOne".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagOnFileCreateOne<'a> { - query: Query<'a>, -} -impl<'a> TagOnFileCreateOne<'a> { - pub async fn exec(self) -> TagOnFileData { - self.query.perform::().await.unwrap() - } -} -pub struct TagOnFileUpdateUnique<'a> { - query: Query<'a>, -} -impl<'a> TagOnFileUpdateUnique<'a> { - pub async fn exec(self) -> TagOnFileData { - self.query.perform::().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagOnFileUpdateMany<'a> { - query: Query<'a>, -} -impl<'a> TagOnFileUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct TagOnFileDelete<'a> { - query: Query<'a>, -} -impl<'a> TagOnFileDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count - } -} -pub struct TagOnFileActions<'a> { - client: &'a PrismaClient, -} -impl<'a> TagOnFileActions<'a> { - pub fn find_unique(&self, param: TagOnFileWhereParam) -> TagOnFileFindUnique { - let fields = transform_equals(vec![param.field()]); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findUnique".into(), - model: "TagOnFile".into(), - outputs: tag_on_file_outputs(), - inputs: vec![Input { - name: "where".into(), - fields, - ..Default::default() - }], - }; - TagOnFileFindUnique { query } - } - pub fn find_first(&self, params: Vec) -> TagOnFileFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: vec![Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(where_fields), - ..Default::default() - }], - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findFirst".into(), - model: "TagOnFile".into(), - outputs: tag_on_file_outputs(), - inputs, - }; - TagOnFileFindFirst { query } - } - pub fn find_many(&self, params: Vec) -> TagOnFileFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_fields, - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findMany".into(), - model: "TagOnFile".into(), - outputs: tag_on_file_outputs(), - inputs, - }; - TagOnFileFindMany { query } - } - pub fn create_one( - &self, - tag: TagOnFileLinkTag, - file: TagOnFileLinkFile, - params: Vec, - ) -> TagOnFileCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(TagOnFileSetParam::from(tag).field()); - input_fields.push(TagOnFileSetParam::from(file).field()); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "mutation".into(), - method: "createOne".into(), - model: "TagOnFile".into(), - outputs: tag_on_file_outputs(), - inputs: vec![Input { - name: "data".into(), - fields: input_fields, - ..Default::default() - }], - }; - TagOnFileCreateOne { query } - } -} -fn label_outputs() -> Vec { - vec![ - Output::new("id"), - Output::new("name"), - Output::new("date_created"), - Output::new("date_modified"), - ] -} -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct LabelData { - #[serde(rename = "id")] - pub id: i64, - #[serde(rename = "name")] - pub name: Option, - #[serde(rename = "date_created")] - pub date_created: chrono::DateTime, - #[serde(rename = "date_modified")] - pub date_modified: chrono::DateTime, - #[serde(rename = "label_files")] - label_files: Option>, -} -impl LabelData { - pub fn label_files(&self) -> Result<&Vec, String> { - match self.label_files.as_ref() { - Some(v) => Ok(v), - None => Err("attempted to access label_files but did not fetch it using the .with() syntax".to_string()), - } - } -} -pub struct Label; -impl Label { - pub fn id() -> LabelIdField { - LabelIdField {} - } - pub fn name() -> LabelNameField { - LabelNameField {} - } - pub fn date_created() -> LabelDateCreatedField { - LabelDateCreatedField {} - } - pub fn date_modified() -> LabelDateModifiedField { - LabelDateModifiedField {} - } - pub fn label_files() -> LabelLabelFilesField { - LabelLabelFilesField {} - } -} -pub struct LabelIdField {} -pub struct LabelSetId(i64); -impl From for LabelSetParam { - fn from(value: LabelSetId) -> Self { - Self::Id(value.0) - } -} -impl LabelIdField { - pub fn lt(&self, value: i64) -> LabelWhereParam { - LabelWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> LabelWhereParam { - LabelWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> LabelWhereParam { - LabelWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> LabelWhereParam { - LabelWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> LabelWhereParam { - LabelWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LabelSetId(value).into() - } -} -pub struct LabelNameField {} -pub struct LabelSetName(String); -impl From for LabelSetParam { - fn from(value: LabelSetName) -> Self { - Self::Name(value.0) - } -} -impl LabelNameField { - pub fn contains(&self, value: String) -> LabelWhereParam { - LabelWhereParam::NameContains(value) - } - pub fn has_prefix(&self, value: String) -> LabelWhereParam { - LabelWhereParam::NameHasPrefix(value) - } - pub fn has_suffix(&self, value: String) -> LabelWhereParam { - LabelWhereParam::NameHasSuffix(value) - } - pub fn equals(&self, value: String) -> LabelWhereParam { - LabelWhereParam::NameEquals(value) - } - pub fn set>(&self, value: String) -> T { - LabelSetName(value).into() - } -} -pub struct LabelDateCreatedField {} -pub struct LabelSetDateCreated(chrono::DateTime); -impl From for LabelSetParam { - fn from(value: LabelSetDateCreated) -> Self { - Self::DateCreated(value.0) - } -} -impl LabelDateCreatedField { - pub fn before(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateCreatedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateCreatedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateCreatedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateCreatedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - LabelSetDateCreated(value).into() - } -} -pub struct LabelDateModifiedField {} -pub struct LabelSetDateModified(chrono::DateTime); -impl From for LabelSetParam { - fn from(value: LabelSetDateModified) -> Self { - Self::DateModified(value.0) - } -} -impl LabelDateModifiedField { - pub fn before(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateModifiedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateModifiedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateModifiedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateModifiedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> LabelWhereParam { - LabelWhereParam::DateModifiedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - LabelSetDateModified(value).into() - } -} -pub struct LabelLabelFilesField {} -pub struct LabelLinkLabelFiles(Vec); -impl From for LabelSetParam { - fn from(value: LabelLinkLabelFiles) -> Self { - Self::LinkLabelFiles(value.0.into_iter().map(|v| v.into()).collect()) - } -} -impl LabelLabelFilesField { - pub fn some(&self, value: Vec) -> LabelWhereParam { - LabelWhereParam::LabelFilesSome(value) - } - pub fn every(&self, value: Vec) -> LabelWhereParam { - LabelWhereParam::LabelFilesEvery(value) - } - pub fn link>(&self, value: Vec) -> T { - LabelLinkLabelFiles(value).into() - } - pub fn unlink(&self, params: Vec) -> LabelSetParam { - LabelSetParam::UnlinkLabelFiles(params) - } - pub fn fetch(&self, params: Vec) -> LabelWith { - LabelWithParam::LabelFiles(params).into() - } -} -pub enum LabelWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), +pub enum TagWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + NameEquals(String), + NameInVec(Vec), + NameNotInVec(Vec), + NameLt(String), + NameLte(String), + NameGt(String), + NameGte(String), NameContains(String), + NameStartsWith(String), + NameEndsWith(String), + NameNot(String), NameHasPrefix(String), NameHasSuffix(String), - NameEquals(String), + EncryptionEquals(i32), + EncryptionInVec(Vec), + EncryptionNotInVec(Vec), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + EncryptionNot(i32), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + TotalFilesEquals(i32), + TotalFilesInVec(Vec), + TotalFilesNotInVec(Vec), + TotalFilesLt(i32), + TotalFilesLte(i32), + TotalFilesGt(i32), + TotalFilesGte(i32), + TotalFilesNot(i32), + TotalFilesLt(i32), + TotalFilesLte(i32), + TotalFilesGt(i32), + TotalFilesGte(i32), + RedundancyGoalEquals(i32), + RedundancyGoalInVec(Vec), + RedundancyGoalNotInVec(Vec), + RedundancyGoalLt(i32), + RedundancyGoalLte(i32), + RedundancyGoalGt(i32), + RedundancyGoalGte(i32), + RedundancyGoalNot(i32), + RedundancyGoalLt(i32), + RedundancyGoalLte(i32), + RedundancyGoalGt(i32), + RedundancyGoalGte(i32), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), DateCreatedBefore(chrono::DateTime), DateCreatedAfter(chrono::DateTime), DateCreatedBeforeEquals(chrono::DateTime), DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + DateModifiedInVec(Vec>), + DateModifiedNotInVec(Vec>), + DateModifiedLt(chrono::DateTime), + DateModifiedLte(chrono::DateTime), + DateModifiedGt(chrono::DateTime), + DateModifiedGte(chrono::DateTime), + DateModifiedNot(chrono::DateTime), DateModifiedBefore(chrono::DateTime), DateModifiedAfter(chrono::DateTime), DateModifiedBeforeEquals(chrono::DateTime), DateModifiedAfterEquals(chrono::DateTime), - DateModifiedEquals(chrono::DateTime), - LabelFilesSome(Vec), - LabelFilesEvery(Vec), - Not(Vec), - Or(Vec), - And(Vec), + TagFilesSome(Vec), + TagFilesEvery(Vec), } -impl LabelWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), +impl TagWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, Self::IdEquals(value) => Field { @@ -9980,6 +19437,204 @@ impl LabelWhereParam { }]), ..Default::default() }, + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNotInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::NameContains(value) => Field { name: "name".into(), fields: Some(vec![Field { @@ -9989,6 +19644,33 @@ impl LabelWhereParam { }]), ..Default::default() }, + Self::NameStartsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEndsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNot(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::NameHasPrefix(value) => Field { name: "name".into(), fields: Some(vec![Field { @@ -10007,8 +19689,8 @@ impl LabelWhereParam { }]), ..Default::default() }, - Self::NameEquals(value) => Field { - name: "name".into(), + Self::EncryptionEquals(value) => Field { + name: "encryption".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -10016,6 +19698,465 @@ impl LabelWhereParam { }]), ..Default::default() }, + Self::EncryptionInVec(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNotInVec(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNot(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesEquals(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesInVec(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesNotInVec(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesLt(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesLte(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesGt(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesGte(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesNot(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesLt(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesLte(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesGt(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TotalFilesGte(value) => Field { + name: "total_files".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalEquals(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalInVec(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalNotInVec(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalLt(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalLte(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalGt(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalGte(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalNot(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalLt(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalLte(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalGt(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::RedundancyGoalGte(value) => Field { + name: "redundancy_goal".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateCreatedBefore(value) => Field { name: "date_created".into(), fields: Some(vec![Field { @@ -10052,8 +20193,8 @@ impl LabelWhereParam { }]), ..Default::default() }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -10061,6 +20202,87 @@ impl LabelWhereParam { }]), ..Default::default() }, + Self::DateModifiedInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNotInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNot(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateModifiedBefore(value) => Field { name: "date_modified".into(), fields: Some(vec![Field { @@ -10097,58 +20319,38 @@ impl LabelWhereParam { }]), ..Default::default() }, - Self::DateModifiedEquals(value) => Field { - name: "date_modified".into(), + Self::TagFilesSome(value) => Field { + name: "tag_files".into(), fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "some".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() }, - Self::LabelFilesSome(value) => Field { - name: "label_files".into(), + Self::TagFilesEvery(value) => Field { + name: "tag_files".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "every".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() }, - Self::LabelFilesEvery(value) => Field { - name: "label_files".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, } } } -impl From> for LabelWhereParam { +pub enum TagWhereUniqueParam { + IdEquals(i32), +} +impl From for TagWhereParam { + fn from(value: TagWhereUniqueParam) -> Self { + match value { + TagWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + } + } +} +impl From> for TagWhereParam { fn from(op: Operator) -> Self { match op { Operator::Not(value) => Self::Not(value), @@ -10157,122 +20359,51 @@ impl From> for LabelWhereParam { } } } -pub struct LabelWith { - pub param: LabelWithParam, -} -pub enum LabelWithParam { - LabelFiles(Vec), -} -impl From for LabelWith { - fn from(param: LabelWithParam) -> Self { - Self { param } - } -} -impl LabelWithParam { - pub fn output(self) -> Output { - match self { - Self::LabelFiles(where_params) => Output { - name: "label_files".into(), - outputs: label_on_file_outputs(), - inputs: if where_params.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_params.into_iter().map(|f| f.field()).collect(), - ..Default::default() - }] - } else { - vec![] - }, - ..Default::default() - }, - } - } -} -pub enum LabelSetParam { - Id(i64), - Name(String), - DateCreated(chrono::DateTime), - DateModified(chrono::DateTime), - LinkLabelFiles(Vec), - UnlinkLabelFiles(Vec), -} -impl LabelSetParam { - pub fn field(self) -> Field { - match self { - Self::Id(value) => Field { - name: "id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::Name(value) => Field { - name: "name".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::DateCreated(value) => Field { - name: "date_created".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::DateModified(value) => Field { - name: "date_modified".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LinkLabelFiles(where_params) => Field { - name: "label_files".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - list: true, - wrap_list: true, - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkLabelFiles(where_params) => Field { - name: "label_files".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - list: true, - wrap_list: true, - fields: Some(transform_equals( - where_params.into_iter().map(|item| item.field()).collect(), - )), - ..Default::default() - }]), - ..Default::default() - }, - } - } -} -pub struct LabelFindMany<'a> { +pub struct TagFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } -impl<'a> LabelFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() +impl<'a> TagFindMany<'a> { + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn delete(self) -> LabelDelete<'a> { - LabelDelete { + pub fn delete(self) -> TagDelete<'a> { + TagDelete { query: Query { operation: "mutation".into(), method: "deleteMany".into(), - model: "Label".into(), + model: "Tag".into(), outputs: vec![Output::new("count")], ..self.query }, } } - pub fn update(mut self, params: Vec) -> LabelUpdateMany<'a> { + pub fn update(mut self, params: Vec) -> TagUpdateMany<'a> { self.query.inputs.push(Input { name: "data".into(), fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -10286,57 +20417,143 @@ impl<'a> LabelFindMany<'a> { .collect(), ..Default::default() }); - LabelUpdateMany { + TagUpdateMany { query: Query { operation: "mutation".into(), method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: TagOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: TagWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: TagCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } -pub struct LabelFindFirst<'a> { +pub struct TagFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } -impl<'a> LabelFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() +impl<'a> TagFindFirst<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: TagWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: TagOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: TagCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } -pub struct LabelFindUnique<'a> { +pub struct TagFindUnique<'a> { query: Query<'a>, + with_params: Vec, } -impl<'a> LabelFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() +impl<'a> TagFindUnique<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn delete(self) -> LabelDelete<'a> { - LabelDelete { + pub fn delete(self) -> TagDelete<'a> { + TagDelete { query: Query { operation: "mutation".into(), method: "deleteOne".into(), - model: "Label".into(), + model: "Tag".into(), ..self.query }, } } - pub fn update(mut self, params: Vec) -> LabelUpdateUnique<'a> { + pub fn update(mut self, params: Vec) -> TagUpdateUnique<'a> { self.query.inputs.push(Input { name: "data".into(), fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -10350,85 +20567,148 @@ impl<'a> LabelFindUnique<'a> { .collect(), ..Default::default() }); - LabelUpdateUnique { + TagUpdateUnique { query: Query { operation: "mutation".into(), method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: TagWithParam) -> Self { + self.with_params.push(param); self } } -pub struct LabelCreateOne<'a> { +pub struct TagCreateOne<'a> { query: Query<'a>, + with_params: Vec, } -impl<'a> LabelCreateOne<'a> { - pub async fn exec(self) -> LabelData { - self.query.perform::().await.unwrap() +impl<'a> TagCreateOne<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } -} -pub struct LabelUpdateUnique<'a> { - query: Query<'a>, -} -impl<'a> LabelUpdateUnique<'a> { - pub async fn exec(self) -> LabelData { - self.query.perform::().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: TagWithParam) -> Self { + self.with_params.push(param); self } } -pub struct LabelUpdateMany<'a> { +pub struct TagUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } -impl<'a> LabelUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() +impl<'a> TagUpdateUnique<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: TagWithParam) -> Self { + self.with_params.push(param); self } } -pub struct LabelDelete<'a> { +pub struct TagUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } -impl<'a> LabelDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count +impl<'a> TagUpdateMany<'a> { + pub async fn exec(self) -> QueryResult> { + self.query.perform().await + } + pub fn with(mut self, param: TagWithParam) -> Self { + self.with_params.push(param); + self } } -pub struct LabelActions<'a> { +pub struct TagUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> TagUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create(mut self, params: Vec) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + self + } +} +pub struct TagDelete<'a> { + query: Query<'a>, +} +impl<'a> TagDelete<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) + } +} +pub struct TagActions<'a> { client: &'a PrismaClient, } -impl<'a> LabelActions<'a> { - pub fn find_unique(&self, param: LabelWhereParam) -> LabelFindUnique { - let fields = transform_equals(vec![param.field()]); +impl<'a> TagActions<'a> { + pub fn find_unique(&self, param: TagWhereUniqueParam) -> TagFindUnique { + let param: TagWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), - model: "Label".into(), - outputs: label_outputs(), + model: "Tag".into(), + outputs: tag_outputs(), inputs: vec![Input { name: "where".into(), fields, ..Default::default() }], }; - LabelFindUnique { query } + TagFindUnique { + query, + with_params: vec![], + } } - pub fn find_first(&self, params: Vec) -> LabelFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + pub fn find_first(&self, params: Vec) -> TagFindFirst { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -10445,18 +20725,26 @@ impl<'a> LabelActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), - model: "Label".into(), - outputs: label_outputs(), + model: "Tag".into(), + outputs: tag_outputs(), inputs, }; - LabelFindFirst { query } + TagFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } - pub fn find_many(&self, params: Vec) -> LabelFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + pub fn find_many(&self, params: Vec) -> TagFindMany { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -10467,228 +20755,645 @@ impl<'a> LabelActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), - model: "Label".into(), - outputs: label_outputs(), + model: "Tag".into(), + outputs: tag_outputs(), inputs, }; - LabelFindMany { query } + TagFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } - pub fn create_one(&self, params: Vec) -> LabelCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); + pub fn create_one(&self, params: Vec) -> TagCreateOne { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), - model: "Label".into(), - outputs: label_outputs(), + model: "Tag".into(), + outputs: tag_outputs(), inputs: vec![Input { name: "data".into(), fields: input_fields, ..Default::default() }], }; - LabelCreateOne { query } + TagCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: TagWhereUniqueParam) -> TagUpsertOne { + let param: TagWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Tag".into(), + outputs: tag_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + TagUpsertOne { query } } } -fn label_on_file_outputs() -> Vec { +fn tag_on_file_outputs() -> Vec { vec![ Output::new("date_created"), - Output::new("label_id"), + Output::new("tag_id"), Output::new("file_id"), ] } #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct LabelOnFileData { +pub struct TagOnFileData { #[serde(rename = "date_created")] pub date_created: chrono::DateTime, - #[serde(rename = "label_id")] - pub label_id: i64, - #[serde(rename = "label")] - label: Box>, + #[serde(rename = "tag_id")] + pub tag_id: i32, + #[serde(rename = "tag")] + tag: Option>, #[serde(rename = "file_id")] - pub file_id: i64, + pub file_id: i32, #[serde(rename = "file")] - file: Box>, + file: Option>, } -impl LabelOnFileData { - pub fn label(&self) -> Result<&LabelData, String> { - match self.label.as_ref() { +impl TagOnFileData { + pub fn tag(&self) -> Result<&TagData, String> { + match self.tag.as_ref() { Some(v) => Ok(v), - None => Err("attempted to access label but did not fetch it using the .with() syntax".to_string()), + None => Err( + "Attempted to access tag but did not fetch it using the .with() syntax" + .to_string(), + ), } } pub fn file(&self) -> Result<&FileData, String> { match self.file.as_ref() { Some(v) => Ok(v), - None => Err("attempted to access file but did not fetch it using the .with() syntax".to_string()), + None => Err( + "Attempted to access file but did not fetch it using the .with() syntax" + .to_string(), + ), } } } -pub struct LabelOnFile; -impl LabelOnFile { - pub fn date_created() -> LabelOnFileDateCreatedField { - LabelOnFileDateCreatedField {} +pub struct TagOnFile; +impl TagOnFile { + pub fn date_created() -> TagOnFileDateCreatedField { + TagOnFileDateCreatedField {} } - pub fn label_id() -> LabelOnFileLabelIdField { - LabelOnFileLabelIdField {} + pub fn tag_id() -> TagOnFileTagIdField { + TagOnFileTagIdField {} } - pub fn label() -> LabelOnFileLabelField { - LabelOnFileLabelField {} + pub fn tag() -> TagOnFileTagField { + TagOnFileTagField {} } - pub fn file_id() -> LabelOnFileFileIdField { - LabelOnFileFileIdField {} + pub fn file_id() -> TagOnFileFileIdField { + TagOnFileFileIdField {} } - pub fn file() -> LabelOnFileFileField { - LabelOnFileFileField {} + pub fn file() -> TagOnFileFileField { + TagOnFileFileField {} } } -pub struct LabelOnFileDateCreatedField {} -pub struct LabelOnFileSetDateCreated(chrono::DateTime); -impl From for LabelOnFileSetParam { - fn from(value: LabelOnFileSetDateCreated) -> Self { - Self::DateCreated(value.0) +pub struct TagOnFileDateCreatedField {} +impl TagOnFileDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + TagOnFileSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOnFileOrderByParam { + TagOnFileOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> TagOnFileCursor { + TagOnFileCursor::DateCreated(cursor) + } + pub fn in_vec( + &self, + value: Vec>, + ) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedAfter(value) + } + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> TagOnFileWhereParam { + TagOnFileWhereParam::DateCreatedAfterEquals(value) } } -impl LabelOnFileDateCreatedField { - pub fn before(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::DateCreatedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::DateCreatedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::DateCreatedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::DateCreatedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - LabelOnFileSetDateCreated(value).into() +pub struct TagOnFileSetDateCreated(chrono::DateTime); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileSetDateCreated) -> Self { + Self::SetDateCreated(value.0) } } -pub struct LabelOnFileLabelIdField {} -pub struct LabelOnFileSetLabelId(i64); -impl From for LabelOnFileSetParam { - fn from(value: LabelOnFileSetLabelId) -> Self { - Self::LabelId(value.0) +pub struct TagOnFileTagIdField {} +impl TagOnFileTagIdField { + pub fn set>(&self, value: i32) -> T { + TagOnFileSetTagId(value).into() + } + pub fn equals(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOnFileOrderByParam { + TagOnFileOrderByParam::TagId(direction) + } + pub fn cursor(&self, cursor: i32) -> TagOnFileCursor { + TagOnFileCursor::TagId(cursor) + } + pub fn increment(&self, value: i32) -> TagOnFileSetParam { + TagOnFileSetParam::TagId(value) + } + pub fn decrement(&self, value: i32) -> TagOnFileSetParam { + TagOnFileSetParam::TagId(value) + } + pub fn multiply(&self, value: i32) -> TagOnFileSetParam { + TagOnFileSetParam::TagId(value) + } + pub fn divide(&self, value: i32) -> TagOnFileSetParam { + TagOnFileSetParam::TagId(value) + } + pub fn in_vec(&self, value: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdLt(value) + } + pub fn lte(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdLte(value) + } + pub fn gt(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdGt(value) + } + pub fn gte(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdGte(value) + } + pub fn not(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdNot(value) + } + pub fn lt(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdLt(value) + } + pub fn lte(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdLte(value) + } + pub fn gt(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdGt(value) + } + pub fn gte(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIdGte(value) } } -impl LabelOnFileLabelIdField { - pub fn lt(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::LabelIdLT(value) - } - pub fn gt(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::LabelIdGT(value) - } - pub fn lte(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::LabelIdLTE(value) - } - pub fn gte(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::LabelIdGTE(value) - } - pub fn equals(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::LabelIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LabelOnFileSetLabelId(value).into() +pub struct TagOnFileSetTagId(i32); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileSetTagId) -> Self { + Self::SetTagId(value.0) } } -pub struct LabelOnFileLabelField {} -pub struct LabelOnFileLinkLabel(LabelWhereParam); -impl From for LabelOnFileSetParam { - fn from(value: LabelOnFileLinkLabel) -> Self { - Self::LinkLabel(value.0) +pub struct TagOnFileTagField {} +impl TagOnFileTagField { + pub fn is(&self, value: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::TagIs(value) + } + pub fn fetch(&self) -> TagOnFileWithParam { + TagOnFileWithParam::Tag + } + pub fn link>(&self, value: TagWhereUniqueParam) -> T { + TagOnFileLinkTag(value).into() } } -impl LabelOnFileLabelField { - pub fn is(&self, value: Vec) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::LabelIs(value) - } - pub fn link>(&self, value: LabelWhereParam) -> T { - LabelOnFileLinkLabel(value).into() - } - pub fn fetch(&self) -> LabelOnFileWith { - LabelOnFileWithParam::Label.into() +pub struct TagOnFileLinkTag(TagWhereUniqueParam); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileLinkTag) -> Self { + Self::LinkTag(value.0) } } -pub struct LabelOnFileFileIdField {} -pub struct LabelOnFileSetFileId(i64); -impl From for LabelOnFileSetParam { - fn from(value: LabelOnFileSetFileId) -> Self { - Self::FileId(value.0) +pub struct TagOnFileFileIdField {} +impl TagOnFileFileIdField { + pub fn set>(&self, value: i32) -> T { + TagOnFileSetFileId(value).into() + } + pub fn equals(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> TagOnFileOrderByParam { + TagOnFileOrderByParam::FileId(direction) + } + pub fn cursor(&self, cursor: i32) -> TagOnFileCursor { + TagOnFileCursor::FileId(cursor) + } + pub fn increment(&self, value: i32) -> TagOnFileSetParam { + TagOnFileSetParam::FileId(value) + } + pub fn decrement(&self, value: i32) -> TagOnFileSetParam { + TagOnFileSetParam::FileId(value) + } + pub fn multiply(&self, value: i32) -> TagOnFileSetParam { + TagOnFileSetParam::FileId(value) + } + pub fn divide(&self, value: i32) -> TagOnFileSetParam { + TagOnFileSetParam::FileId(value) + } + pub fn in_vec(&self, value: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdLt(value) + } + pub fn lte(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdLte(value) + } + pub fn gt(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdGt(value) + } + pub fn gte(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdGte(value) + } + pub fn not(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdNot(value) + } + pub fn lt(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdLt(value) + } + pub fn lte(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdLte(value) + } + pub fn gt(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdGt(value) + } + pub fn gte(&self, value: i32) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIdGte(value) } } -impl LabelOnFileFileIdField { - pub fn lt(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::FileIdLT(value) - } - pub fn gt(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::FileIdGT(value) - } - pub fn lte(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::FileIdLTE(value) - } - pub fn gte(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::FileIdGTE(value) - } - pub fn equals(&self, value: i64) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::FileIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - LabelOnFileSetFileId(value).into() +pub struct TagOnFileSetFileId(i32); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileSetFileId) -> Self { + Self::SetFileId(value.0) } } -pub struct LabelOnFileFileField {} -pub struct LabelOnFileLinkFile(FileWhereParam); -impl From for LabelOnFileSetParam { - fn from(value: LabelOnFileLinkFile) -> Self { +pub struct TagOnFileFileField {} +impl TagOnFileFileField { + pub fn is(&self, value: Vec) -> TagOnFileWhereParam { + TagOnFileWhereParam::FileIs(value) + } + pub fn fetch(&self) -> TagOnFileWithParam { + TagOnFileWithParam::File + } + pub fn link>(&self, value: FileWhereUniqueParam) -> T { + TagOnFileLinkFile(value).into() + } +} +pub struct TagOnFileLinkFile(FileWhereUniqueParam); +impl From for TagOnFileSetParam { + fn from(value: TagOnFileLinkFile) -> Self { Self::LinkFile(value.0) } } -impl LabelOnFileFileField { - pub fn is(&self, value: Vec) -> LabelOnFileWhereParam { - LabelOnFileWhereParam::FileIs(value) - } - pub fn link>(&self, value: FileWhereParam) -> T { - LabelOnFileLinkFile(value).into() - } - pub fn fetch(&self) -> LabelOnFileWith { - LabelOnFileWithParam::File.into() +pub enum TagOnFileWithParam { + Tag, + File, +} +impl TagOnFileWithParam { + pub fn to_output(self) -> Output { + match self { + Self::Tag => Output { + name: "tag".into(), + outputs: tag_outputs(), + ..Default::default() + }, + Self::File => Output { + name: "file".into(), + outputs: file_outputs(), + ..Default::default() + }, + } } } -pub enum LabelOnFileWhereParam { +pub enum TagOnFileSetParam { + SetDateCreated(chrono::DateTime), + SetTagId(i32), + LinkTag(TagWhereUniqueParam), + SetFileId(i32), + LinkFile(FileWhereUniqueParam), +} +impl TagOnFileSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTagId(value) => Field { + name: "tag_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkTag(where_param) => Field { + name: "tag".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![Into::::into( + where_param, + ) + .to_field()])), + ..Default::default() + }]), + ..Default::default() + }, + Self::SetFileId(value) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkFile(where_param) => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![Into::::into( + where_param, + ) + .to_field()])), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum TagOnFileOrderByParam { + DateCreated(Direction), + TagId(Direction), + FileId(Direction), +} +impl TagOnFileOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::TagId(direction) => Field { + name: "tag_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::FileId(direction) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum TagOnFileCursor { + DateCreated(chrono::DateTime), + TagId(i32), + FileId(i32), +} +impl TagOnFileCursor { + fn to_field(self) -> Field { + match self { + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::TagId(value) => Field { + name: "tag_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::FileId(value) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum TagOnFileWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), DateCreatedBefore(chrono::DateTime), DateCreatedAfter(chrono::DateTime), DateCreatedBeforeEquals(chrono::DateTime), DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), - LabelIdLT(i64), - LabelIdGT(i64), - LabelIdLTE(i64), - LabelIdGTE(i64), - LabelIdEquals(i64), - LabelIs(Vec), - FileIdLT(i64), - FileIdGT(i64), - FileIdLTE(i64), - FileIdGTE(i64), - FileIdEquals(i64), + TagIdEquals(i32), + TagIdInVec(Vec), + TagIdNotInVec(Vec), + TagIdLt(i32), + TagIdLte(i32), + TagIdGt(i32), + TagIdGte(i32), + TagIdNot(i32), + TagIdLt(i32), + TagIdLte(i32), + TagIdGt(i32), + TagIdGte(i32), + TagIs(Vec), + FileIdEquals(i32), + FileIdInVec(Vec), + FileIdNotInVec(Vec), + FileIdLt(i32), + FileIdLte(i32), + FileIdGt(i32), + FileIdGte(i32), + FileIdNot(i32), + FileIdLt(i32), + FileIdLte(i32), + FileIdGt(i32), + FileIdGte(i32), FileIs(Vec), - Not(Vec), - Or(Vec), - And(Vec), } -impl LabelOnFileWhereParam { - pub fn field(self) -> Field { - match self { +impl TagOnFileWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateCreatedBefore(value) => Field { name: "date_created".into(), fields: Some(vec![Field { @@ -10725,6 +21430,1584 @@ impl LabelOnFileWhereParam { }]), ..Default::default() }, + Self::TagIdEquals(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdInVec(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdNotInVec(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdLt(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdLte(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdGt(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdGte(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdNot(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdLt(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdLte(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdGt(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIdGte(value) => Field { + name: "tag_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TagIs(value) => Field { + name: "tag".into(), + fields: Some(vec![Field { + name: "is".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdEquals(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdInVec(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdNotInVec(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdNot(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIs(value) => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "is".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum TagOnFileWhereUniqueParam {} +impl From for TagOnFileWhereParam { + fn from(value: TagOnFileWhereUniqueParam) -> Self { + match value {} + } +} +impl From> for TagOnFileWhereParam { + fn from(op: Operator) -> Self { + match op { + Operator::Not(value) => Self::Not(value), + Operator::And(value) => Self::And(value), + Operator::Or(value) => Self::Or(value), + } + } +} +pub struct TagOnFileFindMany<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> TagOnFileFindMany<'a> { + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> TagOnFileDelete<'a> { + TagOnFileDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "TagOnFile".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> TagOnFileUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + TagOnFileUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn order_by(mut self, param: TagOnFileOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: TagOnFileWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: TagOnFileCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct TagOnFileFindFirst<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> TagOnFileFindFirst<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: TagOnFileWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: TagOnFileOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: TagOnFileCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct TagOnFileFindUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> TagOnFileFindUnique<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> TagOnFileDelete<'a> { + TagOnFileDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "TagOnFile".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> TagOnFileUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + TagOnFileUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn with(mut self, param: TagOnFileWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct TagOnFileCreateOne<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> TagOnFileCreateOne<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: TagOnFileWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct TagOnFileUpdateUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> TagOnFileUpdateUnique<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn with(mut self, param: TagOnFileWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct TagOnFileUpdateMany<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> TagOnFileUpdateMany<'a> { + pub async fn exec(self) -> QueryResult> { + self.query.perform().await + } + pub fn with(mut self, param: TagOnFileWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct TagOnFileUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> TagOnFileUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + tag: TagOnFileLinkTag, + file: TagOnFileLinkFile, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(TagOnFileSetParam::from(tag).to_field()); + input_fields.push(TagOnFileSetParam::from(file).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + self + } +} +pub struct TagOnFileDelete<'a> { + query: Query<'a>, +} +impl<'a> TagOnFileDelete<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) + } +} +pub struct TagOnFileActions<'a> { + client: &'a PrismaClient, +} +impl<'a> TagOnFileActions<'a> { + pub fn find_unique(&self, param: TagOnFileWhereUniqueParam) -> TagOnFileFindUnique { + let param: TagOnFileWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "TagOnFile".into(), + outputs: tag_on_file_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + TagOnFileFindUnique { + query, + with_params: vec![], + } + } + pub fn find_first(&self, params: Vec) -> TagOnFileFindFirst { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "TagOnFile".into(), + outputs: tag_on_file_outputs(), + inputs, + }; + TagOnFileFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn find_many(&self, params: Vec) -> TagOnFileFindMany { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "TagOnFile".into(), + outputs: tag_on_file_outputs(), + inputs, + }; + TagOnFileFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn create_one( + &self, + tag: TagOnFileLinkTag, + file: TagOnFileLinkFile, + params: Vec, + ) -> TagOnFileCreateOne { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(TagOnFileSetParam::from(tag).to_field()); + input_fields.push(TagOnFileSetParam::from(file).to_field()); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "TagOnFile".into(), + outputs: tag_on_file_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + TagOnFileCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: TagOnFileWhereUniqueParam) -> TagOnFileUpsertOne { + let param: TagOnFileWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "TagOnFile".into(), + outputs: tag_on_file_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + TagOnFileUpsertOne { query } + } +} +fn label_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("name"), + Output::new("date_created"), + Output::new("date_modified"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LabelData { + #[serde(rename = "id")] + pub id: i32, + #[serde(rename = "name")] + pub name: Option, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "date_modified")] + pub date_modified: chrono::DateTime, + #[serde(rename = "label_files")] + label_files: Option>, +} +impl LabelData { + pub fn label_files(&self) -> Result<&Vec, String> { + match self . label_files . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access label_files but did not fetch it using the .with() syntax" . to_string ()) , } + } +} +pub struct Label; +impl Label { + pub fn id() -> LabelIdField { + LabelIdField {} + } + pub fn name() -> LabelNameField { + LabelNameField {} + } + pub fn date_created() -> LabelDateCreatedField { + LabelDateCreatedField {} + } + pub fn date_modified() -> LabelDateModifiedField { + LabelDateModifiedField {} + } + pub fn label_files() -> LabelLabelFilesField { + LabelLabelFilesField {} + } +} +pub struct LabelIdField {} +impl LabelIdField { + pub fn set>(&self, value: i32) -> T { + LabelSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + LabelWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LabelOrderByParam { + LabelOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> LabelCursor { + LabelCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> LabelSetParam { + LabelSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> LabelSetParam { + LabelSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> LabelSetParam { + LabelSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> LabelSetParam { + LabelSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> LabelWhereParam { + LabelWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LabelWhereParam { + LabelWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> LabelWhereParam { + LabelWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> LabelWhereParam { + LabelWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> LabelWhereParam { + LabelWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> LabelWhereParam { + LabelWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> LabelWhereParam { + LabelWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> LabelWhereParam { + LabelWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> LabelWhereParam { + LabelWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> LabelWhereParam { + LabelWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> LabelWhereParam { + LabelWhereParam::IdGte(value) + } +} +pub struct LabelSetId(i32); +impl From for LabelSetParam { + fn from(value: LabelSetId) -> Self { + Self::SetId(value.0) + } +} +pub struct LabelNameField {} +impl LabelNameField { + pub fn set>(&self, value: String) -> T { + LabelSetName(value).into() + } + pub fn equals(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LabelOrderByParam { + LabelOrderByParam::Name(direction) + } + pub fn cursor(&self, cursor: String) -> LabelCursor { + LabelCursor::Name(cursor) + } + pub fn in_vec(&self, value: Vec) -> LabelWhereParam { + LabelWhereParam::NameInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LabelWhereParam { + LabelWhereParam::NameNotInVec(value) + } + pub fn lt(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameLt(value) + } + pub fn lte(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameLte(value) + } + pub fn gt(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameGt(value) + } + pub fn gte(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameGte(value) + } + pub fn contains(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameContains(value) + } + pub fn starts_with(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameStartsWith(value) + } + pub fn ends_with(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameEndsWith(value) + } + pub fn not(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameNot(value) + } + pub fn has_prefix(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> LabelWhereParam { + LabelWhereParam::NameHasSuffix(value) + } +} +pub struct LabelSetName(String); +impl From for LabelSetParam { + fn from(value: LabelSetName) -> Self { + Self::SetName(value.0) + } +} +pub struct LabelDateCreatedField {} +impl LabelDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + LabelSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LabelOrderByParam { + LabelOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> LabelCursor { + LabelCursor::DateCreated(cursor) + } + pub fn in_vec(&self, value: Vec>) -> LabelWhereParam { + LabelWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> LabelWhereParam { + LabelWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateCreatedAfterEquals(value) + } +} +pub struct LabelSetDateCreated(chrono::DateTime); +impl From for LabelSetParam { + fn from(value: LabelSetDateCreated) -> Self { + Self::SetDateCreated(value.0) + } +} +pub struct LabelDateModifiedField {} +impl LabelDateModifiedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + LabelSetDateModified(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LabelOrderByParam { + LabelOrderByParam::DateModified(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> LabelCursor { + LabelCursor::DateModified(cursor) + } + pub fn in_vec(&self, value: Vec>) -> LabelWhereParam { + LabelWhereParam::DateModifiedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> LabelWhereParam { + LabelWhereParam::DateModifiedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> LabelWhereParam { + LabelWhereParam::DateModifiedAfterEquals(value) + } +} +pub struct LabelSetDateModified(chrono::DateTime); +impl From for LabelSetParam { + fn from(value: LabelSetDateModified) -> Self { + Self::SetDateModified(value.0) + } +} +pub struct LabelLabelFilesField {} +impl LabelLabelFilesField { + pub fn some(&self, value: Vec) -> LabelWhereParam { + LabelWhereParam::LabelFilesSome(value) + } + pub fn every(&self, value: Vec) -> LabelWhereParam { + LabelWhereParam::LabelFilesEvery(value) + } + pub fn fetch(&self, params: Vec) -> LabelWithParam { + LabelWithParam::LabelFiles(params) + } + pub fn link>( + &self, + params: Vec, + ) -> T { + LabelLinkLabelFiles(params).into() + } + pub fn unlink(&self, params: Vec) -> LabelSetParam { + LabelSetParam::UnLinkLabelFiles(params) + } +} +pub struct LabelLinkLabelFiles(Vec); +impl From for LabelSetParam { + fn from(value: LabelLinkLabelFiles) -> Self { + Self::LinkLabelFiles(value.0) + } +} +pub enum LabelWithParam { + LabelFiles(Vec), +} +impl LabelWithParam { + pub fn to_output(self) -> Output { + match self { + Self::LabelFiles(where_params) => Output { + name: "label_files".into(), + outputs: label_on_file_outputs(), + inputs: if where_params.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + ..Default::default() + }] + } else { + vec![] + }, + ..Default::default() + }, + } + } +} +pub enum LabelSetParam { + SetId(i32), + SetName(String), + SetDateCreated(chrono::DateTime), + SetDateModified(chrono::DateTime), + LinkLabelFiles(Vec), + UnLinkLabelFiles(Vec), +} +impl LabelSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetName(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkLabelFiles(where_params) => Field { + name: "label_files".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + list: true, + wrap_list: true, + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkLabelFiles(where_params) => Field { + name: "label_files".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + list: true, + wrap_list: true, + fields: Some(transform_equals( + where_params + .into_iter() + .map(|param| { + Into::::into(param).to_field() + }) + .collect(), + )), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum LabelOrderByParam { + Id(Direction), + Name(Direction), + DateCreated(Direction), + DateModified(Direction), +} +impl LabelOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Name(direction) => Field { + name: "name".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateModified(direction) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum LabelCursor { + Id(i32), + Name(String), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), +} +impl LabelCursor { + fn to_field(self) -> Field { + match self { + Self::Id(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::Name(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::DateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum LabelWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + NameEquals(String), + NameInVec(Vec), + NameNotInVec(Vec), + NameLt(String), + NameLte(String), + NameGt(String), + NameGte(String), + NameContains(String), + NameStartsWith(String), + NameEndsWith(String), + NameNot(String), + NameHasPrefix(String), + NameHasSuffix(String), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + DateModifiedInVec(Vec>), + DateModifiedNotInVec(Vec>), + DateModifiedLt(chrono::DateTime), + DateModifiedLte(chrono::DateTime), + DateModifiedGt(chrono::DateTime), + DateModifiedGte(chrono::DateTime), + DateModifiedNot(chrono::DateTime), + DateModifiedBefore(chrono::DateTime), + DateModifiedAfter(chrono::DateTime), + DateModifiedBeforeEquals(chrono::DateTime), + DateModifiedAfterEquals(chrono::DateTime), + LabelFilesSome(Vec), + LabelFilesEvery(Vec), +} +impl LabelWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNotInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameStartsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEndsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNot(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateCreatedEquals(value) => Field { name: "date_created".into(), fields: Some(vec![Field { @@ -10734,8 +23017,44 @@ impl LabelOnFileWhereParam { }]), ..Default::default() }, - Self::LabelIdLT(value) => Field { - name: "label_id".into(), + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), fields: Some(vec![Field { name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -10743,17 +23062,8 @@ impl LabelOnFileWhereParam { }]), ..Default::default() }, - Self::LabelIdGT(value) => Field { - name: "label_id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LabelIdLTE(value) => Field { - name: "label_id".into(), + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), fields: Some(vec![Field { name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -10761,8 +23071,1299 @@ impl LabelOnFileWhereParam { }]), ..Default::default() }, - Self::LabelIdGTE(value) => Field { + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNotInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNot(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBefore(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfter(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBeforeEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfterEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LabelFilesSome(value) => Field { + name: "label_files".into(), + fields: Some(vec![Field { + name: "some".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LabelFilesEvery(value) => Field { + name: "label_files".into(), + fields: Some(vec![Field { + name: "every".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum LabelWhereUniqueParam { + IdEquals(i32), +} +impl From for LabelWhereParam { + fn from(value: LabelWhereUniqueParam) -> Self { + match value { + LabelWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + } + } +} +impl From> for LabelWhereParam { + fn from(op: Operator) -> Self { + match op { + Operator::Not(value) => Self::Not(value), + Operator::And(value) => Self::And(value), + Operator::Or(value) => Self::Or(value), + } + } +} +pub struct LabelFindMany<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> LabelFindMany<'a> { + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> LabelDelete<'a> { + LabelDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Label".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> LabelUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + LabelUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn order_by(mut self, param: LabelOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: LabelWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LabelCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct LabelFindFirst<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> LabelFindFirst<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: LabelWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: LabelOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LabelCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct LabelFindUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> LabelFindUnique<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> LabelDelete<'a> { + LabelDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Label".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> LabelUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + LabelUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn with(mut self, param: LabelWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LabelCreateOne<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> LabelCreateOne<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: LabelWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LabelUpdateUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> LabelUpdateUnique<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn with(mut self, param: LabelWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LabelUpdateMany<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> LabelUpdateMany<'a> { + pub async fn exec(self) -> QueryResult> { + self.query.perform().await + } + pub fn with(mut self, param: LabelWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LabelUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> LabelUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create(mut self, params: Vec) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + self + } +} +pub struct LabelDelete<'a> { + query: Query<'a>, +} +impl<'a> LabelDelete<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) + } +} +pub struct LabelActions<'a> { + client: &'a PrismaClient, +} +impl<'a> LabelActions<'a> { + pub fn find_unique(&self, param: LabelWhereUniqueParam) -> LabelFindUnique { + let param: LabelWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Label".into(), + outputs: label_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + LabelFindUnique { + query, + with_params: vec![], + } + } + pub fn find_first(&self, params: Vec) -> LabelFindFirst { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Label".into(), + outputs: label_outputs(), + inputs, + }; + LabelFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn find_many(&self, params: Vec) -> LabelFindMany { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Label".into(), + outputs: label_outputs(), + inputs, + }; + LabelFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn create_one(&self, params: Vec) -> LabelCreateOne { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Label".into(), + outputs: label_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + LabelCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: LabelWhereUniqueParam) -> LabelUpsertOne { + let param: LabelWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Label".into(), + outputs: label_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + LabelUpsertOne { query } + } +} +fn label_on_file_outputs() -> Vec { + vec![ + Output::new("date_created"), + Output::new("label_id"), + Output::new("file_id"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct LabelOnFileData { + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "label_id")] + pub label_id: i32, + #[serde(rename = "label")] + label: Option>, + #[serde(rename = "file_id")] + pub file_id: i32, + #[serde(rename = "file")] + file: Option>, +} +impl LabelOnFileData { + pub fn label(&self) -> Result<&LabelData, String> { + match self.label.as_ref() { + Some(v) => Ok(v), + None => Err( + "Attempted to access label but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } + pub fn file(&self) -> Result<&FileData, String> { + match self.file.as_ref() { + Some(v) => Ok(v), + None => Err( + "Attempted to access file but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } +} +pub struct LabelOnFile; +impl LabelOnFile { + pub fn date_created() -> LabelOnFileDateCreatedField { + LabelOnFileDateCreatedField {} + } + pub fn label_id() -> LabelOnFileLabelIdField { + LabelOnFileLabelIdField {} + } + pub fn label() -> LabelOnFileLabelField { + LabelOnFileLabelField {} + } + pub fn file_id() -> LabelOnFileFileIdField { + LabelOnFileFileIdField {} + } + pub fn file() -> LabelOnFileFileField { + LabelOnFileFileField {} + } +} +pub struct LabelOnFileDateCreatedField {} +impl LabelOnFileDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + LabelOnFileSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LabelOnFileOrderByParam { + LabelOnFileOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> LabelOnFileCursor { + LabelOnFileCursor::DateCreated(cursor) + } + pub fn in_vec( + &self, + value: Vec>, + ) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedAfter(value) + } + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::DateCreatedAfterEquals(value) + } +} +pub struct LabelOnFileSetDateCreated(chrono::DateTime); +impl From for LabelOnFileSetParam { + fn from(value: LabelOnFileSetDateCreated) -> Self { + Self::SetDateCreated(value.0) + } +} +pub struct LabelOnFileLabelIdField {} +impl LabelOnFileLabelIdField { + pub fn set>(&self, value: i32) -> T { + LabelOnFileSetLabelId(value).into() + } + pub fn equals(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LabelOnFileOrderByParam { + LabelOnFileOrderByParam::LabelId(direction) + } + pub fn cursor(&self, cursor: i32) -> LabelOnFileCursor { + LabelOnFileCursor::LabelId(cursor) + } + pub fn increment(&self, value: i32) -> LabelOnFileSetParam { + LabelOnFileSetParam::LabelId(value) + } + pub fn decrement(&self, value: i32) -> LabelOnFileSetParam { + LabelOnFileSetParam::LabelId(value) + } + pub fn multiply(&self, value: i32) -> LabelOnFileSetParam { + LabelOnFileSetParam::LabelId(value) + } + pub fn divide(&self, value: i32) -> LabelOnFileSetParam { + LabelOnFileSetParam::LabelId(value) + } + pub fn in_vec(&self, value: Vec) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdLt(value) + } + pub fn lte(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdLte(value) + } + pub fn gt(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdGt(value) + } + pub fn gte(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdGte(value) + } + pub fn not(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdNot(value) + } + pub fn lt(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdLt(value) + } + pub fn lte(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdLte(value) + } + pub fn gt(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdGt(value) + } + pub fn gte(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIdGte(value) + } +} +pub struct LabelOnFileSetLabelId(i32); +impl From for LabelOnFileSetParam { + fn from(value: LabelOnFileSetLabelId) -> Self { + Self::SetLabelId(value.0) + } +} +pub struct LabelOnFileLabelField {} +impl LabelOnFileLabelField { + pub fn is(&self, value: Vec) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::LabelIs(value) + } + pub fn fetch(&self) -> LabelOnFileWithParam { + LabelOnFileWithParam::Label + } + pub fn link>(&self, value: LabelWhereUniqueParam) -> T { + LabelOnFileLinkLabel(value).into() + } +} +pub struct LabelOnFileLinkLabel(LabelWhereUniqueParam); +impl From for LabelOnFileSetParam { + fn from(value: LabelOnFileLinkLabel) -> Self { + Self::LinkLabel(value.0) + } +} +pub struct LabelOnFileFileIdField {} +impl LabelOnFileFileIdField { + pub fn set>(&self, value: i32) -> T { + LabelOnFileSetFileId(value).into() + } + pub fn equals(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> LabelOnFileOrderByParam { + LabelOnFileOrderByParam::FileId(direction) + } + pub fn cursor(&self, cursor: i32) -> LabelOnFileCursor { + LabelOnFileCursor::FileId(cursor) + } + pub fn increment(&self, value: i32) -> LabelOnFileSetParam { + LabelOnFileSetParam::FileId(value) + } + pub fn decrement(&self, value: i32) -> LabelOnFileSetParam { + LabelOnFileSetParam::FileId(value) + } + pub fn multiply(&self, value: i32) -> LabelOnFileSetParam { + LabelOnFileSetParam::FileId(value) + } + pub fn divide(&self, value: i32) -> LabelOnFileSetParam { + LabelOnFileSetParam::FileId(value) + } + pub fn in_vec(&self, value: Vec) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdLt(value) + } + pub fn lte(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdLte(value) + } + pub fn gt(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdGt(value) + } + pub fn gte(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdGte(value) + } + pub fn not(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdNot(value) + } + pub fn lt(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdLt(value) + } + pub fn lte(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdLte(value) + } + pub fn gt(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdGt(value) + } + pub fn gte(&self, value: i32) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIdGte(value) + } +} +pub struct LabelOnFileSetFileId(i32); +impl From for LabelOnFileSetParam { + fn from(value: LabelOnFileSetFileId) -> Self { + Self::SetFileId(value.0) + } +} +pub struct LabelOnFileFileField {} +impl LabelOnFileFileField { + pub fn is(&self, value: Vec) -> LabelOnFileWhereParam { + LabelOnFileWhereParam::FileIs(value) + } + pub fn fetch(&self) -> LabelOnFileWithParam { + LabelOnFileWithParam::File + } + pub fn link>(&self, value: FileWhereUniqueParam) -> T { + LabelOnFileLinkFile(value).into() + } +} +pub struct LabelOnFileLinkFile(FileWhereUniqueParam); +impl From for LabelOnFileSetParam { + fn from(value: LabelOnFileLinkFile) -> Self { + Self::LinkFile(value.0) + } +} +pub enum LabelOnFileWithParam { + Label, + File, +} +impl LabelOnFileWithParam { + pub fn to_output(self) -> Output { + match self { + Self::Label => Output { + name: "label".into(), + outputs: label_outputs(), + ..Default::default() + }, + Self::File => Output { + name: "file".into(), + outputs: file_outputs(), + ..Default::default() + }, + } + } +} +pub enum LabelOnFileSetParam { + SetDateCreated(chrono::DateTime), + SetLabelId(i32), + LinkLabel(LabelWhereUniqueParam), + SetFileId(i32), + LinkFile(FileWhereUniqueParam), +} +impl LabelOnFileSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetLabelId(value) => Field { name: "label_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkLabel(where_param) => Field { + name: "label".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![Into::::into( + where_param, + ) + .to_field()])), + ..Default::default() + }]), + ..Default::default() + }, + Self::SetFileId(value) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkFile(where_param) => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![Into::::into( + where_param, + ) + .to_field()])), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum LabelOnFileOrderByParam { + DateCreated(Direction), + LabelId(Direction), + FileId(Direction), +} +impl LabelOnFileOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::LabelId(direction) => Field { + name: "label_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::FileId(direction) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum LabelOnFileCursor { + DateCreated(chrono::DateTime), + LabelId(i32), + FileId(i32), +} +impl LabelOnFileCursor { + fn to_field(self) -> Field { + match self { + Self::DateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LabelId(value) => Field { + name: "label_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::FileId(value) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum LabelOnFileWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + LabelIdEquals(i32), + LabelIdInVec(Vec), + LabelIdNotInVec(Vec), + LabelIdLt(i32), + LabelIdLte(i32), + LabelIdGt(i32), + LabelIdGte(i32), + LabelIdNot(i32), + LabelIdLt(i32), + LabelIdLte(i32), + LabelIdGt(i32), + LabelIdGte(i32), + LabelIs(Vec), + FileIdEquals(i32), + FileIdInVec(Vec), + FileIdNotInVec(Vec), + FileIdLt(i32), + FileIdLte(i32), + FileIdGt(i32), + FileIdGte(i32), + FileIdNot(i32), + FileIdLt(i32), + FileIdLte(i32), + FileIdGt(i32), + FileIdGte(i32), + FileIs(Vec), +} +impl LabelOnFileWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), fields: Some(vec![Field { name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -10779,17 +24380,44 @@ impl LabelOnFileWhereParam { }]), ..Default::default() }, - Self::LabelIs(value) => Field { - name: "label".into(), + Self::LabelIdInVec(value) => Field { + name: "label_id".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::FileIdLT(value) => Field { - name: "file_id".into(), + Self::LabelIdNotInVec(value) => Field { + name: "label_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::LabelIdLt(value) => Field { + name: "label_id".into(), fields: Some(vec![Field { name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -10797,17 +24425,8 @@ impl LabelOnFileWhereParam { }]), ..Default::default() }, - Self::FileIdGT(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdLTE(value) => Field { - name: "file_id".into(), + Self::LabelIdLte(value) => Field { + name: "label_id".into(), fields: Some(vec![Field { name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -10815,8 +24434,17 @@ impl LabelOnFileWhereParam { }]), ..Default::default() }, - Self::FileIdGTE(value) => Field { - name: "file_id".into(), + Self::LabelIdGt(value) => Field { + name: "label_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LabelIdGte(value) => Field { + name: "label_id".into(), fields: Some(vec![Field { name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -10824,6 +24452,60 @@ impl LabelOnFileWhereParam { }]), ..Default::default() }, + Self::LabelIdNot(value) => Field { + name: "label_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LabelIdLt(value) => Field { + name: "label_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LabelIdLte(value) => Field { + name: "label_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LabelIdGt(value) => Field { + name: "label_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LabelIdGte(value) => Field { + name: "label_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LabelIs(value) => Field { + name: "label".into(), + fields: Some(vec![Field { + name: "is".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, Self::FileIdEquals(value) => Field { name: "file_id".into(), fields: Some(vec![Field { @@ -10833,39 +24515,141 @@ impl LabelOnFileWhereParam { }]), ..Default::default() }, - Self::FileIs(value) => Field { - name: "file".into(), + Self::FileIdInVec(value) => Field { + name: "file_id".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), + Self::FileIdNotInVec(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), ..Default::default() }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), + Self::FileIdLt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), ..Default::default() }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), + Self::FileIdLte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdNot(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIs(value) => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "is".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), ..Default::default() }, } } } +pub enum LabelOnFileWhereUniqueParam {} +impl From for LabelOnFileWhereParam { + fn from(value: LabelOnFileWhereUniqueParam) -> Self { + match value {} + } +} impl From> for LabelOnFileWhereParam { fn from(op: Operator) -> Self { match op { @@ -10875,86 +24659,32 @@ impl From> for LabelOnFileWhereParam { } } } -pub struct LabelOnFileWith { - pub param: LabelOnFileWithParam, -} -pub enum LabelOnFileWithParam { - Label, - File, -} -impl From for LabelOnFileWith { - fn from(param: LabelOnFileWithParam) -> Self { - Self { param } - } -} -impl LabelOnFileWithParam { - pub fn output(self) -> Output { - match self { - Self::Label => Output { - name: "label".into(), - outputs: label_outputs(), - ..Default::default() - }, - Self::File => Output { - name: "file".into(), - outputs: file_outputs(), - ..Default::default() - }, - } - } -} -pub enum LabelOnFileSetParam { - DateCreated(chrono::DateTime), - LabelId(i64), - LinkLabel(LabelWhereParam), - FileId(i64), - LinkFile(FileWhereParam), -} -impl LabelOnFileSetParam { - pub fn field(self) -> Field { - match self { - Self::DateCreated(value) => Field { - name: "date_created".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LabelId(value) => Field { - name: "label_id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LinkLabel(where_param) => Field { - name: "label".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals(vec![where_param.field()])), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileId(value) => Field { - name: "file_id".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }, - Self::LinkFile(where_param) => Field { - name: "file".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals(vec![where_param.field()])), - ..Default::default() - }]), - ..Default::default() - }, - } - } -} pub struct LabelOnFileFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> LabelOnFileFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> LabelOnFileDelete<'a> { LabelOnFileDelete { @@ -10967,13 +24697,16 @@ impl<'a> LabelOnFileFindMany<'a> { }, } } - pub fn update(mut self, params: Vec) -> LabelOnFileUpdateMany<'a> { + pub fn update( + mut self, + params: Vec, + ) -> LabelOnFileUpdateMany<'a> { self.query.inputs.push(Input { name: "data".into(), fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -10993,33 +24726,119 @@ impl<'a> LabelOnFileFindMany<'a> { method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: LabelOnFileOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: LabelOnFileWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LabelOnFileCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct LabelOnFileFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> LabelOnFileFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LabelOnFileWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: LabelOnFileOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: LabelOnFileCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct LabelOnFileFindUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LabelOnFileFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> LabelOnFileDelete<'a> { LabelOnFileDelete { @@ -11031,13 +24850,16 @@ impl<'a> LabelOnFileFindUnique<'a> { }, } } - pub fn update(mut self, params: Vec) -> LabelOnFileUpdateUnique<'a> { + pub fn update( + mut self, + params: Vec, + ) -> LabelOnFileUpdateUnique<'a> { self.query.inputs.push(Input { name: "data".into(), fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -11057,45 +24879,107 @@ impl<'a> LabelOnFileFindUnique<'a> { method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LabelOnFileWithParam) -> Self { + self.with_params.push(param); self } } pub struct LabelOnFileCreateOne<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LabelOnFileCreateOne<'a> { - pub async fn exec(self) -> LabelOnFileData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: LabelOnFileWithParam) -> Self { + self.with_params.push(param); + self } } pub struct LabelOnFileUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LabelOnFileUpdateUnique<'a> { - pub async fn exec(self) -> LabelOnFileData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LabelOnFileWithParam) -> Self { + self.with_params.push(param); self } } pub struct LabelOnFileUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> LabelOnFileUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: LabelOnFileWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct LabelOnFileUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> LabelOnFileUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + label: LabelOnFileLinkLabel, + file: LabelOnFileLinkFile, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(LabelOnFileSetParam::from(label).to_field()); + input_fields.push(LabelOnFileSetParam::from(file).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); self } } @@ -11103,18 +24987,25 @@ pub struct LabelOnFileDelete<'a> { query: Query<'a>, } impl<'a> LabelOnFileDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) } } pub struct LabelOnFileActions<'a> { client: &'a PrismaClient, } impl<'a> LabelOnFileActions<'a> { - pub fn find_unique(&self, param: LabelOnFileWhereParam) -> LabelOnFileFindUnique { - let fields = transform_equals(vec![param.field()]); + pub fn find_unique( + &self, + param: LabelOnFileWhereUniqueParam, + ) -> LabelOnFileFindUnique { + let param: LabelOnFileWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), @@ -11126,10 +25017,14 @@ impl<'a> LabelOnFileActions<'a> { ..Default::default() }], }; - LabelOnFileFindUnique { query } + LabelOnFileFindUnique { + query, + with_params: vec![], + } } pub fn find_first(&self, params: Vec) -> LabelOnFileFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -11146,7 +25041,10 @@ impl<'a> LabelOnFileActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), @@ -11154,10 +25052,15 @@ impl<'a> LabelOnFileActions<'a> { outputs: label_on_file_outputs(), inputs, }; - LabelOnFileFindFirst { query } + LabelOnFileFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn find_many(&self, params: Vec) -> LabelOnFileFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -11168,7 +25071,10 @@ impl<'a> LabelOnFileActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), @@ -11176,7 +25082,11 @@ impl<'a> LabelOnFileActions<'a> { outputs: label_on_file_outputs(), inputs, }; - LabelOnFileFindMany { query } + LabelOnFileFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn create_one( &self, @@ -11184,11 +25094,15 @@ impl<'a> LabelOnFileActions<'a> { file: LabelOnFileLinkFile, params: Vec, ) -> LabelOnFileCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(LabelOnFileSetParam::from(label).field()); - input_fields.push(LabelOnFileSetParam::from(file).field()); + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(LabelOnFileSetParam::from(label).to_field()); + input_fields.push(LabelOnFileSetParam::from(file).to_field()); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), @@ -11200,7 +25114,31 @@ impl<'a> LabelOnFileActions<'a> { ..Default::default() }], }; - LabelOnFileCreateOne { query } + LabelOnFileCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: LabelOnFileWhereUniqueParam) -> LabelOnFileUpsertOne { + let param: LabelOnFileWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "LabelOnFile".into(), + outputs: label_on_file_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + LabelOnFileUpsertOne { query } } } fn job_outputs() -> Vec { @@ -11220,19 +25158,19 @@ pub struct JobData { #[serde(rename = "id")] pub id: String, #[serde(rename = "action")] - pub action: i64, + pub action: i32, #[serde(rename = "status")] - pub status: i64, + pub status: i32, #[serde(rename = "task_count")] - pub task_count: i64, + pub task_count: i32, #[serde(rename = "completed_task_count")] - pub completed_task_count: i64, + pub completed_task_count: i32, #[serde(rename = "date_created")] pub date_created: chrono::DateTime, #[serde(rename = "date_modified")] pub date_modified: chrono::DateTime, #[serde(rename = "seconds_elapsed")] - pub seconds_elapsed: i64, + pub seconds_elapsed: i32, } impl JobData {} pub struct Job; @@ -11263,145 +25201,364 @@ impl Job { } } pub struct JobIdField {} -pub struct JobSetId(String); -impl From for JobSetParam { - fn from(value: JobSetId) -> Self { - Self::Id(value.0) - } -} impl JobIdField { + pub fn set>(&self, value: String) -> T { + JobSetId(value).into() + } + pub fn equals>(&self, value: String) -> T { + JobWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> JobOrderByParam { + JobOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: String) -> JobCursor { + JobCursor::Id(cursor) + } + pub fn in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: String) -> JobWhereParam { + JobWhereParam::IdLt(value) + } + pub fn lte(&self, value: String) -> JobWhereParam { + JobWhereParam::IdLte(value) + } + pub fn gt(&self, value: String) -> JobWhereParam { + JobWhereParam::IdGt(value) + } + pub fn gte(&self, value: String) -> JobWhereParam { + JobWhereParam::IdGte(value) + } pub fn contains(&self, value: String) -> JobWhereParam { JobWhereParam::IdContains(value) } + pub fn starts_with(&self, value: String) -> JobWhereParam { + JobWhereParam::IdStartsWith(value) + } + pub fn ends_with(&self, value: String) -> JobWhereParam { + JobWhereParam::IdEndsWith(value) + } + pub fn not(&self, value: String) -> JobWhereParam { + JobWhereParam::IdNot(value) + } pub fn has_prefix(&self, value: String) -> JobWhereParam { JobWhereParam::IdHasPrefix(value) } pub fn has_suffix(&self, value: String) -> JobWhereParam { JobWhereParam::IdHasSuffix(value) } - pub fn equals(&self, value: String) -> JobWhereParam { - JobWhereParam::IdEquals(value) - } - pub fn set>(&self, value: String) -> T { - JobSetId(value).into() +} +pub struct JobSetId(String); +impl From for JobSetParam { + fn from(value: JobSetId) -> Self { + Self::SetId(value.0) } } pub struct JobActionField {} -pub struct JobSetAction(i64); -impl From for JobSetParam { - fn from(value: JobSetAction) -> Self { - Self::Action(value.0) +impl JobActionField { + pub fn set>(&self, value: i32) -> T { + JobSetAction(value).into() + } + pub fn equals(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionEquals(value).into() + } + pub fn order(&self, direction: Direction) -> JobOrderByParam { + JobOrderByParam::Action(direction) + } + pub fn cursor(&self, cursor: i32) -> JobCursor { + JobCursor::Action(cursor) + } + pub fn increment(&self, value: i32) -> JobSetParam { + JobSetParam::Action(value) + } + pub fn decrement(&self, value: i32) -> JobSetParam { + JobSetParam::Action(value) + } + pub fn multiply(&self, value: i32) -> JobSetParam { + JobSetParam::Action(value) + } + pub fn divide(&self, value: i32) -> JobSetParam { + JobSetParam::Action(value) + } + pub fn in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::ActionInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::ActionNotInVec(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionGte(value) + } + pub fn not(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionNot(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::ActionGte(value) } } -impl JobActionField { - pub fn lt(&self, value: i64) -> JobWhereParam { - JobWhereParam::ActionLT(value) - } - pub fn gt(&self, value: i64) -> JobWhereParam { - JobWhereParam::ActionGT(value) - } - pub fn lte(&self, value: i64) -> JobWhereParam { - JobWhereParam::ActionLTE(value) - } - pub fn gte(&self, value: i64) -> JobWhereParam { - JobWhereParam::ActionGTE(value) - } - pub fn equals(&self, value: i64) -> JobWhereParam { - JobWhereParam::ActionEquals(value) - } - pub fn set>(&self, value: i64) -> T { - JobSetAction(value).into() +pub struct JobSetAction(i32); +impl From for JobSetParam { + fn from(value: JobSetAction) -> Self { + Self::SetAction(value.0) } } pub struct JobStatusField {} -pub struct JobSetStatus(i64); -impl From for JobSetParam { - fn from(value: JobSetStatus) -> Self { - Self::Status(value.0) +impl JobStatusField { + pub fn set>(&self, value: i32) -> T { + JobSetStatus(value).into() + } + pub fn equals(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusEquals(value).into() + } + pub fn order(&self, direction: Direction) -> JobOrderByParam { + JobOrderByParam::Status(direction) + } + pub fn cursor(&self, cursor: i32) -> JobCursor { + JobCursor::Status(cursor) + } + pub fn increment(&self, value: i32) -> JobSetParam { + JobSetParam::Status(value) + } + pub fn decrement(&self, value: i32) -> JobSetParam { + JobSetParam::Status(value) + } + pub fn multiply(&self, value: i32) -> JobSetParam { + JobSetParam::Status(value) + } + pub fn divide(&self, value: i32) -> JobSetParam { + JobSetParam::Status(value) + } + pub fn in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::StatusInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::StatusNotInVec(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusGte(value) + } + pub fn not(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusNot(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::StatusGte(value) } } -impl JobStatusField { - pub fn lt(&self, value: i64) -> JobWhereParam { - JobWhereParam::StatusLT(value) - } - pub fn gt(&self, value: i64) -> JobWhereParam { - JobWhereParam::StatusGT(value) - } - pub fn lte(&self, value: i64) -> JobWhereParam { - JobWhereParam::StatusLTE(value) - } - pub fn gte(&self, value: i64) -> JobWhereParam { - JobWhereParam::StatusGTE(value) - } - pub fn equals(&self, value: i64) -> JobWhereParam { - JobWhereParam::StatusEquals(value) - } - pub fn set>(&self, value: i64) -> T { - JobSetStatus(value).into() +pub struct JobSetStatus(i32); +impl From for JobSetParam { + fn from(value: JobSetStatus) -> Self { + Self::SetStatus(value.0) } } pub struct JobTaskCountField {} -pub struct JobSetTaskCount(i64); -impl From for JobSetParam { - fn from(value: JobSetTaskCount) -> Self { - Self::TaskCount(value.0) +impl JobTaskCountField { + pub fn set>(&self, value: i32) -> T { + JobSetTaskCount(value).into() + } + pub fn equals(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountEquals(value).into() + } + pub fn order(&self, direction: Direction) -> JobOrderByParam { + JobOrderByParam::TaskCount(direction) + } + pub fn cursor(&self, cursor: i32) -> JobCursor { + JobCursor::TaskCount(cursor) + } + pub fn increment(&self, value: i32) -> JobSetParam { + JobSetParam::TaskCount(value) + } + pub fn decrement(&self, value: i32) -> JobSetParam { + JobSetParam::TaskCount(value) + } + pub fn multiply(&self, value: i32) -> JobSetParam { + JobSetParam::TaskCount(value) + } + pub fn divide(&self, value: i32) -> JobSetParam { + JobSetParam::TaskCount(value) + } + pub fn in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::TaskCountInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::TaskCountNotInVec(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountGte(value) + } + pub fn not(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountNot(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::TaskCountGte(value) } } -impl JobTaskCountField { - pub fn lt(&self, value: i64) -> JobWhereParam { - JobWhereParam::TaskCountLT(value) - } - pub fn gt(&self, value: i64) -> JobWhereParam { - JobWhereParam::TaskCountGT(value) - } - pub fn lte(&self, value: i64) -> JobWhereParam { - JobWhereParam::TaskCountLTE(value) - } - pub fn gte(&self, value: i64) -> JobWhereParam { - JobWhereParam::TaskCountGTE(value) - } - pub fn equals(&self, value: i64) -> JobWhereParam { - JobWhereParam::TaskCountEquals(value) - } - pub fn set>(&self, value: i64) -> T { - JobSetTaskCount(value).into() +pub struct JobSetTaskCount(i32); +impl From for JobSetParam { + fn from(value: JobSetTaskCount) -> Self { + Self::SetTaskCount(value.0) } } pub struct JobCompletedTaskCountField {} -pub struct JobSetCompletedTaskCount(i64); -impl From for JobSetParam { - fn from(value: JobSetCompletedTaskCount) -> Self { - Self::CompletedTaskCount(value.0) +impl JobCompletedTaskCountField { + pub fn set>(&self, value: i32) -> T { + JobSetCompletedTaskCount(value).into() + } + pub fn equals(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountEquals(value).into() + } + pub fn order(&self, direction: Direction) -> JobOrderByParam { + JobOrderByParam::CompletedTaskCount(direction) + } + pub fn cursor(&self, cursor: i32) -> JobCursor { + JobCursor::CompletedTaskCount(cursor) + } + pub fn increment(&self, value: i32) -> JobSetParam { + JobSetParam::CompletedTaskCount(value) + } + pub fn decrement(&self, value: i32) -> JobSetParam { + JobSetParam::CompletedTaskCount(value) + } + pub fn multiply(&self, value: i32) -> JobSetParam { + JobSetParam::CompletedTaskCount(value) + } + pub fn divide(&self, value: i32) -> JobSetParam { + JobSetParam::CompletedTaskCount(value) + } + pub fn in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::CompletedTaskCountInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::CompletedTaskCountNotInVec(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountGte(value) + } + pub fn not(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountNot(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::CompletedTaskCountGte(value) } } -impl JobCompletedTaskCountField { - pub fn lt(&self, value: i64) -> JobWhereParam { - JobWhereParam::CompletedTaskCountLT(value) - } - pub fn gt(&self, value: i64) -> JobWhereParam { - JobWhereParam::CompletedTaskCountGT(value) - } - pub fn lte(&self, value: i64) -> JobWhereParam { - JobWhereParam::CompletedTaskCountLTE(value) - } - pub fn gte(&self, value: i64) -> JobWhereParam { - JobWhereParam::CompletedTaskCountGTE(value) - } - pub fn equals(&self, value: i64) -> JobWhereParam { - JobWhereParam::CompletedTaskCountEquals(value) - } - pub fn set>(&self, value: i64) -> T { - JobSetCompletedTaskCount(value).into() +pub struct JobSetCompletedTaskCount(i32); +impl From for JobSetParam { + fn from(value: JobSetCompletedTaskCount) -> Self { + Self::SetCompletedTaskCount(value.0) } } pub struct JobDateCreatedField {} -pub struct JobSetDateCreated(chrono::DateTime); -impl From for JobSetParam { - fn from(value: JobSetDateCreated) -> Self { - Self::DateCreated(value.0) - } -} impl JobDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + JobSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> JobOrderByParam { + JobOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> JobCursor { + JobCursor::DateCreated(cursor) + } + pub fn in_vec(&self, value: Vec>) -> JobWhereParam { + JobWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec(&self, value: Vec>) -> JobWhereParam { + JobWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateCreatedNot(value) + } pub fn before(&self, value: chrono::DateTime) -> JobWhereParam { JobWhereParam::DateCreatedBefore(value) } @@ -11414,21 +25571,51 @@ impl JobDateCreatedField { pub fn after_equals(&self, value: chrono::DateTime) -> JobWhereParam { JobWhereParam::DateCreatedAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> JobWhereParam { - JobWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - JobSetDateCreated(value).into() +} +pub struct JobSetDateCreated(chrono::DateTime); +impl From for JobSetParam { + fn from(value: JobSetDateCreated) -> Self { + Self::SetDateCreated(value.0) } } pub struct JobDateModifiedField {} -pub struct JobSetDateModified(chrono::DateTime); -impl From for JobSetParam { - fn from(value: JobSetDateModified) -> Self { - Self::DateModified(value.0) - } -} impl JobDateModifiedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + JobSetDateModified(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> JobOrderByParam { + JobOrderByParam::DateModified(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> JobCursor { + JobCursor::DateModified(cursor) + } + pub fn in_vec(&self, value: Vec>) -> JobWhereParam { + JobWhereParam::DateModifiedInVec(value) + } + pub fn not_in_vec(&self, value: Vec>) -> JobWhereParam { + JobWhereParam::DateModifiedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> JobWhereParam { + JobWhereParam::DateModifiedNot(value) + } pub fn before(&self, value: chrono::DateTime) -> JobWhereParam { JobWhereParam::DateModifiedBefore(value) } @@ -11441,497 +25628,209 @@ impl JobDateModifiedField { pub fn after_equals(&self, value: chrono::DateTime) -> JobWhereParam { JobWhereParam::DateModifiedAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> JobWhereParam { - JobWhereParam::DateModifiedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - JobSetDateModified(value).into() +} +pub struct JobSetDateModified(chrono::DateTime); +impl From for JobSetParam { + fn from(value: JobSetDateModified) -> Self { + Self::SetDateModified(value.0) } } pub struct JobSecondsElapsedField {} -pub struct JobSetSecondsElapsed(i64); -impl From for JobSetParam { - fn from(value: JobSetSecondsElapsed) -> Self { - Self::SecondsElapsed(value.0) - } -} impl JobSecondsElapsedField { - pub fn lt(&self, value: i64) -> JobWhereParam { - JobWhereParam::SecondsElapsedLT(value) - } - pub fn gt(&self, value: i64) -> JobWhereParam { - JobWhereParam::SecondsElapsedGT(value) - } - pub fn lte(&self, value: i64) -> JobWhereParam { - JobWhereParam::SecondsElapsedLTE(value) - } - pub fn gte(&self, value: i64) -> JobWhereParam { - JobWhereParam::SecondsElapsedGTE(value) - } - pub fn equals(&self, value: i64) -> JobWhereParam { - JobWhereParam::SecondsElapsedEquals(value) - } - pub fn set>(&self, value: i64) -> T { + pub fn set>(&self, value: i32) -> T { JobSetSecondsElapsed(value).into() } -} -pub enum JobWhereParam { - IdContains(String), - IdHasPrefix(String), - IdHasSuffix(String), - IdEquals(String), - ActionLT(i64), - ActionGT(i64), - ActionLTE(i64), - ActionGTE(i64), - ActionEquals(i64), - StatusLT(i64), - StatusGT(i64), - StatusLTE(i64), - StatusGTE(i64), - StatusEquals(i64), - TaskCountLT(i64), - TaskCountGT(i64), - TaskCountLTE(i64), - TaskCountGTE(i64), - TaskCountEquals(i64), - CompletedTaskCountLT(i64), - CompletedTaskCountGT(i64), - CompletedTaskCountLTE(i64), - CompletedTaskCountGTE(i64), - CompletedTaskCountEquals(i64), - DateCreatedBefore(chrono::DateTime), - DateCreatedAfter(chrono::DateTime), - DateCreatedBeforeEquals(chrono::DateTime), - DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), - DateModifiedBefore(chrono::DateTime), - DateModifiedAfter(chrono::DateTime), - DateModifiedBeforeEquals(chrono::DateTime), - DateModifiedAfterEquals(chrono::DateTime), - DateModifiedEquals(chrono::DateTime), - SecondsElapsedLT(i64), - SecondsElapsedGT(i64), - SecondsElapsedLTE(i64), - SecondsElapsedGTE(i64), - SecondsElapsedEquals(i64), - Not(Vec), - Or(Vec), - And(Vec), -} -impl JobWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdContains(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdHasPrefix(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdHasSuffix(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdEquals(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ActionLT(value) => Field { - name: "action".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ActionGT(value) => Field { - name: "action".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ActionLTE(value) => Field { - name: "action".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ActionGTE(value) => Field { - name: "action".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::ActionEquals(value) => Field { - name: "action".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::StatusLT(value) => Field { - name: "status".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::StatusGT(value) => Field { - name: "status".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::StatusLTE(value) => Field { - name: "status".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::StatusGTE(value) => Field { - name: "status".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::StatusEquals(value) => Field { - name: "status".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TaskCountLT(value) => Field { - name: "task_count".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TaskCountGT(value) => Field { - name: "task_count".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TaskCountLTE(value) => Field { - name: "task_count".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TaskCountGTE(value) => Field { - name: "task_count".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::TaskCountEquals(value) => Field { - name: "task_count".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::CompletedTaskCountLT(value) => Field { - name: "completed_task_count".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::CompletedTaskCountGT(value) => Field { - name: "completed_task_count".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::CompletedTaskCountLTE(value) => Field { - name: "completed_task_count".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::CompletedTaskCountGTE(value) => Field { - name: "completed_task_count".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::CompletedTaskCountEquals(value) => Field { - name: "completed_task_count".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBefore(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfter(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBeforeEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfterEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedBefore(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedAfter(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedBeforeEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedAfterEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SecondsElapsedLT(value) => Field { - name: "seconds_elapsed".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SecondsElapsedGT(value) => Field { - name: "seconds_elapsed".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SecondsElapsedLTE(value) => Field { - name: "seconds_elapsed".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SecondsElapsedGTE(value) => Field { - name: "seconds_elapsed".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::SecondsElapsedEquals(value) => Field { - name: "seconds_elapsed".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - } + pub fn equals(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> JobOrderByParam { + JobOrderByParam::SecondsElapsed(direction) + } + pub fn cursor(&self, cursor: i32) -> JobCursor { + JobCursor::SecondsElapsed(cursor) + } + pub fn increment(&self, value: i32) -> JobSetParam { + JobSetParam::SecondsElapsed(value) + } + pub fn decrement(&self, value: i32) -> JobSetParam { + JobSetParam::SecondsElapsed(value) + } + pub fn multiply(&self, value: i32) -> JobSetParam { + JobSetParam::SecondsElapsed(value) + } + pub fn divide(&self, value: i32) -> JobSetParam { + JobSetParam::SecondsElapsed(value) + } + pub fn in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::SecondsElapsedInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> JobWhereParam { + JobWhereParam::SecondsElapsedNotInVec(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedGte(value) + } + pub fn not(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedNot(value) + } + pub fn lt(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedLt(value) + } + pub fn lte(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedLte(value) + } + pub fn gt(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedGt(value) + } + pub fn gte(&self, value: i32) -> JobWhereParam { + JobWhereParam::SecondsElapsedGte(value) } } -impl From> for JobWhereParam { - fn from(op: Operator) -> Self { - match op { - Operator::Not(value) => Self::Not(value), - Operator::And(value) => Self::And(value), - Operator::Or(value) => Self::Or(value), - } +pub struct JobSetSecondsElapsed(i32); +impl From for JobSetParam { + fn from(value: JobSetSecondsElapsed) -> Self { + Self::SetSecondsElapsed(value.0) } } -pub struct JobWith { - pub param: JobWithParam, -} pub enum JobWithParam {} -impl From for JobWith { - fn from(param: JobWithParam) -> Self { - Self { param } - } -} impl JobWithParam { - pub fn output(self) -> Output { + pub fn to_output(self) -> Output { match self {} } } pub enum JobSetParam { - Id(String), - Action(i64), - Status(i64), - TaskCount(i64), - CompletedTaskCount(i64), - DateCreated(chrono::DateTime), - DateModified(chrono::DateTime), - SecondsElapsed(i64), + SetId(String), + SetAction(i32), + SetStatus(i32), + SetTaskCount(i32), + SetCompletedTaskCount(i32), + SetDateCreated(chrono::DateTime), + SetDateModified(chrono::DateTime), + SetSecondsElapsed(i32), } impl JobSetParam { - pub fn field(self) -> Field { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetAction(value) => Field { + name: "action".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetStatus(value) => Field { + name: "status".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetTaskCount(value) => Field { + name: "task_count".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetCompletedTaskCount(value) => Field { + name: "completed_task_count".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetSecondsElapsed(value) => Field { + name: "seconds_elapsed".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum JobOrderByParam { + Id(Direction), + Action(Direction), + Status(Direction), + TaskCount(Direction), + CompletedTaskCount(Direction), + DateCreated(Direction), + DateModified(Direction), + SecondsElapsed(Direction), +} +impl JobOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Action(direction) => Field { + name: "action".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Status(direction) => Field { + name: "status".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::TaskCount(direction) => Field { + name: "task_count".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::CompletedTaskCount(direction) => Field { + name: "completed_task_count".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateModified(direction) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::SecondsElapsed(direction) => Field { + name: "seconds_elapsed".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum JobCursor { + Id(String), + Action(i32), + Status(i32), + TaskCount(i32), + CompletedTaskCount(i32), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), + SecondsElapsed(i32), +} +impl JobCursor { + fn to_field(self) -> Field { match self { Self::Id(value) => Field { name: "id".into(), @@ -11976,563 +25875,130 @@ impl JobSetParam { } } } -pub struct JobFindMany<'a> { - query: Query<'a>, -} -impl<'a> JobFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> JobDelete<'a> { - JobDelete { - query: Query { - operation: "mutation".into(), - method: "deleteMany".into(), - model: "Job".into(), - outputs: vec![Output::new("count")], - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> JobUpdateMany<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - JobUpdateMany { - query: Query { - operation: "mutation".into(), - method: "updateMany".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct JobFindFirst<'a> { - query: Query<'a>, -} -impl<'a> JobFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct JobFindUnique<'a> { - query: Query<'a>, -} -impl<'a> JobFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> JobDelete<'a> { - JobDelete { - query: Query { - operation: "mutation".into(), - method: "deleteOne".into(), - model: "Job".into(), - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> JobUpdateUnique<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - JobUpdateUnique { - query: Query { - operation: "mutation".into(), - method: "updateOne".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct JobCreateOne<'a> { - query: Query<'a>, -} -impl<'a> JobCreateOne<'a> { - pub async fn exec(self) -> JobData { - self.query.perform::().await.unwrap() - } -} -pub struct JobUpdateUnique<'a> { - query: Query<'a>, -} -impl<'a> JobUpdateUnique<'a> { - pub async fn exec(self) -> JobData { - self.query.perform::().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct JobUpdateMany<'a> { - query: Query<'a>, -} -impl<'a> JobUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct JobDelete<'a> { - query: Query<'a>, -} -impl<'a> JobDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count - } -} -pub struct JobActions<'a> { - client: &'a PrismaClient, -} -impl<'a> JobActions<'a> { - pub fn find_unique(&self, param: JobWhereParam) -> JobFindUnique { - let fields = transform_equals(vec![param.field()]); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findUnique".into(), - model: "Job".into(), - outputs: job_outputs(), - inputs: vec![Input { - name: "where".into(), - fields, - ..Default::default() - }], - }; - JobFindUnique { query } - } - pub fn find_first(&self, params: Vec) -> JobFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: vec![Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(where_fields), - ..Default::default() - }], - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findFirst".into(), - model: "Job".into(), - outputs: job_outputs(), - inputs, - }; - JobFindFirst { query } - } - pub fn find_many(&self, params: Vec) -> JobFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_fields, - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findMany".into(), - model: "Job".into(), - outputs: job_outputs(), - inputs, - }; - JobFindMany { query } - } - pub fn create_one(&self, id: JobSetId, action: JobSetAction, params: Vec) -> JobCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(JobSetParam::from(id).field()); - input_fields.push(JobSetParam::from(action).field()); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "mutation".into(), - method: "createOne".into(), - model: "Job".into(), - outputs: job_outputs(), - inputs: vec![Input { - name: "data".into(), - fields: input_fields, - ..Default::default() - }], - }; - JobCreateOne { query } - } -} -fn space_outputs() -> Vec { - vec![ - Output::new("id"), - Output::new("name"), - Output::new("encryption"), - Output::new("date_created"), - Output::new("date_modified"), - Output::new("libraryId"), - ] -} -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SpaceData { - #[serde(rename = "id")] - pub id: i64, - #[serde(rename = "name")] - pub name: String, - #[serde(rename = "encryption")] - pub encryption: Option, - #[serde(rename = "date_created")] - pub date_created: chrono::DateTime, - #[serde(rename = "date_modified")] - pub date_modified: chrono::DateTime, - #[serde(rename = "Library")] - pub library: Box>, - #[serde(rename = "libraryId")] - pub library_id: Option, -} -impl SpaceData { - pub fn library(&self) -> Option<&LibraryData> { - self.library.as_ref().as_ref() - } -} -pub struct Space; -impl Space { - pub fn id() -> SpaceIdField { - SpaceIdField {} - } - pub fn name() -> SpaceNameField { - SpaceNameField {} - } - pub fn encryption() -> SpaceEncryptionField { - SpaceEncryptionField {} - } - pub fn date_created() -> SpaceDateCreatedField { - SpaceDateCreatedField {} - } - pub fn date_modified() -> SpaceDateModifiedField { - SpaceDateModifiedField {} - } - pub fn library() -> SpaceLibraryField { - SpaceLibraryField {} - } - pub fn library_id() -> SpaceLibraryIdField { - SpaceLibraryIdField {} - } -} -pub struct SpaceIdField {} -pub struct SpaceSetId(i64); -impl From for SpaceSetParam { - fn from(value: SpaceSetId) -> Self { - Self::Id(value.0) - } -} -impl SpaceIdField { - pub fn lt(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - SpaceSetId(value).into() - } -} -pub struct SpaceNameField {} -pub struct SpaceSetName(String); -impl From for SpaceSetParam { - fn from(value: SpaceSetName) -> Self { - Self::Name(value.0) - } -} -impl SpaceNameField { - pub fn contains(&self, value: String) -> SpaceWhereParam { - SpaceWhereParam::NameContains(value) - } - pub fn has_prefix(&self, value: String) -> SpaceWhereParam { - SpaceWhereParam::NameHasPrefix(value) - } - pub fn has_suffix(&self, value: String) -> SpaceWhereParam { - SpaceWhereParam::NameHasSuffix(value) - } - pub fn equals(&self, value: String) -> SpaceWhereParam { - SpaceWhereParam::NameEquals(value) - } - pub fn set>(&self, value: String) -> T { - SpaceSetName(value).into() - } -} -pub struct SpaceEncryptionField {} -pub struct SpaceSetEncryption(i64); -impl From for SpaceSetParam { - fn from(value: SpaceSetEncryption) -> Self { - Self::Encryption(value.0) - } -} -impl SpaceEncryptionField { - pub fn lt(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::EncryptionLT(value) - } - pub fn gt(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::EncryptionGT(value) - } - pub fn lte(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::EncryptionLTE(value) - } - pub fn gte(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::EncryptionGTE(value) - } - pub fn equals(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::EncryptionEquals(value) - } - pub fn set>(&self, value: i64) -> T { - SpaceSetEncryption(value).into() - } -} -pub struct SpaceDateCreatedField {} -pub struct SpaceSetDateCreated(chrono::DateTime); -impl From for SpaceSetParam { - fn from(value: SpaceSetDateCreated) -> Self { - Self::DateCreated(value.0) - } -} -impl SpaceDateCreatedField { - pub fn before(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateCreatedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateCreatedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateCreatedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateCreatedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - SpaceSetDateCreated(value).into() - } -} -pub struct SpaceDateModifiedField {} -pub struct SpaceSetDateModified(chrono::DateTime); -impl From for SpaceSetParam { - fn from(value: SpaceSetDateModified) -> Self { - Self::DateModified(value.0) - } -} -impl SpaceDateModifiedField { - pub fn before(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateModifiedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateModifiedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateModifiedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateModifiedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> SpaceWhereParam { - SpaceWhereParam::DateModifiedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - SpaceSetDateModified(value).into() - } -} -pub struct SpaceLibraryField {} -pub struct SpaceLinkLibrary(LibraryWhereParam); -impl From for SpaceSetParam { - fn from(value: SpaceLinkLibrary) -> Self { - Self::LinkLibrary(value.0) - } -} -impl SpaceLibraryField { - pub fn is(&self, value: Vec) -> SpaceWhereParam { - SpaceWhereParam::LibraryIs(value) - } - pub fn link>(&self, value: LibraryWhereParam) -> T { - SpaceLinkLibrary(value).into() - } - pub fn fetch(&self) -> SpaceWith { - SpaceWithParam::Library.into() - } - pub fn unlink(&self) -> SpaceSetParam { - SpaceSetParam::UnlinkLibrary - } -} -pub struct SpaceLibraryIdField {} -pub struct SpaceSetLibraryId(i64); -impl From for SpaceSetParam { - fn from(value: SpaceSetLibraryId) -> Self { - Self::LibraryId(value.0) - } -} -impl SpaceLibraryIdField { - pub fn lt(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::LibraryIdLT(value) - } - pub fn gt(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::LibraryIdGT(value) - } - pub fn lte(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::LibraryIdLTE(value) - } - pub fn gte(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::LibraryIdGTE(value) - } - pub fn equals(&self, value: i64) -> SpaceWhereParam { - SpaceWhereParam::LibraryIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - SpaceSetLibraryId(value).into() - } -} -pub enum SpaceWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), - NameContains(String), - NameHasPrefix(String), - NameHasSuffix(String), - NameEquals(String), - EncryptionLT(i64), - EncryptionGT(i64), - EncryptionLTE(i64), - EncryptionGTE(i64), - EncryptionEquals(i64), +pub enum JobWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(String), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(String), + IdLte(String), + IdGt(String), + IdGte(String), + IdContains(String), + IdStartsWith(String), + IdEndsWith(String), + IdNot(String), + IdHasPrefix(String), + IdHasSuffix(String), + ActionEquals(i32), + ActionInVec(Vec), + ActionNotInVec(Vec), + ActionLt(i32), + ActionLte(i32), + ActionGt(i32), + ActionGte(i32), + ActionNot(i32), + ActionLt(i32), + ActionLte(i32), + ActionGt(i32), + ActionGte(i32), + StatusEquals(i32), + StatusInVec(Vec), + StatusNotInVec(Vec), + StatusLt(i32), + StatusLte(i32), + StatusGt(i32), + StatusGte(i32), + StatusNot(i32), + StatusLt(i32), + StatusLte(i32), + StatusGt(i32), + StatusGte(i32), + TaskCountEquals(i32), + TaskCountInVec(Vec), + TaskCountNotInVec(Vec), + TaskCountLt(i32), + TaskCountLte(i32), + TaskCountGt(i32), + TaskCountGte(i32), + TaskCountNot(i32), + TaskCountLt(i32), + TaskCountLte(i32), + TaskCountGt(i32), + TaskCountGte(i32), + CompletedTaskCountEquals(i32), + CompletedTaskCountInVec(Vec), + CompletedTaskCountNotInVec(Vec), + CompletedTaskCountLt(i32), + CompletedTaskCountLte(i32), + CompletedTaskCountGt(i32), + CompletedTaskCountGte(i32), + CompletedTaskCountNot(i32), + CompletedTaskCountLt(i32), + CompletedTaskCountLte(i32), + CompletedTaskCountGt(i32), + CompletedTaskCountGte(i32), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), DateCreatedBefore(chrono::DateTime), DateCreatedAfter(chrono::DateTime), DateCreatedBeforeEquals(chrono::DateTime), DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + DateModifiedInVec(Vec>), + DateModifiedNotInVec(Vec>), + DateModifiedLt(chrono::DateTime), + DateModifiedLte(chrono::DateTime), + DateModifiedGt(chrono::DateTime), + DateModifiedGte(chrono::DateTime), + DateModifiedNot(chrono::DateTime), DateModifiedBefore(chrono::DateTime), DateModifiedAfter(chrono::DateTime), DateModifiedBeforeEquals(chrono::DateTime), DateModifiedAfterEquals(chrono::DateTime), - DateModifiedEquals(chrono::DateTime), - LibraryIs(Vec), - LibraryIdLT(i64), - LibraryIdGT(i64), - LibraryIdLTE(i64), - LibraryIdGTE(i64), - LibraryIdEquals(i64), - Not(Vec), - Or(Vec), - And(Vec), + SecondsElapsedEquals(i32), + SecondsElapsedInVec(Vec), + SecondsElapsedNotInVec(Vec), + SecondsElapsedLt(i32), + SecondsElapsedLte(i32), + SecondsElapsedGt(i32), + SecondsElapsedGte(i32), + SecondsElapsedNot(i32), + SecondsElapsedLt(i32), + SecondsElapsedLte(i32), + SecondsElapsedGt(i32), + SecondsElapsedGte(i32), } -impl SpaceWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), +impl JobWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, Self::IdEquals(value) => Field { @@ -12544,44 +26010,44 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::NameContains(value) => Field { - name: "name".into(), + Self::IdInVec(value) => Field { + name: "id".into(), fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::NameHasPrefix(value) => Field { - name: "name".into(), + Self::IdNotInVec(value) => Field { + name: "id".into(), fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::NameHasSuffix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameEquals(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionLT(value) => Field { - name: "encryption".into(), + Self::IdLt(value) => Field { + name: "id".into(), fields: Some(vec![Field { name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12589,17 +26055,8 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::EncryptionGT(value) => Field { - name: "encryption".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::EncryptionLTE(value) => Field { - name: "encryption".into(), + Self::IdLte(value) => Field { + name: "id".into(), fields: Some(vec![Field { name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12607,8 +26064,17 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::EncryptionGTE(value) => Field { - name: "encryption".into(), + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), fields: Some(vec![Field { name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12616,8 +26082,62 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::EncryptionEquals(value) => Field { - name: "encryption".into(), + Self::IdContains(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdStartsWith(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdEndsWith(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdHasPrefix(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdHasSuffix(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionEquals(value) => Field { + name: "action".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12625,6 +26145,591 @@ impl SpaceWhereParam { }]), ..Default::default() }, + Self::ActionInVec(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionNotInVec(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionLt(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionLte(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionGt(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionGte(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionNot(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionLt(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionLte(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionGt(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ActionGte(value) => Field { + name: "action".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusEquals(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusInVec(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusNotInVec(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusLt(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusLte(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusGt(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusGte(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusNot(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusLt(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusLte(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusGt(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::StatusGte(value) => Field { + name: "status".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountEquals(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountInVec(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountNotInVec(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountLt(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountLte(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountGt(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountGte(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountNot(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountLt(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountLte(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountGt(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::TaskCountGte(value) => Field { + name: "task_count".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountEquals(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountInVec(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountNotInVec(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountLt(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountLte(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountGt(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountGte(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountNot(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountLt(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountLte(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountGt(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::CompletedTaskCountGte(value) => Field { + name: "completed_task_count".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateCreatedBefore(value) => Field { name: "date_created".into(), fields: Some(vec![Field { @@ -12661,8 +26766,8 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12670,6 +26775,87 @@ impl SpaceWhereParam { }]), ..Default::default() }, + Self::DateModifiedInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNotInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNot(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateModifiedBefore(value) => Field { name: "date_modified".into(), fields: Some(vec![Field { @@ -12706,8 +26892,8 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::DateModifiedEquals(value) => Field { - name: "date_modified".into(), + Self::SecondsElapsedEquals(value) => Field { + name: "seconds_elapsed".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12715,17 +26901,44 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::LibraryIs(value) => Field { - name: "Library".into(), + Self::SecondsElapsedInVec(value) => Field { + name: "seconds_elapsed".into(), fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), ..Default::default() }]), ..Default::default() }, - Self::LibraryIdLT(value) => Field { - name: "libraryId".into(), + Self::SecondsElapsedNotInVec(value) => Field { + name: "seconds_elapsed".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::SecondsElapsedLt(value) => Field { + name: "seconds_elapsed".into(), fields: Some(vec![Field { name: "lt".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12733,17 +26946,8 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::LibraryIdGT(value) => Field { - name: "libraryId".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::LibraryIdLTE(value) => Field { - name: "libraryId".into(), + Self::SecondsElapsedLte(value) => Field { + name: "seconds_elapsed".into(), fields: Some(vec![Field { name: "lte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12751,8 +26955,17 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::LibraryIdGTE(value) => Field { - name: "libraryId".into(), + Self::SecondsElapsedGt(value) => Field { + name: "seconds_elapsed".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SecondsElapsedGte(value) => Field { + name: "seconds_elapsed".into(), fields: Some(vec![Field { name: "gte".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12760,40 +26973,65 @@ impl SpaceWhereParam { }]), ..Default::default() }, - Self::LibraryIdEquals(value) => Field { - name: "libraryId".into(), + Self::SecondsElapsedNot(value) => Field { + name: "seconds_elapsed".into(), fields: Some(vec![Field { - name: "equals".into(), + name: "not".into(), value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }]), ..Default::default() }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), + Self::SecondsElapsedLt(value) => Field { + name: "seconds_elapsed".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), ..Default::default() }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), + Self::SecondsElapsedLte(value) => Field { + name: "seconds_elapsed".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), ..Default::default() }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), + Self::SecondsElapsedGt(value) => Field { + name: "seconds_elapsed".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SecondsElapsedGte(value) => Field { + name: "seconds_elapsed".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), ..Default::default() }, } } } -impl From> for SpaceWhereParam { +pub enum JobWhereUniqueParam { + IdEquals(String), +} +impl From for JobWhereParam { + fn from(value: JobWhereUniqueParam) -> Self { + match value { + JobWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + } + } +} +impl From> for JobWhereParam { fn from(op: Operator) -> Self { match op { Operator::Not(value) => Self::Not(value), @@ -12802,19 +27040,936 @@ impl From> for SpaceWhereParam { } } } -pub struct SpaceWith { - pub param: SpaceWithParam, +pub struct JobFindMany<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> JobFindMany<'a> { + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> JobDelete<'a> { + JobDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Job".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> JobUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + JobUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn order_by(mut self, param: JobOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: JobWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: JobCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct JobFindFirst<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> JobFindFirst<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: JobWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: JobOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: JobCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct JobFindUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> JobFindUnique<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> JobDelete<'a> { + JobDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Job".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> JobUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + JobUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn with(mut self, param: JobWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct JobCreateOne<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> JobCreateOne<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: JobWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct JobUpdateUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> JobUpdateUnique<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn with(mut self, param: JobWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct JobUpdateMany<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> JobUpdateMany<'a> { + pub async fn exec(self) -> QueryResult> { + self.query.perform().await + } + pub fn with(mut self, param: JobWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct JobUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> JobUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + id: JobSetId, + action: JobSetAction, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(JobSetParam::from(id).to_field()); + input_fields.push(JobSetParam::from(action).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + self + } +} +pub struct JobDelete<'a> { + query: Query<'a>, +} +impl<'a> JobDelete<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) + } +} +pub struct JobActions<'a> { + client: &'a PrismaClient, +} +impl<'a> JobActions<'a> { + pub fn find_unique(&self, param: JobWhereUniqueParam) -> JobFindUnique { + let param: JobWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Job".into(), + outputs: job_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + JobFindUnique { + query, + with_params: vec![], + } + } + pub fn find_first(&self, params: Vec) -> JobFindFirst { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Job".into(), + outputs: job_outputs(), + inputs, + }; + JobFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn find_many(&self, params: Vec) -> JobFindMany { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Job".into(), + outputs: job_outputs(), + inputs, + }; + JobFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn create_one( + &self, + id: JobSetId, + action: JobSetAction, + params: Vec, + ) -> JobCreateOne { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(JobSetParam::from(id).to_field()); + input_fields.push(JobSetParam::from(action).to_field()); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Job".into(), + outputs: job_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + JobCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: JobWhereUniqueParam) -> JobUpsertOne { + let param: JobWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Job".into(), + outputs: job_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + JobUpsertOne { query } + } +} +fn space_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("name"), + Output::new("encryption"), + Output::new("date_created"), + Output::new("date_modified"), + Output::new("libraryId"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SpaceData { + #[serde(rename = "id")] + pub id: i32, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "encryption")] + pub encryption: Option, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "date_modified")] + pub date_modified: chrono::DateTime, + #[serde(rename = "Library")] + library: Option>, + #[serde(rename = "libraryId")] + pub library_id: Option, +} +impl SpaceData { + pub fn library(&self) -> Result<&LibraryData, String> { + match self . library . as_ref () { Some (v) => Ok (v) , None => Err ("Attempted to access library but did not fetch it using the .with() syntax" . to_string ()) , } + } +} +pub struct Space; +impl Space { + pub fn id() -> SpaceIdField { + SpaceIdField {} + } + pub fn name() -> SpaceNameField { + SpaceNameField {} + } + pub fn encryption() -> SpaceEncryptionField { + SpaceEncryptionField {} + } + pub fn date_created() -> SpaceDateCreatedField { + SpaceDateCreatedField {} + } + pub fn date_modified() -> SpaceDateModifiedField { + SpaceDateModifiedField {} + } + pub fn library() -> SpaceLibraryField { + SpaceLibraryField {} + } + pub fn library_id() -> SpaceLibraryIdField { + SpaceLibraryIdField {} + } +} +pub struct SpaceIdField {} +impl SpaceIdField { + pub fn set>(&self, value: i32) -> T { + SpaceSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + SpaceWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> SpaceOrderByParam { + SpaceOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> SpaceCursor { + SpaceCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::IdGte(value) + } +} +pub struct SpaceSetId(i32); +impl From for SpaceSetParam { + fn from(value: SpaceSetId) -> Self { + Self::SetId(value.0) + } +} +pub struct SpaceNameField {} +impl SpaceNameField { + pub fn set>(&self, value: String) -> T { + SpaceSetName(value).into() + } + pub fn equals(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameEquals(value).into() + } + pub fn order(&self, direction: Direction) -> SpaceOrderByParam { + SpaceOrderByParam::Name(direction) + } + pub fn cursor(&self, cursor: String) -> SpaceCursor { + SpaceCursor::Name(cursor) + } + pub fn in_vec(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::NameInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::NameNotInVec(value) + } + pub fn lt(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameLt(value) + } + pub fn lte(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameLte(value) + } + pub fn gt(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameGt(value) + } + pub fn gte(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameGte(value) + } + pub fn contains(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameContains(value) + } + pub fn starts_with(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameStartsWith(value) + } + pub fn ends_with(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameEndsWith(value) + } + pub fn not(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameNot(value) + } + pub fn has_prefix(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> SpaceWhereParam { + SpaceWhereParam::NameHasSuffix(value) + } +} +pub struct SpaceSetName(String); +impl From for SpaceSetParam { + fn from(value: SpaceSetName) -> Self { + Self::SetName(value.0) + } +} +pub struct SpaceEncryptionField {} +impl SpaceEncryptionField { + pub fn set>(&self, value: i32) -> T { + SpaceSetEncryption(value).into() + } + pub fn equals(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionEquals(value).into() + } + pub fn order(&self, direction: Direction) -> SpaceOrderByParam { + SpaceOrderByParam::Encryption(direction) + } + pub fn cursor(&self, cursor: i32) -> SpaceCursor { + SpaceCursor::Encryption(cursor) + } + pub fn increment(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::Encryption(value) + } + pub fn decrement(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::Encryption(value) + } + pub fn multiply(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::Encryption(value) + } + pub fn divide(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::Encryption(value) + } + pub fn in_vec(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::EncryptionInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::EncryptionNotInVec(value) + } + pub fn lt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionGte(value) + } + pub fn not(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionNot(value) + } + pub fn lt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionLt(value) + } + pub fn lte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionLte(value) + } + pub fn gt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionGt(value) + } + pub fn gte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::EncryptionGte(value) + } +} +pub struct SpaceSetEncryption(i32); +impl From for SpaceSetParam { + fn from(value: SpaceSetEncryption) -> Self { + Self::SetEncryption(value.0) + } +} +pub struct SpaceDateCreatedField {} +impl SpaceDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + SpaceSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> SpaceOrderByParam { + SpaceOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> SpaceCursor { + SpaceCursor::DateCreated(cursor) + } + pub fn in_vec(&self, value: Vec>) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateCreatedAfterEquals(value) + } +} +pub struct SpaceSetDateCreated(chrono::DateTime); +impl From for SpaceSetParam { + fn from(value: SpaceSetDateCreated) -> Self { + Self::SetDateCreated(value.0) + } +} +pub struct SpaceDateModifiedField {} +impl SpaceDateModifiedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + SpaceSetDateModified(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> SpaceOrderByParam { + SpaceOrderByParam::DateModified(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> SpaceCursor { + SpaceCursor::DateModified(cursor) + } + pub fn in_vec(&self, value: Vec>) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedAfter(value) + } + pub fn before_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedBeforeEquals(value) + } + pub fn after_equals(&self, value: chrono::DateTime) -> SpaceWhereParam { + SpaceWhereParam::DateModifiedAfterEquals(value) + } +} +pub struct SpaceSetDateModified(chrono::DateTime); +impl From for SpaceSetParam { + fn from(value: SpaceSetDateModified) -> Self { + Self::SetDateModified(value.0) + } +} +pub struct SpaceLibraryField {} +impl SpaceLibraryField { + pub fn is(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::LibraryIs(value) + } + pub fn fetch(&self) -> SpaceWithParam { + SpaceWithParam::Library + } + pub fn link>(&self, value: LibraryWhereUniqueParam) -> T { + SpaceLinkLibrary(value).into() + } + pub fn unlink(&self) -> SpaceSetParam { + SpaceSetParam::UnLinkLibrary + } +} +pub struct SpaceLinkLibrary(LibraryWhereUniqueParam); +impl From for SpaceSetParam { + fn from(value: SpaceLinkLibrary) -> Self { + Self::LinkLibrary(value.0) + } +} +pub struct SpaceLibraryIdField {} +impl SpaceLibraryIdField { + pub fn set>(&self, value: i32) -> T { + SpaceSetLibraryId(value).into() + } + pub fn equals(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> SpaceOrderByParam { + SpaceOrderByParam::LibraryId(direction) + } + pub fn cursor(&self, cursor: i32) -> SpaceCursor { + SpaceCursor::LibraryId(cursor) + } + pub fn increment(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::LibraryId(value) + } + pub fn decrement(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::LibraryId(value) + } + pub fn multiply(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::LibraryId(value) + } + pub fn divide(&self, value: i32) -> SpaceSetParam { + SpaceSetParam::LibraryId(value) + } + pub fn in_vec(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdLt(value) + } + pub fn lte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdLte(value) + } + pub fn gt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdGt(value) + } + pub fn gte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdGte(value) + } + pub fn not(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdNot(value) + } + pub fn lt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdLt(value) + } + pub fn lte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdLte(value) + } + pub fn gt(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdGt(value) + } + pub fn gte(&self, value: i32) -> SpaceWhereParam { + SpaceWhereParam::LibraryIdGte(value) + } +} +pub struct SpaceSetLibraryId(i32); +impl From for SpaceSetParam { + fn from(value: SpaceSetLibraryId) -> Self { + Self::SetLibraryId(value.0) + } } pub enum SpaceWithParam { Library, } -impl From for SpaceWith { - fn from(param: SpaceWithParam) -> Self { - Self { param } - } -} impl SpaceWithParam { - pub fn output(self) -> Output { + pub fn to_output(self) -> Output { match self { Self::Library => Output { name: "Library".into(), @@ -12825,17 +27980,125 @@ impl SpaceWithParam { } } pub enum SpaceSetParam { - Id(i64), - Name(String), - Encryption(i64), - DateCreated(chrono::DateTime), - DateModified(chrono::DateTime), - LinkLibrary(LibraryWhereParam), - UnlinkLibrary, - LibraryId(i64), + SetId(i32), + SetName(String), + SetEncryption(i32), + SetDateCreated(chrono::DateTime), + SetDateModified(chrono::DateTime), + LinkLibrary(LibraryWhereUniqueParam), + UnLinkLibrary, + SetLibraryId(i32), } impl SpaceSetParam { - pub fn field(self) -> Field { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetName(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetEncryption(value) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkLibrary(where_param) => Field { + name: "Library".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![ + Into::::into(where_param).to_field(), + ])), + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkLibrary => Field { + name: "Library".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + value: Some(true.into()), + ..Default::default() + }]), + ..Default::default() + }, + Self::SetLibraryId(value) => Field { + name: "libraryId".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum SpaceOrderByParam { + Id(Direction), + Name(Direction), + Encryption(Direction), + DateCreated(Direction), + DateModified(Direction), + LibraryId(Direction), +} +impl SpaceOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Name(direction) => Field { + name: "name".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Encryption(direction) => Field { + name: "encryption".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateModified(direction) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::LibraryId(direction) => Field { + name: "libraryId".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum SpaceCursor { + Id(i32), + Name(String), + Encryption(i32), + DateCreated(chrono::DateTime), + DateModified(chrono::DateTime), + LibraryId(i32), +} +impl SpaceCursor { + fn to_field(self) -> Field { match self { Self::Id(value) => Field { name: "id".into(), @@ -12862,24 +28125,6 @@ impl SpaceSetParam { value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }, - Self::LinkLibrary(where_param) => Field { - name: "Library".into(), - fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals(vec![where_param.field()])), - ..Default::default() - }]), - ..Default::default() - }, - Self::UnlinkLibrary => Field { - name: "Library".into(), - fields: Some(vec![Field { - name: "disconnect".into(), - value: Some(true.into()), - ..Default::default() - }]), - ..Default::default() - }, Self::LibraryId(value) => Field { name: "libraryId".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -12888,12 +28133,931 @@ impl SpaceSetParam { } } } +pub enum SpaceWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + NameEquals(String), + NameInVec(Vec), + NameNotInVec(Vec), + NameLt(String), + NameLte(String), + NameGt(String), + NameGte(String), + NameContains(String), + NameStartsWith(String), + NameEndsWith(String), + NameNot(String), + NameHasPrefix(String), + NameHasSuffix(String), + EncryptionEquals(i32), + EncryptionInVec(Vec), + EncryptionNotInVec(Vec), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + EncryptionNot(i32), + EncryptionLt(i32), + EncryptionLte(i32), + EncryptionGt(i32), + EncryptionGte(i32), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + DateModifiedInVec(Vec>), + DateModifiedNotInVec(Vec>), + DateModifiedLt(chrono::DateTime), + DateModifiedLte(chrono::DateTime), + DateModifiedGt(chrono::DateTime), + DateModifiedGte(chrono::DateTime), + DateModifiedNot(chrono::DateTime), + DateModifiedBefore(chrono::DateTime), + DateModifiedAfter(chrono::DateTime), + DateModifiedBeforeEquals(chrono::DateTime), + DateModifiedAfterEquals(chrono::DateTime), + LibraryIs(Vec), + LibraryIdEquals(i32), + LibraryIdInVec(Vec), + LibraryIdNotInVec(Vec), + LibraryIdLt(i32), + LibraryIdLte(i32), + LibraryIdGt(i32), + LibraryIdGte(i32), + LibraryIdNot(i32), + LibraryIdLt(i32), + LibraryIdLte(i32), + LibraryIdGt(i32), + LibraryIdGte(i32), +} +impl SpaceWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNotInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameStartsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEndsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNot(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasSuffix(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionEquals(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionInVec(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNotInVec(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionNot(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionLte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGt(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::EncryptionGte(value) => Field { + name: "encryption".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNotInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNot(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBefore(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfter(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBeforeEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfterEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIs(value) => Field { + name: "Library".into(), + fields: Some(vec![Field { + name: "is".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdEquals(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdInVec(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdNotInVec(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdLt(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdLte(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdGt(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdGte(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdNot(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdLt(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdLte(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdGt(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::LibraryIdGte(value) => Field { + name: "libraryId".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum SpaceWhereUniqueParam { + IdEquals(i32), +} +impl From for SpaceWhereParam { + fn from(value: SpaceWhereUniqueParam) -> Self { + match value { + SpaceWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + } + } +} +impl From> for SpaceWhereParam { + fn from(op: Operator) -> Self { + match op { + Operator::Not(value) => Self::Not(value), + Operator::And(value) => Self::And(value), + Operator::Or(value) => Self::Or(value), + } + } +} pub struct SpaceFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> SpaceFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> SpaceDelete<'a> { SpaceDelete { @@ -12912,7 +29076,7 @@ impl<'a> SpaceFindMany<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -12932,33 +29096,119 @@ impl<'a> SpaceFindMany<'a> { method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: SpaceOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: SpaceWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: SpaceCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct SpaceFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> SpaceFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: SpaceWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: SpaceOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: SpaceCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct SpaceFindUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> SpaceFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> SpaceDelete<'a> { SpaceDelete { @@ -12976,7 +29226,7 @@ impl<'a> SpaceFindUnique<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -12996,45 +29246,101 @@ impl<'a> SpaceFindUnique<'a> { method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: SpaceWithParam) -> Self { + self.with_params.push(param); self } } pub struct SpaceCreateOne<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> SpaceCreateOne<'a> { - pub async fn exec(self) -> SpaceData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: SpaceWithParam) -> Self { + self.with_params.push(param); + self } } pub struct SpaceUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> SpaceUpdateUnique<'a> { - pub async fn exec(self) -> SpaceData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: SpaceWithParam) -> Self { + self.with_params.push(param); self } } pub struct SpaceUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> SpaceUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: SpaceWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct SpaceUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> SpaceUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create(mut self, name: SpaceSetName, params: Vec) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(SpaceSetParam::from(name).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); self } } @@ -13042,18 +29348,22 @@ pub struct SpaceDelete<'a> { query: Query<'a>, } impl<'a> SpaceDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) } } pub struct SpaceActions<'a> { client: &'a PrismaClient, } impl<'a> SpaceActions<'a> { - pub fn find_unique(&self, param: SpaceWhereParam) -> SpaceFindUnique { - let fields = transform_equals(vec![param.field()]); + pub fn find_unique(&self, param: SpaceWhereUniqueParam) -> SpaceFindUnique { + let param: SpaceWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), @@ -13065,10 +29375,14 @@ impl<'a> SpaceActions<'a> { ..Default::default() }], }; - SpaceFindUnique { query } + SpaceFindUnique { + query, + with_params: vec![], + } } pub fn find_first(&self, params: Vec) -> SpaceFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -13085,7 +29399,10 @@ impl<'a> SpaceActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), @@ -13093,10 +29410,15 @@ impl<'a> SpaceActions<'a> { outputs: space_outputs(), inputs, }; - SpaceFindFirst { query } + SpaceFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn find_many(&self, params: Vec) -> SpaceFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -13107,7 +29429,10 @@ impl<'a> SpaceActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), @@ -13115,13 +29440,25 @@ impl<'a> SpaceActions<'a> { outputs: space_outputs(), inputs, }; - SpaceFindMany { query } + SpaceFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } - pub fn create_one(&self, name: SpaceSetName, params: Vec) -> SpaceCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(SpaceSetParam::from(name).field()); + pub fn create_one( + &self, + name: SpaceSetName, + params: Vec, + ) -> SpaceCreateOne { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(SpaceSetParam::from(name).to_field()); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), @@ -13133,7 +29470,31 @@ impl<'a> SpaceActions<'a> { ..Default::default() }], }; - SpaceCreateOne { query } + SpaceCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: SpaceWhereUniqueParam) -> SpaceUpsertOne { + let param: SpaceWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Space".into(), + outputs: space_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + SpaceUpsertOne { query } } } fn album_outputs() -> Vec { @@ -13148,7 +29509,7 @@ fn album_outputs() -> Vec { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct AlbumData { #[serde(rename = "id")] - pub id: i64, + pub id: i32, #[serde(rename = "name")] pub name: String, #[serde(rename = "is_hidden")] @@ -13178,79 +29539,190 @@ impl Album { } } pub struct AlbumIdField {} -pub struct AlbumSetId(i64); -impl From for AlbumSetParam { - fn from(value: AlbumSetId) -> Self { - Self::Id(value.0) +impl AlbumIdField { + pub fn set>(&self, value: i32) -> T { + AlbumSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + AlbumWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> AlbumOrderByParam { + AlbumOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> AlbumCursor { + AlbumCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> AlbumSetParam { + AlbumSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> AlbumSetParam { + AlbumSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> AlbumSetParam { + AlbumSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> AlbumSetParam { + AlbumSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> AlbumWhereParam { + AlbumWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> AlbumWhereParam { + AlbumWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> AlbumWhereParam { + AlbumWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> AlbumWhereParam { + AlbumWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> AlbumWhereParam { + AlbumWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> AlbumWhereParam { + AlbumWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> AlbumWhereParam { + AlbumWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> AlbumWhereParam { + AlbumWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> AlbumWhereParam { + AlbumWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> AlbumWhereParam { + AlbumWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> AlbumWhereParam { + AlbumWhereParam::IdGte(value) } } -impl AlbumIdField { - pub fn lt(&self, value: i64) -> AlbumWhereParam { - AlbumWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> AlbumWhereParam { - AlbumWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> AlbumWhereParam { - AlbumWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> AlbumWhereParam { - AlbumWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> AlbumWhereParam { - AlbumWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - AlbumSetId(value).into() +pub struct AlbumSetId(i32); +impl From for AlbumSetParam { + fn from(value: AlbumSetId) -> Self { + Self::SetId(value.0) } } pub struct AlbumNameField {} -pub struct AlbumSetName(String); -impl From for AlbumSetParam { - fn from(value: AlbumSetName) -> Self { - Self::Name(value.0) - } -} impl AlbumNameField { + pub fn set>(&self, value: String) -> T { + AlbumSetName(value).into() + } + pub fn equals(&self, value: String) -> AlbumWhereParam { + AlbumWhereParam::NameEquals(value).into() + } + pub fn order(&self, direction: Direction) -> AlbumOrderByParam { + AlbumOrderByParam::Name(direction) + } + pub fn cursor(&self, cursor: String) -> AlbumCursor { + AlbumCursor::Name(cursor) + } + pub fn in_vec(&self, value: Vec) -> AlbumWhereParam { + AlbumWhereParam::NameInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> AlbumWhereParam { + AlbumWhereParam::NameNotInVec(value) + } + pub fn lt(&self, value: String) -> AlbumWhereParam { + AlbumWhereParam::NameLt(value) + } + pub fn lte(&self, value: String) -> AlbumWhereParam { + AlbumWhereParam::NameLte(value) + } + pub fn gt(&self, value: String) -> AlbumWhereParam { + AlbumWhereParam::NameGt(value) + } + pub fn gte(&self, value: String) -> AlbumWhereParam { + AlbumWhereParam::NameGte(value) + } pub fn contains(&self, value: String) -> AlbumWhereParam { AlbumWhereParam::NameContains(value) } + pub fn starts_with(&self, value: String) -> AlbumWhereParam { + AlbumWhereParam::NameStartsWith(value) + } + pub fn ends_with(&self, value: String) -> AlbumWhereParam { + AlbumWhereParam::NameEndsWith(value) + } + pub fn not(&self, value: String) -> AlbumWhereParam { + AlbumWhereParam::NameNot(value) + } pub fn has_prefix(&self, value: String) -> AlbumWhereParam { AlbumWhereParam::NameHasPrefix(value) } pub fn has_suffix(&self, value: String) -> AlbumWhereParam { AlbumWhereParam::NameHasSuffix(value) } - pub fn equals(&self, value: String) -> AlbumWhereParam { - AlbumWhereParam::NameEquals(value) - } - pub fn set>(&self, value: String) -> T { - AlbumSetName(value).into() +} +pub struct AlbumSetName(String); +impl From for AlbumSetParam { + fn from(value: AlbumSetName) -> Self { + Self::SetName(value.0) } } pub struct AlbumIsHiddenField {} -pub struct AlbumSetIsHidden(bool); -impl From for AlbumSetParam { - fn from(value: AlbumSetIsHidden) -> Self { - Self::IsHidden(value.0) - } -} impl AlbumIsHiddenField { - pub fn equals(&self, value: bool) -> AlbumWhereParam { - AlbumWhereParam::IsHiddenEquals(value) - } pub fn set>(&self, value: bool) -> T { AlbumSetIsHidden(value).into() } -} -pub struct AlbumDateCreatedField {} -pub struct AlbumSetDateCreated(chrono::DateTime); -impl From for AlbumSetParam { - fn from(value: AlbumSetDateCreated) -> Self { - Self::DateCreated(value.0) + pub fn equals(&self, value: bool) -> AlbumWhereParam { + AlbumWhereParam::IsHiddenEquals(value).into() + } + pub fn order(&self, direction: Direction) -> AlbumOrderByParam { + AlbumOrderByParam::IsHidden(direction) + } + pub fn cursor(&self, cursor: bool) -> AlbumCursor { + AlbumCursor::IsHidden(cursor) } } +pub struct AlbumSetIsHidden(bool); +impl From for AlbumSetParam { + fn from(value: AlbumSetIsHidden) -> Self { + Self::SetIsHidden(value.0) + } +} +pub struct AlbumDateCreatedField {} impl AlbumDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + AlbumSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> AlbumOrderByParam { + AlbumOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> AlbumCursor { + AlbumCursor::DateCreated(cursor) + } + pub fn in_vec(&self, value: Vec>) -> AlbumWhereParam { + AlbumWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> AlbumWhereParam { + AlbumWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateCreatedNot(value) + } pub fn before(&self, value: chrono::DateTime) -> AlbumWhereParam { AlbumWhereParam::DateCreatedBefore(value) } @@ -13263,21 +29735,54 @@ impl AlbumDateCreatedField { pub fn after_equals(&self, value: chrono::DateTime) -> AlbumWhereParam { AlbumWhereParam::DateCreatedAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> AlbumWhereParam { - AlbumWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - AlbumSetDateCreated(value).into() +} +pub struct AlbumSetDateCreated(chrono::DateTime); +impl From for AlbumSetParam { + fn from(value: AlbumSetDateCreated) -> Self { + Self::SetDateCreated(value.0) } } pub struct AlbumDateModifiedField {} -pub struct AlbumSetDateModified(chrono::DateTime); -impl From for AlbumSetParam { - fn from(value: AlbumSetDateModified) -> Self { - Self::DateModified(value.0) - } -} impl AlbumDateModifiedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + AlbumSetDateModified(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateModifiedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> AlbumOrderByParam { + AlbumOrderByParam::DateModified(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> AlbumCursor { + AlbumCursor::DateModified(cursor) + } + pub fn in_vec(&self, value: Vec>) -> AlbumWhereParam { + AlbumWhereParam::DateModifiedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> AlbumWhereParam { + AlbumWhereParam::DateModifiedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateModifiedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateModifiedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateModifiedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateModifiedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> AlbumWhereParam { + AlbumWhereParam::DateModifiedNot(value) + } pub fn before(&self, value: chrono::DateTime) -> AlbumWhereParam { AlbumWhereParam::DateModifiedBefore(value) } @@ -13290,277 +29795,104 @@ impl AlbumDateModifiedField { pub fn after_equals(&self, value: chrono::DateTime) -> AlbumWhereParam { AlbumWhereParam::DateModifiedAfterEquals(value) } - pub fn equals(&self, value: chrono::DateTime) -> AlbumWhereParam { - AlbumWhereParam::DateModifiedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - AlbumSetDateModified(value).into() - } } -pub enum AlbumWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), - NameContains(String), - NameHasPrefix(String), - NameHasSuffix(String), - NameEquals(String), - IsHiddenEquals(bool), - DateCreatedBefore(chrono::DateTime), - DateCreatedAfter(chrono::DateTime), - DateCreatedBeforeEquals(chrono::DateTime), - DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), - DateModifiedBefore(chrono::DateTime), - DateModifiedAfter(chrono::DateTime), - DateModifiedBeforeEquals(chrono::DateTime), - DateModifiedAfterEquals(chrono::DateTime), - DateModifiedEquals(chrono::DateTime), - Not(Vec), - Or(Vec), - And(Vec), -} -impl AlbumWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdEquals(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameContains(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "contains".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasPrefix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "starts_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameHasSuffix(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "ends_with".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::NameEquals(value) => Field { - name: "name".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IsHiddenEquals(value) => Field { - name: "is_hidden".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBefore(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfter(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedBeforeEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedAfterEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedBefore(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedAfter(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedBeforeEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedAfterEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::DateModifiedEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - } +pub struct AlbumSetDateModified(chrono::DateTime); +impl From for AlbumSetParam { + fn from(value: AlbumSetDateModified) -> Self { + Self::SetDateModified(value.0) } } -impl From> for AlbumWhereParam { - fn from(op: Operator) -> Self { - match op { - Operator::Not(value) => Self::Not(value), - Operator::And(value) => Self::And(value), - Operator::Or(value) => Self::Or(value), - } - } -} -pub struct AlbumWith { - pub param: AlbumWithParam, -} pub enum AlbumWithParam {} -impl From for AlbumWith { - fn from(param: AlbumWithParam) -> Self { - Self { param } - } -} impl AlbumWithParam { - pub fn output(self) -> Output { + pub fn to_output(self) -> Output { match self {} } } pub enum AlbumSetParam { - Id(i64), + SetId(i32), + SetName(String), + SetIsHidden(bool), + SetDateCreated(chrono::DateTime), + SetDateModified(chrono::DateTime), +} +impl AlbumSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetName(value) => Field { + name: "name".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetIsHidden(value) => Field { + name: "is_hidden".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + } + } +} +pub enum AlbumOrderByParam { + Id(Direction), + Name(Direction), + IsHidden(Direction), + DateCreated(Direction), + DateModified(Direction), +} +impl AlbumOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Name(direction) => Field { + name: "name".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::IsHidden(direction) => Field { + name: "is_hidden".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateModified(direction) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum AlbumCursor { + Id(i32), Name(String), IsHidden(bool), DateCreated(chrono::DateTime), DateModified(chrono::DateTime), } -impl AlbumSetParam { - pub fn field(self) -> Field { +impl AlbumCursor { + fn to_field(self) -> Field { match self { Self::Id(value) => Field { name: "id".into(), @@ -13590,524 +29922,83 @@ impl AlbumSetParam { } } } -pub struct AlbumFindMany<'a> { - query: Query<'a>, -} -impl<'a> AlbumFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> AlbumDelete<'a> { - AlbumDelete { - query: Query { - operation: "mutation".into(), - method: "deleteMany".into(), - model: "Album".into(), - outputs: vec![Output::new("count")], - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> AlbumUpdateMany<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - AlbumUpdateMany { - query: Query { - operation: "mutation".into(), - method: "updateMany".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct AlbumFindFirst<'a> { - query: Query<'a>, -} -impl<'a> AlbumFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct AlbumFindUnique<'a> { - query: Query<'a>, -} -impl<'a> AlbumFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() - } - pub fn delete(self) -> AlbumDelete<'a> { - AlbumDelete { - query: Query { - operation: "mutation".into(), - method: "deleteOne".into(), - model: "Album".into(), - ..self.query - }, - } - } - pub fn update(mut self, params: Vec) -> AlbumUpdateUnique<'a> { - self.query.inputs.push(Input { - name: "data".into(), - fields: params - .into_iter() - .map(|param| { - let mut field = param.field(); - if let Some(value) = field.value { - field.fields = Some(vec![Field { - name: "set".into(), - value: Some(value), - ..Default::default() - }]); - field.value = None; - } - field - }) - .collect(), - ..Default::default() - }); - AlbumUpdateUnique { - query: Query { - operation: "mutation".into(), - method: "updateOne".into(), - ..self.query - }, - } - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct AlbumCreateOne<'a> { - query: Query<'a>, -} -impl<'a> AlbumCreateOne<'a> { - pub async fn exec(self) -> AlbumData { - self.query.perform::().await.unwrap() - } -} -pub struct AlbumUpdateUnique<'a> { - query: Query<'a>, -} -impl<'a> AlbumUpdateUnique<'a> { - pub async fn exec(self) -> AlbumData { - self.query.perform::().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct AlbumUpdateMany<'a> { - query: Query<'a>, -} -impl<'a> AlbumUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() - } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); - self - } -} -pub struct AlbumDelete<'a> { - query: Query<'a>, -} -impl<'a> AlbumDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count - } -} -pub struct AlbumActions<'a> { - client: &'a PrismaClient, -} -impl<'a> AlbumActions<'a> { - pub fn find_unique(&self, param: AlbumWhereParam) -> AlbumFindUnique { - let fields = transform_equals(vec![param.field()]); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findUnique".into(), - model: "Album".into(), - outputs: album_outputs(), - inputs: vec![Input { - name: "where".into(), - fields, - ..Default::default() - }], - }; - AlbumFindUnique { query } - } - pub fn find_first(&self, params: Vec) -> AlbumFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: vec![Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(where_fields), - ..Default::default() - }], - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findFirst".into(), - model: "Album".into(), - outputs: album_outputs(), - inputs, - }; - AlbumFindFirst { query } - } - pub fn find_many(&self, params: Vec) -> AlbumFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); - let inputs = if where_fields.len() > 0 { - vec![Input { - name: "where".into(), - fields: where_fields, - ..Default::default() - }] - } else { - Vec::new() - }; - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "query".into(), - method: "findMany".into(), - model: "Album".into(), - outputs: album_outputs(), - inputs, - }; - AlbumFindMany { query } - } - pub fn create_one(&self, name: AlbumSetName, params: Vec) -> AlbumCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(AlbumSetParam::from(name).field()); - let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), - name: String::new(), - operation: "mutation".into(), - method: "createOne".into(), - model: "Album".into(), - outputs: album_outputs(), - inputs: vec![Input { - name: "data".into(), - fields: input_fields, - ..Default::default() - }], - }; - AlbumCreateOne { query } - } -} -fn comment_outputs() -> Vec { - vec![ - Output::new("id"), - Output::new("content"), - Output::new("date_created"), - Output::new("date_modified"), - Output::new("file_id"), - ] -} -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct CommentData { - #[serde(rename = "id")] - pub id: i64, - #[serde(rename = "content")] - pub content: String, - #[serde(rename = "date_created")] - pub date_created: chrono::DateTime, - #[serde(rename = "date_modified")] - pub date_modified: chrono::DateTime, - #[serde(rename = "file_id")] - pub file_id: Option, - #[serde(rename = "file")] - pub file: Box>, -} -impl CommentData { - pub fn file(&self) -> Option<&FileData> { - self.file.as_ref().as_ref() - } -} -pub struct Comment; -impl Comment { - pub fn id() -> CommentIdField { - CommentIdField {} - } - pub fn content() -> CommentContentField { - CommentContentField {} - } - pub fn date_created() -> CommentDateCreatedField { - CommentDateCreatedField {} - } - pub fn date_modified() -> CommentDateModifiedField { - CommentDateModifiedField {} - } - pub fn file_id() -> CommentFileIdField { - CommentFileIdField {} - } - pub fn file() -> CommentFileField { - CommentFileField {} - } -} -pub struct CommentIdField {} -pub struct CommentSetId(i64); -impl From for CommentSetParam { - fn from(value: CommentSetId) -> Self { - Self::Id(value.0) - } -} -impl CommentIdField { - pub fn lt(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::IdLT(value) - } - pub fn gt(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::IdGT(value) - } - pub fn lte(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::IdLTE(value) - } - pub fn gte(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::IdGTE(value) - } - pub fn equals(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::IdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - CommentSetId(value).into() - } -} -pub struct CommentContentField {} -pub struct CommentSetContent(String); -impl From for CommentSetParam { - fn from(value: CommentSetContent) -> Self { - Self::Content(value.0) - } -} -impl CommentContentField { - pub fn contains(&self, value: String) -> CommentWhereParam { - CommentWhereParam::ContentContains(value) - } - pub fn has_prefix(&self, value: String) -> CommentWhereParam { - CommentWhereParam::ContentHasPrefix(value) - } - pub fn has_suffix(&self, value: String) -> CommentWhereParam { - CommentWhereParam::ContentHasSuffix(value) - } - pub fn equals(&self, value: String) -> CommentWhereParam { - CommentWhereParam::ContentEquals(value) - } - pub fn set>(&self, value: String) -> T { - CommentSetContent(value).into() - } -} -pub struct CommentDateCreatedField {} -pub struct CommentSetDateCreated(chrono::DateTime); -impl From for CommentSetParam { - fn from(value: CommentSetDateCreated) -> Self { - Self::DateCreated(value.0) - } -} -impl CommentDateCreatedField { - pub fn before(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateCreatedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateCreatedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateCreatedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateCreatedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateCreatedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - CommentSetDateCreated(value).into() - } -} -pub struct CommentDateModifiedField {} -pub struct CommentSetDateModified(chrono::DateTime); -impl From for CommentSetParam { - fn from(value: CommentSetDateModified) -> Self { - Self::DateModified(value.0) - } -} -impl CommentDateModifiedField { - pub fn before(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateModifiedBefore(value) - } - pub fn after(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateModifiedAfter(value) - } - pub fn before_equals(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateModifiedBeforeEquals(value) - } - pub fn after_equals(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateModifiedAfterEquals(value) - } - pub fn equals(&self, value: chrono::DateTime) -> CommentWhereParam { - CommentWhereParam::DateModifiedEquals(value) - } - pub fn set>(&self, value: chrono::DateTime) -> T { - CommentSetDateModified(value).into() - } -} -pub struct CommentFileIdField {} -pub struct CommentSetFileId(i64); -impl From for CommentSetParam { - fn from(value: CommentSetFileId) -> Self { - Self::FileId(value.0) - } -} -impl CommentFileIdField { - pub fn lt(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::FileIdLT(value) - } - pub fn gt(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::FileIdGT(value) - } - pub fn lte(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::FileIdLTE(value) - } - pub fn gte(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::FileIdGTE(value) - } - pub fn equals(&self, value: i64) -> CommentWhereParam { - CommentWhereParam::FileIdEquals(value) - } - pub fn set>(&self, value: i64) -> T { - CommentSetFileId(value).into() - } -} -pub struct CommentFileField {} -pub struct CommentLinkFile(FileWhereParam); -impl From for CommentSetParam { - fn from(value: CommentLinkFile) -> Self { - Self::LinkFile(value.0) - } -} -impl CommentFileField { - pub fn is(&self, value: Vec) -> CommentWhereParam { - CommentWhereParam::FileIs(value) - } - pub fn link>(&self, value: FileWhereParam) -> T { - CommentLinkFile(value).into() - } - pub fn fetch(&self) -> CommentWith { - CommentWithParam::File.into() - } - pub fn unlink(&self) -> CommentSetParam { - CommentSetParam::UnlinkFile - } -} -pub enum CommentWhereParam { - IdLT(i64), - IdGT(i64), - IdLTE(i64), - IdGTE(i64), - IdEquals(i64), - ContentContains(String), - ContentHasPrefix(String), - ContentHasSuffix(String), - ContentEquals(String), +pub enum AlbumWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + NameEquals(String), + NameInVec(Vec), + NameNotInVec(Vec), + NameLt(String), + NameLte(String), + NameGt(String), + NameGte(String), + NameContains(String), + NameStartsWith(String), + NameEndsWith(String), + NameNot(String), + NameHasPrefix(String), + NameHasSuffix(String), + IsHiddenEquals(bool), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), DateCreatedBefore(chrono::DateTime), DateCreatedAfter(chrono::DateTime), DateCreatedBeforeEquals(chrono::DateTime), DateCreatedAfterEquals(chrono::DateTime), - DateCreatedEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + DateModifiedInVec(Vec>), + DateModifiedNotInVec(Vec>), + DateModifiedLt(chrono::DateTime), + DateModifiedLte(chrono::DateTime), + DateModifiedGt(chrono::DateTime), + DateModifiedGte(chrono::DateTime), + DateModifiedNot(chrono::DateTime), DateModifiedBefore(chrono::DateTime), DateModifiedAfter(chrono::DateTime), DateModifiedBeforeEquals(chrono::DateTime), DateModifiedAfterEquals(chrono::DateTime), - DateModifiedEquals(chrono::DateTime), - FileIdLT(i64), - FileIdGT(i64), - FileIdLTE(i64), - FileIdGTE(i64), - FileIdEquals(i64), - FileIs(Vec), - Not(Vec), - Or(Vec), - And(Vec), } -impl CommentWhereParam { - pub fn field(self) -> Field { - match self { - Self::IdLT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), +impl AlbumWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdGT(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, - Self::IdLTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::IdGTE(value) => Field { - name: "id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }, Self::IdEquals(value) => Field { @@ -14119,8 +30010,206 @@ impl CommentWhereParam { }]), ..Default::default() }, - Self::ContentContains(value) => Field { - name: "content".into(), + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEquals(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNotInVec(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameLte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGt(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameGte(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameContains(value) => Field { + name: "name".into(), fields: Some(vec![Field { name: "contains".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -14128,8 +30217,35 @@ impl CommentWhereParam { }]), ..Default::default() }, - Self::ContentHasPrefix(value) => Field { - name: "content".into(), + Self::NameStartsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameEndsWith(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameNot(value) => Field { + name: "name".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::NameHasPrefix(value) => Field { + name: "name".into(), fields: Some(vec![Field { name: "starts_with".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -14137,8 +30253,8 @@ impl CommentWhereParam { }]), ..Default::default() }, - Self::ContentHasSuffix(value) => Field { - name: "content".into(), + Self::NameHasSuffix(value) => Field { + name: "name".into(), fields: Some(vec![Field { name: "ends_with".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -14146,8 +30262,8 @@ impl CommentWhereParam { }]), ..Default::default() }, - Self::ContentEquals(value) => Field { - name: "content".into(), + Self::IsHiddenEquals(value) => Field { + name: "is_hidden".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -14155,6 +30271,96 @@ impl CommentWhereParam { }]), ..Default::default() }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateCreatedBefore(value) => Field { name: "date_created".into(), fields: Some(vec![Field { @@ -14191,8 +30397,8 @@ impl CommentWhereParam { }]), ..Default::default() }, - Self::DateCreatedEquals(value) => Field { - name: "date_created".into(), + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), fields: Some(vec![Field { name: "equals".into(), value: Some(serde_json::to_value(value).unwrap()), @@ -14200,6 +30406,87 @@ impl CommentWhereParam { }]), ..Default::default() }, + Self::DateModifiedInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNotInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNot(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, Self::DateModifiedBefore(value) => Field { name: "date_modified".into(), fields: Some(vec![Field { @@ -14236,94 +30523,20 @@ impl CommentWhereParam { }]), ..Default::default() }, - Self::DateModifiedEquals(value) => Field { - name: "date_modified".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdLT(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "lt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdGT(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "gt".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdLTE(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "lte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdGTE(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "gte".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIdEquals(value) => Field { - name: "file_id".into(), - fields: Some(vec![Field { - name: "equals".into(), - value: Some(serde_json::to_value(value).unwrap()), - ..Default::default() - }]), - ..Default::default() - }, - Self::FileIs(value) => Field { - name: "file".into(), - fields: Some(vec![Field { - name: "AND".into(), - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }]), - ..Default::default() - }, - Self::Not(value) => Field { - name: "NOT".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::Or(value) => Field { - name: "OR".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, - Self::And(value) => Field { - name: "AND".into(), - list: true, - wrap_list: true, - fields: Some(value.into_iter().map(|f| f.field()).collect()), - ..Default::default() - }, } } } -impl From> for CommentWhereParam { +pub enum AlbumWhereUniqueParam { + IdEquals(i32), +} +impl From for AlbumWhereParam { + fn from(value: AlbumWhereUniqueParam) -> Self { + match value { + AlbumWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + } + } +} +impl From> for AlbumWhereParam { fn from(op: Operator) -> Self { match op { Operator::Not(value) => Self::Not(value), @@ -14332,19 +30545,874 @@ impl From> for CommentWhereParam { } } } -pub struct CommentWith { - pub param: CommentWithParam, +pub struct AlbumFindMany<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> AlbumFindMany<'a> { + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> AlbumDelete<'a> { + AlbumDelete { + query: Query { + operation: "mutation".into(), + method: "deleteMany".into(), + model: "Album".into(), + outputs: vec![Output::new("count")], + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> AlbumUpdateMany<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + AlbumUpdateMany { + query: Query { + operation: "mutation".into(), + method: "updateMany".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn order_by(mut self, param: AlbumOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: AlbumWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: AlbumCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct AlbumFindFirst<'a> { + query: Query<'a>, + order_by_params: Vec, + with_params: Vec, +} +impl<'a> AlbumFindFirst<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: AlbumWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: AlbumOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: AlbumCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); + self + } +} +pub struct AlbumFindUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> AlbumFindUnique<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn delete(self) -> AlbumDelete<'a> { + AlbumDelete { + query: Query { + operation: "mutation".into(), + method: "deleteOne".into(), + model: "Album".into(), + ..self.query + }, + } + } + pub fn update(mut self, params: Vec) -> AlbumUpdateUnique<'a> { + self.query.inputs.push(Input { + name: "data".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + AlbumUpdateUnique { + query: Query { + operation: "mutation".into(), + method: "updateOne".into(), + ..self.query + }, + with_params: vec![], + } + } + pub fn with(mut self, param: AlbumWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct AlbumCreateOne<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> AlbumCreateOne<'a> { + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: AlbumWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct AlbumUpdateUnique<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> AlbumUpdateUnique<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn with(mut self, param: AlbumWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct AlbumUpdateMany<'a> { + query: Query<'a>, + with_params: Vec, +} +impl<'a> AlbumUpdateMany<'a> { + pub async fn exec(self) -> QueryResult> { + self.query.perform().await + } + pub fn with(mut self, param: AlbumWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct AlbumUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> AlbumUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create(mut self, name: AlbumSetName, params: Vec) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(AlbumSetParam::from(name).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); + self + } +} +pub struct AlbumDelete<'a> { + query: Query<'a>, +} +impl<'a> AlbumDelete<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) + } +} +pub struct AlbumActions<'a> { + client: &'a PrismaClient, +} +impl<'a> AlbumActions<'a> { + pub fn find_unique(&self, param: AlbumWhereUniqueParam) -> AlbumFindUnique { + let param: AlbumWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findUnique".into(), + model: "Album".into(), + outputs: album_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + AlbumFindUnique { + query, + with_params: vec![], + } + } + pub fn find_first(&self, params: Vec) -> AlbumFindFirst { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: vec![Field { + name: "AND".into(), + list: true, + wrap_list: true, + fields: Some(where_fields), + ..Default::default() + }], + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findFirst".into(), + model: "Album".into(), + outputs: album_outputs(), + inputs, + }; + AlbumFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn find_many(&self, params: Vec) -> AlbumFindMany { + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); + let inputs = if where_fields.len() > 0 { + vec![Input { + name: "where".into(), + fields: where_fields, + ..Default::default() + }] + } else { + Vec::new() + }; + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "query".into(), + method: "findMany".into(), + model: "Album".into(), + outputs: album_outputs(), + inputs, + }; + AlbumFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } + } + pub fn create_one( + &self, + name: AlbumSetName, + params: Vec, + ) -> AlbumCreateOne { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(AlbumSetParam::from(name).to_field()); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "createOne".into(), + model: "Album".into(), + outputs: album_outputs(), + inputs: vec![Input { + name: "data".into(), + fields: input_fields, + ..Default::default() + }], + }; + AlbumCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: AlbumWhereUniqueParam) -> AlbumUpsertOne { + let param: AlbumWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Album".into(), + outputs: album_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + AlbumUpsertOne { query } + } +} +fn comment_outputs() -> Vec { + vec![ + Output::new("id"), + Output::new("content"), + Output::new("date_created"), + Output::new("date_modified"), + Output::new("file_id"), + ] +} +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct CommentData { + #[serde(rename = "id")] + pub id: i32, + #[serde(rename = "content")] + pub content: String, + #[serde(rename = "date_created")] + pub date_created: chrono::DateTime, + #[serde(rename = "date_modified")] + pub date_modified: chrono::DateTime, + #[serde(rename = "file_id")] + pub file_id: Option, + #[serde(rename = "file")] + file: Option>, +} +impl CommentData { + pub fn file(&self) -> Result<&FileData, String> { + match self.file.as_ref() { + Some(v) => Ok(v), + None => Err( + "Attempted to access file but did not fetch it using the .with() syntax" + .to_string(), + ), + } + } +} +pub struct Comment; +impl Comment { + pub fn id() -> CommentIdField { + CommentIdField {} + } + pub fn content() -> CommentContentField { + CommentContentField {} + } + pub fn date_created() -> CommentDateCreatedField { + CommentDateCreatedField {} + } + pub fn date_modified() -> CommentDateModifiedField { + CommentDateModifiedField {} + } + pub fn file_id() -> CommentFileIdField { + CommentFileIdField {} + } + pub fn file() -> CommentFileField { + CommentFileField {} + } +} +pub struct CommentIdField {} +impl CommentIdField { + pub fn set>(&self, value: i32) -> T { + CommentSetId(value).into() + } + pub fn equals>(&self, value: i32) -> T { + CommentWhereUniqueParam::IdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> CommentOrderByParam { + CommentOrderByParam::Id(direction) + } + pub fn cursor(&self, cursor: i32) -> CommentCursor { + CommentCursor::Id(cursor) + } + pub fn increment(&self, value: i32) -> CommentSetParam { + CommentSetParam::Id(value) + } + pub fn decrement(&self, value: i32) -> CommentSetParam { + CommentSetParam::Id(value) + } + pub fn multiply(&self, value: i32) -> CommentSetParam { + CommentSetParam::Id(value) + } + pub fn divide(&self, value: i32) -> CommentSetParam { + CommentSetParam::Id(value) + } + pub fn in_vec(&self, value: Vec) -> CommentWhereParam { + CommentWhereParam::IdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> CommentWhereParam { + CommentWhereParam::IdNotInVec(value) + } + pub fn lt(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::IdGte(value) + } + pub fn not(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::IdNot(value) + } + pub fn lt(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::IdLt(value) + } + pub fn lte(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::IdLte(value) + } + pub fn gt(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::IdGt(value) + } + pub fn gte(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::IdGte(value) + } +} +pub struct CommentSetId(i32); +impl From for CommentSetParam { + fn from(value: CommentSetId) -> Self { + Self::SetId(value.0) + } +} +pub struct CommentContentField {} +impl CommentContentField { + pub fn set>(&self, value: String) -> T { + CommentSetContent(value).into() + } + pub fn equals(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentEquals(value).into() + } + pub fn order(&self, direction: Direction) -> CommentOrderByParam { + CommentOrderByParam::Content(direction) + } + pub fn cursor(&self, cursor: String) -> CommentCursor { + CommentCursor::Content(cursor) + } + pub fn in_vec(&self, value: Vec) -> CommentWhereParam { + CommentWhereParam::ContentInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> CommentWhereParam { + CommentWhereParam::ContentNotInVec(value) + } + pub fn lt(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentLt(value) + } + pub fn lte(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentLte(value) + } + pub fn gt(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentGt(value) + } + pub fn gte(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentGte(value) + } + pub fn contains(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentContains(value) + } + pub fn starts_with(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentStartsWith(value) + } + pub fn ends_with(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentEndsWith(value) + } + pub fn not(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentNot(value) + } + pub fn has_prefix(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentHasPrefix(value) + } + pub fn has_suffix(&self, value: String) -> CommentWhereParam { + CommentWhereParam::ContentHasSuffix(value) + } +} +pub struct CommentSetContent(String); +impl From for CommentSetParam { + fn from(value: CommentSetContent) -> Self { + Self::SetContent(value.0) + } +} +pub struct CommentDateCreatedField {} +impl CommentDateCreatedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + CommentSetDateCreated(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateCreatedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> CommentOrderByParam { + CommentOrderByParam::DateCreated(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> CommentCursor { + CommentCursor::DateCreated(cursor) + } + pub fn in_vec(&self, value: Vec>) -> CommentWhereParam { + CommentWhereParam::DateCreatedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> CommentWhereParam { + CommentWhereParam::DateCreatedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateCreatedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateCreatedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateCreatedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateCreatedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateCreatedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateCreatedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateCreatedAfter(value) + } + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> CommentWhereParam { + CommentWhereParam::DateCreatedBeforeEquals(value) + } + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> CommentWhereParam { + CommentWhereParam::DateCreatedAfterEquals(value) + } +} +pub struct CommentSetDateCreated(chrono::DateTime); +impl From for CommentSetParam { + fn from(value: CommentSetDateCreated) -> Self { + Self::SetDateCreated(value.0) + } +} +pub struct CommentDateModifiedField {} +impl CommentDateModifiedField { + pub fn set>( + &self, + value: chrono::DateTime, + ) -> T { + CommentSetDateModified(value).into() + } + pub fn equals(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateModifiedEquals(value).into() + } + pub fn order(&self, direction: Direction) -> CommentOrderByParam { + CommentOrderByParam::DateModified(direction) + } + pub fn cursor(&self, cursor: chrono::DateTime) -> CommentCursor { + CommentCursor::DateModified(cursor) + } + pub fn in_vec(&self, value: Vec>) -> CommentWhereParam { + CommentWhereParam::DateModifiedInVec(value) + } + pub fn not_in_vec( + &self, + value: Vec>, + ) -> CommentWhereParam { + CommentWhereParam::DateModifiedNotInVec(value) + } + pub fn lt(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateModifiedLt(value) + } + pub fn lte(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateModifiedLte(value) + } + pub fn gt(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateModifiedGt(value) + } + pub fn gte(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateModifiedGte(value) + } + pub fn not(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateModifiedNot(value) + } + pub fn before(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateModifiedBefore(value) + } + pub fn after(&self, value: chrono::DateTime) -> CommentWhereParam { + CommentWhereParam::DateModifiedAfter(value) + } + pub fn before_equals( + &self, + value: chrono::DateTime, + ) -> CommentWhereParam { + CommentWhereParam::DateModifiedBeforeEquals(value) + } + pub fn after_equals( + &self, + value: chrono::DateTime, + ) -> CommentWhereParam { + CommentWhereParam::DateModifiedAfterEquals(value) + } +} +pub struct CommentSetDateModified(chrono::DateTime); +impl From for CommentSetParam { + fn from(value: CommentSetDateModified) -> Self { + Self::SetDateModified(value.0) + } +} +pub struct CommentFileIdField {} +impl CommentFileIdField { + pub fn set>(&self, value: i32) -> T { + CommentSetFileId(value).into() + } + pub fn equals(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdEquals(value).into() + } + pub fn order(&self, direction: Direction) -> CommentOrderByParam { + CommentOrderByParam::FileId(direction) + } + pub fn cursor(&self, cursor: i32) -> CommentCursor { + CommentCursor::FileId(cursor) + } + pub fn increment(&self, value: i32) -> CommentSetParam { + CommentSetParam::FileId(value) + } + pub fn decrement(&self, value: i32) -> CommentSetParam { + CommentSetParam::FileId(value) + } + pub fn multiply(&self, value: i32) -> CommentSetParam { + CommentSetParam::FileId(value) + } + pub fn divide(&self, value: i32) -> CommentSetParam { + CommentSetParam::FileId(value) + } + pub fn in_vec(&self, value: Vec) -> CommentWhereParam { + CommentWhereParam::FileIdInVec(value) + } + pub fn not_in_vec(&self, value: Vec) -> CommentWhereParam { + CommentWhereParam::FileIdNotInVec(value) + } + pub fn lt(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdLt(value) + } + pub fn lte(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdLte(value) + } + pub fn gt(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdGt(value) + } + pub fn gte(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdGte(value) + } + pub fn not(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdNot(value) + } + pub fn lt(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdLt(value) + } + pub fn lte(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdLte(value) + } + pub fn gt(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdGt(value) + } + pub fn gte(&self, value: i32) -> CommentWhereParam { + CommentWhereParam::FileIdGte(value) + } +} +pub struct CommentSetFileId(i32); +impl From for CommentSetParam { + fn from(value: CommentSetFileId) -> Self { + Self::SetFileId(value.0) + } +} +pub struct CommentFileField {} +impl CommentFileField { + pub fn is(&self, value: Vec) -> CommentWhereParam { + CommentWhereParam::FileIs(value) + } + pub fn fetch(&self) -> CommentWithParam { + CommentWithParam::File + } + pub fn link>(&self, value: FileWhereUniqueParam) -> T { + CommentLinkFile(value).into() + } + pub fn unlink(&self) -> CommentSetParam { + CommentSetParam::UnLinkFile + } +} +pub struct CommentLinkFile(FileWhereUniqueParam); +impl From for CommentSetParam { + fn from(value: CommentLinkFile) -> Self { + Self::LinkFile(value.0) + } } pub enum CommentWithParam { File, } -impl From for CommentWith { - fn from(param: CommentWithParam) -> Self { - Self { param } - } -} impl CommentWithParam { - pub fn output(self) -> Output { + pub fn to_output(self) -> Output { match self { Self::File => Output { name: "file".into(), @@ -14355,16 +31423,113 @@ impl CommentWithParam { } } pub enum CommentSetParam { - Id(i64), + SetId(i32), + SetContent(String), + SetDateCreated(chrono::DateTime), + SetDateModified(chrono::DateTime), + SetFileId(i32), + LinkFile(FileWhereUniqueParam), + UnLinkFile, +} +impl CommentSetParam { + pub fn to_field(self) -> Field { + match self { + Self::SetId(value) => Field { + name: "id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetContent(value) => Field { + name: "content".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateCreated(value) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetDateModified(value) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::SetFileId(value) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }, + Self::LinkFile(where_param) => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "connect".into(), + fields: Some(transform_equals(vec![Into::::into( + where_param, + ) + .to_field()])), + ..Default::default() + }]), + ..Default::default() + }, + Self::UnLinkFile => Field { + name: "file".into(), + fields: Some(vec![Field { + name: "disconnect".into(), + value: Some(true.into()), + ..Default::default() + }]), + ..Default::default() + }, + } + } +} +pub enum CommentOrderByParam { + Id(Direction), + Content(Direction), + DateCreated(Direction), + DateModified(Direction), + FileId(Direction), +} +impl CommentOrderByParam { + pub fn to_field(self) -> Field { + match self { + Self::Id(direction) => Field { + name: "id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::Content(direction) => Field { + name: "content".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateCreated(direction) => Field { + name: "date_created".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::DateModified(direction) => Field { + name: "date_modified".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + Self::FileId(direction) => Field { + name: "file_id".into(), + value: Some(serde_json::to_value(direction).unwrap()), + ..Default::default() + }, + } + } +} +pub enum CommentCursor { + Id(i32), Content(String), DateCreated(chrono::DateTime), DateModified(chrono::DateTime), - FileId(i64), - LinkFile(FileWhereParam), - UnlinkFile, + FileId(i32), } -impl CommentSetParam { - pub fn field(self) -> Field { +impl CommentCursor { + fn to_field(self) -> Field { match self { Self::Id(value) => Field { name: "id".into(), @@ -14391,20 +31556,744 @@ impl CommentSetParam { value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }, - Self::LinkFile(where_param) => Field { - name: "file".into(), + } + } +} +pub enum CommentWhereParam { + Not(Vec), + Or(Vec), + And(Vec), + IdEquals(i32), + IdInVec(Vec), + IdNotInVec(Vec), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + IdNot(i32), + IdLt(i32), + IdLte(i32), + IdGt(i32), + IdGte(i32), + ContentEquals(String), + ContentInVec(Vec), + ContentNotInVec(Vec), + ContentLt(String), + ContentLte(String), + ContentGt(String), + ContentGte(String), + ContentContains(String), + ContentStartsWith(String), + ContentEndsWith(String), + ContentNot(String), + ContentHasPrefix(String), + ContentHasSuffix(String), + DateCreatedEquals(chrono::DateTime), + DateCreatedInVec(Vec>), + DateCreatedNotInVec(Vec>), + DateCreatedLt(chrono::DateTime), + DateCreatedLte(chrono::DateTime), + DateCreatedGt(chrono::DateTime), + DateCreatedGte(chrono::DateTime), + DateCreatedNot(chrono::DateTime), + DateCreatedBefore(chrono::DateTime), + DateCreatedAfter(chrono::DateTime), + DateCreatedBeforeEquals(chrono::DateTime), + DateCreatedAfterEquals(chrono::DateTime), + DateModifiedEquals(chrono::DateTime), + DateModifiedInVec(Vec>), + DateModifiedNotInVec(Vec>), + DateModifiedLt(chrono::DateTime), + DateModifiedLte(chrono::DateTime), + DateModifiedGt(chrono::DateTime), + DateModifiedGte(chrono::DateTime), + DateModifiedNot(chrono::DateTime), + DateModifiedBefore(chrono::DateTime), + DateModifiedAfter(chrono::DateTime), + DateModifiedBeforeEquals(chrono::DateTime), + DateModifiedAfterEquals(chrono::DateTime), + FileIdEquals(i32), + FileIdInVec(Vec), + FileIdNotInVec(Vec), + FileIdLt(i32), + FileIdLte(i32), + FileIdGt(i32), + FileIdGte(i32), + FileIdNot(i32), + FileIdLt(i32), + FileIdLte(i32), + FileIdGt(i32), + FileIdGte(i32), + FileIs(Vec), +} +impl CommentWhereParam { + pub fn to_field(&self) -> Field { + match &self { + Self::Not(value) => Field { + name: "Not".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::Or(value) => Field { + name: "Or".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::And(value) => Field { + name: "And".into(), + list: true, + wrap_list: true, + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), + ..Default::default() + }, + Self::IdEquals(value) => Field { + name: "id".into(), fields: Some(vec![Field { - name: "connect".into(), - fields: Some(transform_equals(vec![where_param.field()])), + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), ..Default::default() }]), ..Default::default() }, - Self::UnlinkFile => Field { + Self::IdInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNotInVec(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdNot(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdLte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGt(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::IdGte(value) => Field { + name: "id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentEquals(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentInVec(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentNotInVec(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentLt(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentLte(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentGt(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentGte(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentContains(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "contains".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentStartsWith(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "startsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentEndsWith(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "endsWith".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentNot(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentHasPrefix(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "starts_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::ContentHasSuffix(value) => Field { + name: "content".into(), + fields: Some(vec![Field { + name: "ends_with".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNotInVec(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedLte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGt(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedGte(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedNot(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBefore(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfter(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedBeforeEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateCreatedAfterEquals(value) => Field { + name: "date_created".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNotInVec(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedLte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGt(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedGte(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedNot(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBefore(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfter(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedBeforeEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::DateModifiedAfterEquals(value) => Field { + name: "date_modified".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdEquals(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "equals".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdInVec(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "in".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdNotInVec(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "notIn".into(), + list: true, + fields: Some( + value + .iter() + .map(|v| Field { + value: Some(serde_json::to_value(v).unwrap()), + ..Default::default() + }) + .collect(), + ), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdNot(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "not".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdLte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "lte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGt(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gt".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIdGte(value) => Field { + name: "file_id".into(), + fields: Some(vec![Field { + name: "gte".into(), + value: Some(serde_json::to_value(value).unwrap()), + ..Default::default() + }]), + ..Default::default() + }, + Self::FileIs(value) => Field { name: "file".into(), fields: Some(vec![Field { - name: "disconnect".into(), - value: Some(true.into()), + name: "is".into(), + fields: Some(value.into_iter().map(|f| f.to_field()).collect()), ..Default::default() }]), ..Default::default() @@ -14412,12 +32301,51 @@ impl CommentSetParam { } } } +pub enum CommentWhereUniqueParam { + IdEquals(i32), +} +impl From for CommentWhereParam { + fn from(value: CommentWhereUniqueParam) -> Self { + match value { + CommentWhereUniqueParam::IdEquals(value) => Self::IdEquals(value), + } + } +} +impl From> for CommentWhereParam { + fn from(op: Operator) -> Self { + match op { + Operator::Not(value) => Self::Not(value), + Operator::And(value) => Self::And(value), + Operator::Or(value) => Self::Or(value), + } + } +} pub struct CommentFindMany<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> CommentFindMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> CommentDelete<'a> { CommentDelete { @@ -14436,7 +32364,7 @@ impl<'a> CommentFindMany<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -14456,33 +32384,119 @@ impl<'a> CommentFindMany<'a> { method: "updateMany".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn order_by(mut self, param: CommentOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn with(mut self, param: CommentWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: CommentCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct CommentFindFirst<'a> { query: Query<'a>, + order_by_params: Vec, + with_params: Vec, } impl<'a> CommentFindFirst<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + order_by_params, + with_params, + } = self; + if order_by_params.len() > 0 { + query.inputs.push(Input { + name: "orderBy".into(), + fields: order_by_params.into_iter().map(|f| f.to_field()).collect(), + ..Default::default() + }); + } + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: CommentWithParam) -> Self { + self.with_params.push(param); + self + } + pub fn order_by(mut self, param: CommentOrderByParam) -> Self { + self.order_by_params.push(param); + self + } + pub fn skip(mut self, skip: usize) -> Self { + self.query.inputs.push(Input { + name: "skip".into(), + value: Some(serde_json::to_value(skip).unwrap()), + ..Default::default() + }); + self + } + pub fn take(mut self, take: usize) -> Self { + self.query.inputs.push(Input { + name: "take".into(), + value: Some(serde_json::to_value(take).unwrap()), + ..Default::default() + }); + self + } + pub fn cursor(mut self, cursor: CommentCursor) -> Self { + self.query.inputs.push(Input { + name: "cursor".into(), + fields: vec![cursor.to_field()], + ..Default::default() + }); self } } pub struct CommentFindUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> CommentFindUnique<'a> { - pub async fn exec(self) -> Option { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await } pub fn delete(self) -> CommentDelete<'a> { CommentDelete { @@ -14500,7 +32514,7 @@ impl<'a> CommentFindUnique<'a> { fields: params .into_iter() .map(|param| { - let mut field = param.field(); + let mut field = param.to_field(); if let Some(value) = field.value { field.fields = Some(vec![Field { name: "set".into(), @@ -14520,45 +32534,105 @@ impl<'a> CommentFindUnique<'a> { method: "updateOne".into(), ..self.query }, + with_params: vec![], } } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: CommentWithParam) -> Self { + self.with_params.push(param); self } } pub struct CommentCreateOne<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> CommentCreateOne<'a> { - pub async fn exec(self) -> CommentData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + let Self { + mut query, + with_params, + } = self; + query.outputs.extend( + with_params + .into_iter() + .map(|f| f.to_output()) + .collect::>(), + ); + query.perform().await + } + pub fn with(mut self, param: CommentWithParam) -> Self { + self.with_params.push(param); + self } } pub struct CommentUpdateUnique<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> CommentUpdateUnique<'a> { - pub async fn exec(self) -> CommentData { - self.query.perform::().await.unwrap() + pub async fn exec(self) -> QueryResult { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: CommentWithParam) -> Self { + self.with_params.push(param); self } } pub struct CommentUpdateMany<'a> { query: Query<'a>, + with_params: Vec, } impl<'a> CommentUpdateMany<'a> { - pub async fn exec(self) -> Vec { - self.query.perform::>().await.unwrap() + pub async fn exec(self) -> QueryResult> { + self.query.perform().await } - pub fn with(mut self, fetches: Vec) -> Self { - let outputs = fetches.into_iter().map(|f| f.param.output()).collect::>(); - self.query.outputs.extend(outputs); + pub fn with(mut self, param: CommentWithParam) -> Self { + self.with_params.push(param); + self + } +} +pub struct CommentUpsertOne<'a> { + query: Query<'a>, +} +impl<'a> CommentUpsertOne<'a> { + pub async fn exec(self) -> QueryResult { + self.query.perform().await + } + pub fn create( + mut self, + content: CommentSetContent, + params: Vec, + ) -> Self { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(CommentSetParam::from(content).to_field()); + self.query.inputs.push(Input { + name: "create".into(), + fields: input_fields, + ..Default::default() + }); + self + } + pub fn update(mut self, params: Vec) -> Self { + self.query.inputs.push(Input { + name: "update".into(), + fields: params + .into_iter() + .map(|param| { + let mut field = param.to_field(); + if let Some(value) = field.value { + field.fields = Some(vec![Field { + name: "set".into(), + value: Some(value), + ..Default::default() + }]); + field.value = None; + } + field + }) + .collect(), + ..Default::default() + }); self } } @@ -14566,18 +32640,22 @@ pub struct CommentDelete<'a> { query: Query<'a>, } impl<'a> CommentDelete<'a> { - pub async fn exec(self) -> isize { - self.query.perform::().await.unwrap().count + pub async fn exec(self) -> QueryResult { + self.query.perform::().await.map(|r| r.count) } } pub struct CommentActions<'a> { client: &'a PrismaClient, } impl<'a> CommentActions<'a> { - pub fn find_unique(&self, param: CommentWhereParam) -> CommentFindUnique { - let fields = transform_equals(vec![param.field()]); + pub fn find_unique(&self, param: CommentWhereUniqueParam) -> CommentFindUnique { + let param: CommentWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findUnique".into(), @@ -14589,10 +32667,14 @@ impl<'a> CommentActions<'a> { ..Default::default() }], }; - CommentFindUnique { query } + CommentFindUnique { + query, + with_params: vec![], + } } pub fn find_first(&self, params: Vec) -> CommentFindFirst { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -14609,7 +32691,10 @@ impl<'a> CommentActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findFirst".into(), @@ -14617,10 +32702,15 @@ impl<'a> CommentActions<'a> { outputs: comment_outputs(), inputs, }; - CommentFindFirst { query } + CommentFindFirst { + query, + order_by_params: vec![], + with_params: vec![], + } } pub fn find_many(&self, params: Vec) -> CommentFindMany { - let where_fields: Vec = params.into_iter().map(|param| param.field()).collect(); + let where_fields: Vec = + params.into_iter().map(|param| param.to_field()).collect(); let inputs = if where_fields.len() > 0 { vec![Input { name: "where".into(), @@ -14631,7 +32721,10 @@ impl<'a> CommentActions<'a> { Vec::new() }; let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "query".into(), method: "findMany".into(), @@ -14639,13 +32732,25 @@ impl<'a> CommentActions<'a> { outputs: comment_outputs(), inputs, }; - CommentFindMany { query } + CommentFindMany { + query, + order_by_params: vec![], + with_params: vec![], + } } - pub fn create_one(&self, content: CommentSetContent, params: Vec) -> CommentCreateOne { - let mut input_fields = params.into_iter().map(|p| p.field()).collect::>(); - input_fields.push(CommentSetParam::from(content).field()); + pub fn create_one( + &self, + content: CommentSetContent, + params: Vec, + ) -> CommentCreateOne { + let mut input_fields = + params.into_iter().map(|p| p.to_field()).collect::>(); + input_fields.push(CommentSetParam::from(content).to_field()); let query = Query { - ctx: QueryContext::new(&self.client.executor, self.client.query_schema.clone()), + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), name: String::new(), operation: "mutation".into(), method: "createOne".into(), @@ -14657,6 +32762,292 @@ impl<'a> CommentActions<'a> { ..Default::default() }], }; - CommentCreateOne { query } + CommentCreateOne { + query, + with_params: vec![], + } + } + pub fn upsert_one(&self, param: CommentWhereUniqueParam) -> CommentUpsertOne { + let param: CommentWhereParam = param.into(); + let fields = transform_equals(vec![param.to_field()]); + let query = Query { + ctx: QueryContext::new( + &self.client.executor, + self.client.query_schema.clone(), + ), + name: String::new(), + operation: "mutation".into(), + method: "upsertOne".into(), + model: "Comment".into(), + outputs: comment_outputs(), + inputs: vec![Input { + name: "where".into(), + fields, + ..Default::default() + }], + }; + CommentUpsertOne { query } } } +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum MigrationScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "name")] + Name, + #[serde(rename = "checksum")] + Checksum, + #[serde(rename = "steps_applied")] + StepsApplied, + #[serde(rename = "applied_at")] + AppliedAt, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum LibraryScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "uuid")] + Uuid, + #[serde(rename = "name")] + Name, + #[serde(rename = "remote_id")] + RemoteId, + #[serde(rename = "is_primary")] + IsPrimary, + #[serde(rename = "encryption")] + Encryption, + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "timezone")] + Timezone, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum LibraryStatisticsScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "date_captured")] + DateCaptured, + #[serde(rename = "library_id")] + LibraryId, + #[serde(rename = "total_file_count")] + TotalFileCount, + #[serde(rename = "total_bytes_used")] + TotalBytesUsed, + #[serde(rename = "total_byte_capacity")] + TotalByteCapacity, + #[serde(rename = "total_unique_bytes")] + TotalUniqueBytes, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum ClientScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "uuid")] + Uuid, + #[serde(rename = "name")] + Name, + #[serde(rename = "platform")] + Platform, + #[serde(rename = "version")] + Version, + #[serde(rename = "online")] + Online, + #[serde(rename = "last_seen")] + LastSeen, + #[serde(rename = "timezone")] + Timezone, + #[serde(rename = "date_created")] + DateCreated, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum LocationScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "name")] + Name, + #[serde(rename = "local_path")] + LocalPath, + #[serde(rename = "total_capacity")] + TotalCapacity, + #[serde(rename = "available_capacity")] + AvailableCapacity, + #[serde(rename = "filesystem")] + Filesystem, + #[serde(rename = "disk_type")] + DiskType, + #[serde(rename = "is_removable")] + IsRemovable, + #[serde(rename = "is_ejectable")] + IsEjectable, + #[serde(rename = "is_root_filesystem")] + IsRootFilesystem, + #[serde(rename = "is_online")] + IsOnline, + #[serde(rename = "date_created")] + DateCreated, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum FileScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "kind")] + Kind, + #[serde(rename = "size_in_bytes")] + SizeInBytes, + #[serde(rename = "partial_checksum")] + PartialChecksum, + #[serde(rename = "checksum")] + Checksum, + #[serde(rename = "encryption")] + Encryption, + #[serde(rename = "ipfs_id")] + IpfsId, + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "date_modified")] + DateModified, + #[serde(rename = "date_indexed")] + DateIndexed, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum FilePathScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "is_dir")] + IsDir, + #[serde(rename = "location_id")] + LocationId, + #[serde(rename = "materialized_path")] + MaterializedPath, + #[serde(rename = "name")] + Name, + #[serde(rename = "extension")] + Extension, + #[serde(rename = "file_id")] + FileId, + #[serde(rename = "parent_id")] + ParentId, + #[serde(rename = "encryption")] + Encryption, + #[serde(rename = "permissions")] + Permissions, + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "date_modified")] + DateModified, + #[serde(rename = "date_indexed")] + DateIndexed, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum TagScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "name")] + Name, + #[serde(rename = "encryption")] + Encryption, + #[serde(rename = "total_files")] + TotalFiles, + #[serde(rename = "redundancy_goal")] + RedundancyGoal, + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "date_modified")] + DateModified, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum TagOnFileScalarFieldEnum { + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "tag_id")] + TagId, + #[serde(rename = "file_id")] + FileId, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum LabelScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "name")] + Name, + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "date_modified")] + DateModified, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum LabelOnFileScalarFieldEnum { + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "label_id")] + LabelId, + #[serde(rename = "file_id")] + FileId, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum JobScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "action")] + Action, + #[serde(rename = "status")] + Status, + #[serde(rename = "task_count")] + TaskCount, + #[serde(rename = "completed_task_count")] + CompletedTaskCount, + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "date_modified")] + DateModified, + #[serde(rename = "seconds_elapsed")] + SecondsElapsed, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum SpaceScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "name")] + Name, + #[serde(rename = "encryption")] + Encryption, + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "date_modified")] + DateModified, + #[serde(rename = "libraryId")] + LibraryId, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum AlbumScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "name")] + Name, + #[serde(rename = "is_hidden")] + IsHidden, + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "date_modified")] + DateModified, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum CommentScalarFieldEnum { + #[serde(rename = "id")] + Id, + #[serde(rename = "content")] + Content, + #[serde(rename = "date_created")] + DateCreated, + #[serde(rename = "date_modified")] + DateModified, + #[serde(rename = "file_id")] + FileId, +} +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +enum SortOrder { + #[serde(rename = "asc")] + Asc, + #[serde(rename = "desc")] + Desc, +}