diff --git a/Manifest.toml b/Manifest.toml index d452c05..ed01c08 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,13 +1,8 @@ # This file is machine-generated - editing it directly is not advised -[[Adapt]] -deps = ["LinearAlgebra"] -git-tree-sha1 = "84918055d15b3114ede17ac6a7182f68870c16f7" -uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -version = "3.3.1" - [[ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" +version = "1.1.1" [[Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" @@ -22,25 +17,30 @@ uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232" version = "0.5.10" [[CEnum]] -git-tree-sha1 = "215a9aa4a1f23fbd05b92769fdd62559488d70e9" +git-tree-sha1 = "eb4cb44a499229b3b8426dcfb5dd85333951ff90" uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" -version = "0.4.1" +version = "0.4.2" [[Compat]] deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] -git-tree-sha1 = "e4e2b39db08f967cc1360951f01e8a75ec441cab" +git-tree-sha1 = "d476eaeddfcdf0de15a67a948331c69a585495fa" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "3.30.0" +version = "3.47.0" + +[[CompilerSupportLibraries_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" +version = "1.0.5+0" [[Crayons]] -git-tree-sha1 = "3f71217b538d7aaee0b69ab47d9b7724ca8afa0d" +git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" -version = "4.0.4" +version = "4.1.1" [[DataAPI]] -git-tree-sha1 = "dfb3b7e89e395be1e25c2ad6d7690dc29cc53b1d" +git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe" uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" -version = "1.6.0" +version = "1.16.0" [[DataFrames]] deps = ["Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] @@ -50,9 +50,9 @@ version = "1.1.1" [[DataStructures]] deps = ["Compat", "InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "4437b64df1e0adccc3e5d1adbc3ac741095e4677" +git-tree-sha1 = "1d0a14036acb104d9e89698bd408f63ab58cdc82" uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.18.9" +version = "0.18.20" [[DataValueInterfaces]] git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" @@ -76,41 +76,44 @@ version = "0.4.1" [[DelimitedFiles]] deps = ["Mmap"] +git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae" uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" +version = "1.9.1" [[Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[DocStringExtensions]] -deps = ["LibGit2", "Markdown", "Pkg", "Test"] -git-tree-sha1 = "9d4f64f79012636741cf01133158a54b24924c32" +deps = ["LibGit2"] +git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b" uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.8.4" +version = "0.8.6" [[Downloads]] -deps = ["ArgTools", "LibCURL", "NetworkOptions"] +deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +version = "1.6.0" [[ExprTools]] -git-tree-sha1 = "10407a39b87f29d47ebaca8edbc75d7c302ff93e" +git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec" uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" -version = "0.1.3" +version = "0.1.10" [[EzXML]] deps = ["Printf", "XML2_jll"] -git-tree-sha1 = "0fa3b52a04a4e210aeb1626def9c90df3ae65268" +git-tree-sha1 = "380053d61bb9064d6aa4a9777413b40429c79901" uuid = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615" -version = "1.1.0" +version = "1.2.0" [[FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" [[Formatting]] -deps = ["Printf"] -git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8" +deps = ["Logging", "Printf"] +git-tree-sha1 = "fb409abab2caf118986fc597ba84b50cbaf00b87" uuid = "59287772-0a20-5a39-b81b-1366585eb4c0" -version = "0.4.2" +version = "0.4.3" [[Future]] deps = ["Random"] @@ -118,9 +121,9 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" [[Infinity]] deps = ["Dates", "Random", "Requires"] -git-tree-sha1 = "633bac4f993e1237ad9745ae8df9c8378c6ef27a" +git-tree-sha1 = "cf8234411cbeb98676c173f930951ea29dca3b23" uuid = "a303e19e-6eb4-11e9-3b09-cd9505f79100" -version = "0.2.3" +version = "0.2.4" [[InteractiveUtils]] deps = ["Markdown"] @@ -133,10 +136,9 @@ uuid = "d8418881-c3e1-53bb-8760-2df7ec849ed5" version = "1.5.0" [[InvertedIndices]] -deps = ["Test"] -git-tree-sha1 = "15732c475062348b0165684ffe28e85ea8396afc" +git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038" uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f" -version = "1.0.0" +version = "1.3.0" [[IterTools]] git-tree-sha1 = "05110a2ab1fc5f932622ffea2a003221f4782c18" @@ -155,10 +157,10 @@ uuid = "82899510-4779-5014-852e-03e436cf321d" version = "1.0.0" [[JLLWrappers]] -deps = ["Preferences"] -git-tree-sha1 = "642a199af8b68253517b80bd3bfd17eb4e84df6e" +deps = ["Artifacts", "Preferences"] +git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" -version = "1.3.0" +version = "1.5.0" [[JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] @@ -178,10 +180,12 @@ uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" [[LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" +version = "0.6.3" [[LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" +version = "7.84.0+0" [[LibGit2]] deps = ["Base64", "NetworkOptions", "Printf", "SHA"] @@ -202,18 +206,19 @@ version = "12.3.0+0" [[LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" +version = "1.10.2+0" [[Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" [[Libiconv_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "42b62845d70a619f063a7da093d995ec8e15e778" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "f9557a255370125b405568f9767d6d195822a175" uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531" -version = "1.16.1+1" +version = "1.17.0+0" [[LinearAlgebra]] -deps = ["Libdl"] +deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[Logging]] @@ -221,9 +226,9 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" [[MacroTools]] deps = ["Markdown", "Random"] -git-tree-sha1 = "6a8a2a625ab0dea913aba95c11370589e0239ff0" +git-tree-sha1 = "2fa9ee3e63fd3a4f7a9a4f4744a52f4856de82df" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -version = "0.5.6" +version = "0.5.13" [[Markdown]] deps = ["Base64"] @@ -232,78 +237,104 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" +version = "2.28.2+0" [[Memento]] -deps = ["Dates", "Distributed", "JSON", "Serialization", "Sockets", "Syslogs", "Test", "TimeZones", "UUIDs"] -git-tree-sha1 = "d6dfb54d7e8a9b4a2b1773acf7275a4f607906b2" +deps = ["Dates", "Distributed", "Requires", "Serialization", "Sockets", "Test", "UUIDs"] +git-tree-sha1 = "bb2e8f4d9f400f6e90d57b34860f6abdc51398e5" uuid = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9" -version = "1.1.2" +version = "1.4.1" [[Missings]] deps = ["DataAPI"] -git-tree-sha1 = "f8c673ccc215eb50fcadb285f522420e29e69e1c" +git-tree-sha1 = "ec4f7fbeab05d7747bdf98eb74d130a2a2ed298d" uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" -version = "0.4.5" +version = "1.2.0" [[Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[Mocking]] -deps = ["ExprTools"] -git-tree-sha1 = "916b850daad0d46b8c71f65f719c49957e9513ed" +deps = ["Compat", "ExprTools"] +git-tree-sha1 = "c74e5e7c5f83ccb0bca0377d316d966d296106d4" uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" -version = "0.7.1" +version = "0.7.9" [[MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" +version = "2022.10.11" [[NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" +version = "1.2.0" [[OffsetArrays]] -deps = ["Adapt"] -git-tree-sha1 = "1381a7142eefd4cd12f052a4d2d790fe21bd1d55" +git-tree-sha1 = "1a27764e945a152f7ca7efa04de513d473e9542e" uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.9.2" +version = "1.14.1" + + [OffsetArrays.extensions] + OffsetArraysAdaptExt = "Adapt" + + [OffsetArrays.weakdeps] + Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" + +[[OpenBLAS_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] +uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" +version = "0.3.21+4" [[OpenSSL_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "15003dcb7d8db3c6c857fda14891a539a8f2705a" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "a12e56c72edee3ce6b96667745e6cbbe5498f200" uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" -version = "1.1.10+0" +version = "1.1.23+0" [[OrderedCollections]] -git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c" +git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.4.1" +version = "1.6.3" + +[[Parameters]] +deps = ["OrderedCollections", "UnPack"] +git-tree-sha1 = "34c0e9ad262e5f7fc75b10a9952ca7692cfc5fbe" +uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a" +version = "0.12.3" [[Parsers]] deps = ["Dates"] -git-tree-sha1 = "c8abc88faa3f7a3950832ac5d6e690881590d6dc" +git-tree-sha1 = "bfd7d8c7fd87f04543810d9cbd3995972236ba1b" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "1.1.0" +version = "1.1.2" [[Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +version = "1.9.2" [[PooledArrays]] deps = ["DataAPI", "Future"] -git-tree-sha1 = "cde4ce9d6f33219465b55162811d8de8139c0414" +git-tree-sha1 = "36d8b4b899628fb92c2749eb488d884a926614d3" uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720" +version = "1.4.3" + +[[PrecompileTools]] +deps = ["Preferences"] +git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" +uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" version = "1.2.1" [[Preferences]] deps = ["TOML"] -git-tree-sha1 = "00cfd92944ca9c760982747e9a1d0d5d86ab1e5a" +git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.2.2" +version = "1.4.3" [[PrettyTables]] deps = ["Crayons", "Formatting", "Markdown", "Reexport", "Tables"] -git-tree-sha1 = "b60494adf99652d220cdef46f8a32232182cc22d" +git-tree-sha1 = "dfb54c4e414caa595a1f2ed759b160f5a3ddcba5" uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" -version = "1.0.1" +version = "1.3.1" [[Printf]] deps = ["Unicode"] @@ -326,27 +357,29 @@ deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[Random]] -deps = ["Serialization"] +deps = ["SHA", "Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [[RecipesBase]] -git-tree-sha1 = "b3fb709f3c97bfc6e948be68beeecb55a0b340ae" +deps = ["PrecompileTools"] +git-tree-sha1 = "5c3d09cc4f31f5fc6af001c250bf1278733100ff" uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" -version = "1.1.1" +version = "1.3.4" [[Reexport]] -git-tree-sha1 = "5f6c21241f0f655da3952fd60aa18477cf96c220" +git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" uuid = "189a3867-3050-52da-a836-e630ba90ab69" -version = "1.1.0" +version = "1.2.2" [[Requires]] deps = ["UUIDs"] -git-tree-sha1 = "4036a3bd08ac7e968e27c203d45f5fff15020621" +git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" uuid = "ae029012-a4dd-5104-9daa-d747884805df" -version = "1.1.3" +version = "1.3.0" [[SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" +version = "0.7.0" [[Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" @@ -360,38 +393,39 @@ uuid = "6462fe0b-24de-5631-8697-dd941f90decc" [[SortingAlgorithms]] deps = ["DataStructures"] -git-tree-sha1 = "2ec1962eba973f383239da22e75218565c390a96" +git-tree-sha1 = "66e0a8e672a0bdfca2c3f5937efb8538b9ddc085" uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" -version = "1.0.0" +version = "1.2.1" [[SparseArrays]] -deps = ["LinearAlgebra", "Random"] +deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +version = "1.9.0" [[StringCases]] git-tree-sha1 = "9d2c2ff94838df91866a16832cb0de4449abd54c" uuid = "f22f4433-750e-5048-95f9-cae576f2c120" version = "0.1.0" -[[Syslogs]] -deps = ["Printf", "Sockets"] -git-tree-sha1 = "46badfcc7c6e74535cc7d833a91f4ac4f805f86d" -uuid = "cea106d9-e007-5e6c-ad93-58fe2094e9c4" -version = "0.3.0" +[[SuiteSparse_jll]] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] +uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" +version = "5.10.1+6" [[TOML]] deps = ["Dates"] uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" +version = "1.0.3" [[TableShowUtils]] -deps = ["DataValues", "Dates", "JSON", "Markdown", "Test"] -git-tree-sha1 = "14c54e1e96431fb87f0d2f5983f090f1b9d06457" +deps = ["DataValues", "Dates", "JSON", "Markdown", "Unicode"] +git-tree-sha1 = "2a41a3dedda21ed1184a47caab56ed9304e9a038" uuid = "5e66a065-1f0a-5976-b372-e0b8c017ca10" -version = "0.2.5" +version = "0.2.6" [[TableTraits]] deps = ["IteratorInterfaceExtensions"] @@ -401,9 +435,9 @@ version = "1.0.1" [[TableTraitsUtils]] deps = ["DataValues", "IteratorInterfaceExtensions", "Missings", "TableTraits"] -git-tree-sha1 = "8fc12ae66deac83e44454e61b02c37b326493233" +git-tree-sha1 = "78fecfe140d7abb480b53a44f3f85b6aa373c293" uuid = "382cd787-c1b6-5bf2-a167-d5b971a19bda" -version = "1.0.1" +version = "1.0.2" [[Tables]] deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"] @@ -414,6 +448,7 @@ version = "1.4.3" [[Tar]] deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" +version = "1.10.0" [[Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] @@ -435,23 +470,36 @@ version = "1.5.5" deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +[[UnPack]] +git-tree-sha1 = "387c1f73762231e86e0c9c5443ce3b4a0a9a0c2b" +uuid = "3a884ed6-31ef-47d7-9d2a-63182c4928ed" +version = "1.0.2" + [[Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [[XML2_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "Zlib_jll"] -git-tree-sha1 = "1acf5bdf07aa0907e0a37d3718bb88d4b687b74a" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"] +git-tree-sha1 = "d9717ce3518dc68a99e6b96300813760d887a01d" uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a" -version = "2.9.12+0" +version = "2.13.1+0" [[Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.2.13+0" + +[[libblastrampoline_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" +version = "5.8.0+0" [[nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" +version = "1.48.0+0" [[p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" +version = "17.4.0+0" diff --git a/Project.toml b/Project.toml index d58a55f..d838df3 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PostgresORM" uuid = "748b5efa-ed57-4836-b183-a38105a77fdd" authors = ["Vincent Laugier "] -version = "0.7.1" +version = "0.8.0" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" @@ -9,7 +9,9 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" LibPQ = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1" +Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" Query = "1a8c2f83-1ff3-5112-b086-8aa67b057ba1" +Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" StringCases = "f22f4433-750e-5048-95f9-cae576f2c120" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" TickTock = "9ff05d80-102d-5586-aa04-3a8bd1a90d20" diff --git a/src/Cache/_def.jl b/src/Cache/_def.jl new file mode 100644 index 0000000..7bd3fb1 --- /dev/null +++ b/src/Cache/_def.jl @@ -0,0 +1,14 @@ +# A dictionary to hold the cache, initialized later +const _cache_ref = Ref{Dict{Any, Any}}() + +function add_to_cache end +function get_from_cache end +function remove_from_cache end +function clear_cache end +function cache_keys end +function cache_values end +function _ensure_cache_initialized end +function get_db_entry_key_for_cache end +function generate_fk2pk_mapping_cache end +function generate_cache end +function __init__ end diff --git a/src/Cache/_imp.jl b/src/Cache/_imp.jl new file mode 100644 index 0000000..834b641 --- /dev/null +++ b/src/Cache/_imp.jl @@ -0,0 +1,205 @@ +# module CacheModule + +using .Cache +using .PostgresORM: FKInfo + +""" + add_to_cache(key, value) + +Add a key-value pair to the cache. +""" +function Cache.add_to_cache(key, value) + cache = Cache._ensure_cache_initialized() + cache[key] = value +end + +""" + get_from_cache(key, default=missing) + +Retrieve a value from the cache by its key. +Return `default` if the key is not found. +""" +function Cache.get_from_cache(key, default=missing) + cache = Cache._ensure_cache_initialized() + return get(cache, key, default) +end + +""" + remove_from_cache(key) + +Remove a key-value pair from the cache by its key. +""" +function Cache.remove_from_cache(key) + cache = Cache._ensure_cache_initialized() + delete!(cache, key) +end + +""" + clear_cache() + +Clear all items from the cache. +""" +function Cache.clear_cache() + cache = Cache._ensure_cache_initialized() + empty!(cache) +end + +""" + cache_keys() + +Return a list of all keys in the cache. +""" +function Cache.cache_keys() + cache = Cache._ensure_cache_initialized() + return keys(cache) +end + +""" + cache_values() + +Return a list of all values in the cache. +""" +function Cache.cache_values() + cache = Cache._ensure_cache_initialized() + return values(cache) +end + +# function Cache.to ensure cache is initialized +function Cache._ensure_cache_initialized() + if isnothing(Cache._cache_ref[]) + Cache._cache_ref[] = Dict{Any, Any}() + end + return Cache._cache_ref[] +end + +function Cache.get_db_entry_key_for_cache(dbconn::LibPQ.Connection) + + if !isopen(dbconn) + error("PostgreSQL connection (closed)") + end + + keywords_of_interest = [ + "host", "port", "dbname" + ] + + conninfo = LibPQ.conninfo(dbconn) + + result_elts = String[] + for keyword in keywords_of_interest + for ci_opt in conninfo + if ci_opt.keyword == keyword + push!(result_elts, string(ci_opt.val)) + end + end + end + + return join(result_elts, "/") + +end + +function Cache.generate_fk2pk_mapping_cache(dbconn::LibPQ.Connection) + + fkinfos = FKInfo[] + + for referencing_schema in SchemaInfo.get_schemas(dbconn) + for referencing_table in SchemaInfo.get_tables(referencing_schema, dbconn) + for (constraint_name,v) in SchemaInfo.get_fks(referencing_table, referencing_schema, dbconn) + + referenced_table = v[:referenced_table][:table] + referenced_schema = v[:referenced_table][:schema] + for (referencing_col,referenced_col) in zip(v[:referencing_cols],v[:referenced_cols]) + push!( + fkinfos, + FKInfo( + constraint_name = constraint_name, + referencing_table = referencing_table, + referencing_schema = referencing_schema, + referencing_col = referencing_col, + referenced_table = referenced_table, + referenced_schema = referenced_schema, + referenced_col = referenced_col + ) + ) + end + + end + end + end + + # + cache = Cache._ensure_cache_initialized() + + db_key = Cache.get_db_entry_key_for_cache(dbconn::LibPQ.Connection) + if ismissing(Cache.get_from_cache(db_key, missing)) + Cache.add_to_cache(db_key, Dict{Symbol, Any}()) + end + + if !haskey(cache[db_key], :fkcol2pkcol) + cache[db_key][:fkcol2pkcol] = Dict{ + String, # schema + Dict{ + String, # table + Dict{ + String, # fk col in referencing table + Dict{ + String, # referenced table (a fk col can be involved in several FKs) + NamedTuple + } + } + } + }() + end + + for fkinfo in fkinfos + + # Check that entry for referencing shema exists + if !haskey(cache[db_key][:fkcol2pkcol], fkinfo.referencing_schema) + cache[db_key][:fkcol2pkcol][fkinfo.referencing_schema] = Dict{ + String, # table + Dict{ + String, # fk col in referencing table + Dict{ + String, # referenced table (a fk col can be involved in several FKs) + NamedTuple + } + } + }() + end + + # Check that entry for referencing table exists + if !haskey(cache[db_key][:fkcol2pkcol][fkinfo.referencing_schema], fkinfo.referencing_table) + cache[db_key][:fkcol2pkcol][fkinfo.referencing_schema][fkinfo.referencing_table] = Dict{ + String, # fk col in referencing table + Dict{ + String, # referenced table (a fk col can be involved in several FKs) + NamedTuple + } + }() + end + + # Check that entry for referencing column exists + if !haskey(cache[db_key][:fkcol2pkcol][fkinfo.referencing_schema], fkinfo.referencing_table) + cache[db_key][:fkcol2pkcol][fkinfo.referencing_schema][fkinfo.referencing_table][fkinfo.referencing_col] = Dict{ + String, # fk col in referencing table + Dict{ + String, # referenced table (a fk col can be involved in several FKs) + NamedTuple + } + }() + end + + cache[db_key][:fkcol2pkcol][fkinfo.referencing_schema][fkinfo.referencing_table][fkinfo.referencing_col] = + (schema=fkinfo.referenced_schema, table=fkinfo.referenced_table, col=fkinfo.referenced_col) + end + +end + +function Cache.__init__() + @info("Init PostgresORM.Cache module") + # Initialize the cache when the module is loaded + Cache._cache_ref[] = Dict{Any, Any}() +end + +export add_to_cache, get_from_cache, remove_from_cache, clear_cache, cache_keys, cache_values + +# end # module diff --git a/src/Controller/coreORM.create.jl b/src/Controller/coreORM.create.jl index c60ef5e..c0edc50 100644 --- a/src/Controller/coreORM.create.jl +++ b/src/Controller/coreORM.create.jl @@ -149,7 +149,9 @@ function create_entity!(new_object::IEntity, # @info "dataframe is transformed to vector of named tuple" # laptimer() - result = + Serialization.serialize("/home/orfead/CODE/ORFEAD.jl/tmp/result.jls", result) + + result = util_convert_namedtuple_to_object.(result,data_type, true, # retrieve_complex_props dbconn) diff --git a/src/Controller/coreORM.utils.part1.jl b/src/Controller/coreORM.utils.part1.jl index 15e264a..bccf31e 100644 --- a/src/Controller/coreORM.utils.part1.jl +++ b/src/Controller/coreORM.utils.part1.jl @@ -3,6 +3,10 @@ function util_get_column_type end function util_is_column_numeric end +function util_get_pkcol_from_fkcol(table, schema, col, dbconn) + # TODO: Implement this function +end + # TODO: There's probably a more efficient way than this to retrieve the db name # from the LibPQ.Connection function util_getdbname(dbconn::LibPQ.Connection) @@ -627,9 +631,11 @@ function util_convert_namedtuple_to_object(props::NamedTuple, object_type::DataT # eg. {film_id, film_release_year, actor_id} becomes {film{id,release_year}, actor{id}} # @info keys(props_dict) # @info length(props_dict[:possible_values_as_str_arr]) - props_dict = - util_convert_flatdictfromdb_to_structuredrenameddict(props_dict, - object_type) + props_dict = util_convert_flatdictfromdb_to_structuredrenameddict( + props_dict, + object_type, + dbconn + ) # @info keys(props_dict) # @info length(props_dict[:possibleValuesAsStrArr]) @@ -642,79 +648,60 @@ function util_convert_namedtuple_to_object(props::NamedTuple, object_type::DataT end -function util_convert_flatdictfromdb_to_structuredrenameddict(flatdict::Dict, - object_type::DataType) +function util_convert_flatdictfromdb_to_structuredrenameddict( + flatdict::Dict{Symbol,Any}, + object_type::DataType, + dbconn::Union{LibPQ.Connection,Missing} +) + sample_object = object_type() orm_module = get_orm(sample_object) + columns_selection_and_mapping = util_get_columns_selection_and_mapping(orm_module) + columns_mapping_to_referenced_tables = util_get_columns_mapping_to_referenced_tables(orm_module) result = Dict() # Loop over the properties of the struct and try to get the corresponding # values in the flat dict for (propname,prop_colnames) in util_get_columns_selection_and_mapping(orm_module) - # Get the proptype in order to know if we are dealing with a complex # property or not proptype = util_get_property_real_type(object_type, propname) - # if the property is a complex prop we build a dict with the IDs of - # the complex object as described in the ORM of the complex property + # if the property is a complex prop we build a dict get the required value from the + # flatdict and then transform it to an entity if proptype <: IEntity - result[propname] = Dict() - - # Retrieve the type of the complex object - complexprop_instance = proptype() - complexprop_idprops = util_get_ids_props_names(complexprop_instance) - complexprop_orm = get_orm(complexprop_instance) - - # Check that the number of columns for the FK is consistent with - # the number of properties used as PK in the targeted object - if length(complexprop_idprops) != length(tovector(prop_colnames)) - error("There is an inconsistency in the ORMs definition, - type[$object_type] has property[$propname] of type[$proptype] - which is mapped with $(length(tovector(prop_colnames))) columns - but type[$proptype] has only $(length(complexprop_idprops)) IDs - properties") - end - - # If there is a composed foreign key we need to correctly map the - # column values to the column ids in the target table - if isa(prop_colnames, Array) && length(prop_colnames) > 1 - - # Loop over the FK columns and use the PKs in the same order - # TODO: Handle the case where the order of the FKs and PKs columns - # is not the same - counter = 0 - for colname in prop_colnames - - # Get the value from the flatdict (if exists) - if haskey(flatdict, Symbol(colname)) - colvalue = flatdict[Symbol(colname)] - else - break - end - - complexprop_idprop = complexprop_idprops[counter+=1] - result[propname][complexprop_idprop] = colvalue - - - end - - # If it is a non componsed foreign key then we can simply use the - # id property of the targeted object - else - complexprop_idprop = complexprop_idprops[1] - complexprop_colname = Symbol(tovector(prop_colnames)[1]) - if haskey(flatdict, complexprop_colname) - result[propname][complexprop_idprop] = flatdict[complexprop_colname] + # Get the columns that are needed for this property + propcols = tovector(columns_selection_and_mapping[propname]) + propcols_in_referenced_table = tovector(columns_mapping_to_referenced_tables[propname]) + + # Try to find these columns in the flatdict to create a sub-flatdict + sub_flatdict = Dict{Symbol, Any}() + all_cols_found = true + missing_cols = [] + for (col,col_in_referenced_table) in zip(propcols, propcols_in_referenced_table) + col_symbol = Symbol(col) + col_in_referenced_table_symbol = Symbol(col_in_referenced_table) + if haskey(flatdict, col_symbol) && !ismissing(flatdict[col_symbol]) + sub_flatdict[col_in_referenced_table_symbol] = flatdict[col_symbol] + else + all_cols_found = false + push!(missing_cols,col_symbol) + all_cols_found = false + break end + end - end # ENFOF `if isa(prop_colnames, Array) && length(prop_colnames) > 1` - - + # If all values for building the entity are found, build it and add to result list + if all_cols_found + result[propname] = util_convert_flatdictfromdb_to_structuredrenameddict( + sub_flatdict, + proptype, + dbconn + ) + end - # If the property is simple then we just look for the value in the dict else colname = Symbol(tovector(prop_colnames)[1]) if haskey(flatdict,colname) @@ -722,10 +709,10 @@ function util_convert_flatdictfromdb_to_structuredrenameddict(flatdict::Dict, end end # ENDOF `if proptype <: IEntity` - end # ENDOF `for (propname,prop_colnames) in util_get_columns_selection_and_mapping(orm_module)` - return result + end + return result end @@ -792,6 +779,7 @@ function util_replace_complex_types_by_id(props::Dict, mapping::Dict, data_type: mapping = deepcopy(mapping) orm_module = get_orm(data_type()) + cols_mapping_for_referenced_tables = util_get_columns_mapping_to_referenced_tables(orm_module) # NOTE: We loop on the result of a filter that does nothing because if not # the pairs that are added dynamically in the loop will be looped @@ -804,7 +792,16 @@ function util_replace_complex_types_by_id(props::Dict, mapping::Dict, data_type: # NOTE: We test on the fieldtype because the property value can be missing if _fieldtype <: IEntity - # @info "Replace[$prop_symbol] with ids" + # Create the mapping between the ids in the referencing table and the referenced table + # NOTE: We're counting on the columns to be in the same order + referenced_col_to_referencing_col = Dict{String, String}() + for (referenced_col, referencing_col) in + zip( + cols_mapping_for_referenced_tables[prop_symbol] |> n -> n isa Vector ? n : [n], + mapping[prop_symbol] |> n -> n isa Vector ? n : [n] + ) + referenced_col_to_referencing_col[referenced_col] = referencing_col + end dummy_propval = _fieldtype() # Used in case the prop val is missing @@ -815,8 +812,6 @@ function util_replace_complex_types_by_id(props::Dict, mapping::Dict, data_type: # Retrieve the names of the ID properties in the target struct id_props_in_target_struct = util_get_ids_props_names(_fieldtype()) - # @info "id_props_in_target_struct[$id_props_in_target_struct] ($_fieldtype)" - # Whatever we get from the mapping we make it a vector idcols = tovector(mapping[prop_symbol]) @@ -829,7 +824,8 @@ function util_replace_complex_types_by_id(props::Dict, mapping::Dict, data_type: prop_val_ids_values = filter!(x -> first(x) in id_props_in_target_struct, prop_val_as_dict) - prop_val_ids_values = util_replace_complex_types_by_id( + + prop_val_ids_values::Dict = util_replace_complex_types_by_id( prop_val_ids_values, util_get_columns_selection_and_mapping( if ismissing(prop_val) dummy_propval else prop_val end @@ -846,44 +842,26 @@ function util_replace_complex_types_by_id(props::Dict, mapping::Dict, data_type: error(error_msg) end + # Get the ids in the target table ids_props_names = collect(keys(prop_val_ids_values)) ids_cols_names = util_getcolumns(ids_props_names, prop_columns_selection_and_mapping) - ids_props_values = collect(values(prop_val_ids_values)) + ids_cols_values = collect(values(prop_val_ids_values)) - # Make sure the values are ordered in the same order as the one given - # by the mapping of the target entity's ORM - idvalues = [] + for (col_name_in_referenced_table, col_value) in zip(ids_cols_names, ids_cols_values) - prop_colnames_in_target_type = util_get_ids_cols_names(prop_orm_module) - for pcol in prop_colnames_in_target_type - for (n,c,v) in zip(ids_props_names,ids_cols_names,ids_props_values) - if (pcol == c) - push!(idvalues,v) - end - end - end + # Get the name of the column that corresponds to the column in the target table + col_name = referenced_col_to_referencing_col[col_name_in_referenced_table] + + if ismissing(col_value) && haskey(props,Symbol(col_name)) && !ismissing(props[Symbol(col_name)]) + continue + else + props[Symbol(col_name)] = col_value + end - for (k,v) in zip(idcols, idvalues) - # This prevents a property using the same primary columns to - # overwrite a non missing value - if ismissing(v) && haskey(props,Symbol(k)) && !ismissing(props[Symbol(k)]) - continue - else - props[Symbol(k)] = v - end - end - # for (n,c,v,cbis) in zip(ids_props_names,ids_cols_names,ids_props_values,idcols) - # @info "$_fieldtype -> $n, $c, $v" - # props[Symbol(cbis)] = v - # end + end - # counter = 0 - # for (k,v) in prop_val_ids_values - # id_column_name = idcols[counter+=1] # the name as used by the FK - # props[Symbol(id_column_name)] = v - # end # Remove the previous reference that has been replaced delete!(props,prop_symbol) @@ -1054,6 +1032,21 @@ function util_get_columns_selection_and_mapping(o::IEntity) return util_get_columns_selection_and_mapping(PostgresORM.get_orm(o)) end +function util_get_columns_mapping_to_referenced_tables(orm_module::Module) + if isdefined(orm_module,:get_columns_mapping_to_referenced_tables) + return orm_module.get_columns_mapping_to_referenced_tables() + # This is support for the legacy way of declaring the id properties + elseif isdefined(orm_module,:columns_mapping_to_referenced_tables) + return orm_module.columns_mapping_to_referenced_tables + else + error("orm_module[$orm_module] is missing 'get_columns_mapping_to_referenced_tables'") + end +end + +function util_get_columns_mapping_to_referenced_tables(o::IEntity) + return util_get_columns_mapping_to_referenced_tables(PostgresORM.get_orm(o)) +end + function util_get_onetomany_counterparts(orm_module::Module) if isdefined(orm_module,:get_onetomany_counterparts) return orm_module.get_onetomany_counterparts() diff --git a/src/PostgresORM.jl b/src/PostgresORM.jl index 1432452..195fe98 100644 --- a/src/PostgresORM.jl +++ b/src/PostgresORM.jl @@ -1,7 +1,7 @@ module PostgresORM # Exposed types of PostgresORM - export IEntity, IEntity, Modification + export IEntity, Modification # Exposed functions of PostgresORM export get_orm, create_entity!,create_in_bulk_using_copy,retrieve_entity, @@ -10,7 +10,7 @@ module PostgresORM execute_query_and_handle_result - using Dates, UUIDs + using Dates, UUIDs, Parameters function get_orm end @@ -21,6 +21,7 @@ module PostgresORM # by the calling libraries include("./model/abstract_types.jl") include("./model/Modification.jl") + include("./model/FKInfo.jl") module ModificationORM using ..PostgresORM @@ -75,15 +76,17 @@ module PostgresORM # implementation. end #module SchemaInfo - + module Cache + include("./Cache/_def.jl") + end module Controller using ..CRUDType, ..PostgresORM - using ..PostgresORMUtil + using ..PostgresORMUtil, ..Cache # using .ModificationORM # no need (because ModificationORM is a children module ?) using Tables, DataFrames, Query, LibPQ, Dates, UUIDs, TickTock, TimeZones, - JSON + JSON, Serialization using IterTools:imap include("./Controller/coreORM.utils.part1.jl") @@ -118,6 +121,7 @@ module PostgresORM # Implementation of the SchemaInfo module include("./SchemaInfo/_imp.jl") + include("Cache/_imp.jl") include("./exposed-functions-from-submodules.jl") diff --git a/src/PostgresORMUtil/utils.jl b/src/PostgresORMUtil/utils.jl index 0882b90..881810a 100644 --- a/src/PostgresORMUtil/utils.jl +++ b/src/PostgresORMUtil/utils.jl @@ -237,8 +237,10 @@ function tovector(x;elementstype = missing) result = collect(x) elseif isa(x,Number) || isa(x,String) || isa(x,Bool) || isa(x,Symbol) result = [x] + elseif isa(x,Dict) + result = values(x) |> collect else - throw(ArgumentError("Unsupported type[$(typeof(x))]")) + throw(ArgumentError("Unsupported type[$(typeof(x))] for $x")) end # Convert vector diff --git a/src/Tool/Tool.jl b/src/Tool/Tool.jl index 7701a91..f0f170c 100644 --- a/src/Tool/Tool.jl +++ b/src/Tool/Tool.jl @@ -257,6 +257,9 @@ function generate_object_model( struct_id_fields = [] struct_basic_fields = [] + # We want to exclude the combinations of PK columns that exactly match a FK + pk_cols_exactly_matching_a_fk = String[] + # Loop over the FKs of the table to add the complex field for (fkname,fkdef) in tabledef[:fks] manytoone_field = Dict() @@ -328,11 +331,13 @@ function generate_object_model( push!(struct_manytoone_fields, manytoone_field) - # Check whether all the referencing columns are in the PK columns, if - # yes also add the property to the id property of the struct + # Check whether all the referencing columns are in the PK columns, if yes: + # 1. add the property to the id property of the struct + # 2. add the column to the list of PK columns that we want to skip if all(map(x -> x in tabledef[:pk], manytoone_field[:cols])) - manytoone_field[:is_id] = true + manytoone_field[:is_id] = true + push!(pk_cols_exactly_matching_a_fk, manytoone_field[:cols]...) end end # for (fkname,fkdef) in tabledef[:fks] @@ -344,14 +349,19 @@ function generate_object_model( push!(referencing_cols,v...) end + # Loop over the PKs of the table, if the PK is found in a FKs, skip # because we already added it when looping over the FKs - if tabledef[:pk] |> n -> map(x -> x ∈ referencing_cols, n) |> all - @info "PK of table[$table] is contained in a FK" - else + # if tabledef[:pk] |> n -> map(x -> x ∈ referencing_cols, n) |> all + # @info "PK of table[$table] is contained in a FK" + # else for pkcol in tabledef[:pk] + if pkcol in pk_cols_exactly_matching_a_fk + continue + end + id_field = Dict() id_field[:struct] = _struct id_field[:cols] = tovector(pkcol) @@ -380,7 +390,7 @@ function generate_object_model( end # ENDOF for pk in tabledef[:pk] - end # ENDOF if tabledef[:pk] |> n -> map(x -> x ∈ referencing_cols, n) |> all + # end # ENDOF if tabledef[:pk] |> n -> map(x -> x ∈ referencing_cols, n) |> all @@ -825,7 +835,7 @@ get_table_name() = \"$table\" # write(filename_for_orm_module,orm_content) - end #ENDOF `for _struct in structs` + end # ############################# # @@ -839,13 +849,13 @@ get_table_name() = \"$table\" str *= "get_columns_selection_and_mapping() = return columns_selection_and_mapping" str *= "\nconst columns_selection_and_mapping = Dict(\n" _struct[:orm_content] *= str - end #ENDOF `for _struct in structs` + end mapping_arr = [] for f in fields - # Skip the onetomany fields because they do not have any correson column + # Skip the onetomany fields because they do not have any corresponding column if f[:is_onetomany] continue end field_name = f[:name] @@ -856,17 +866,53 @@ get_table_name() = \"$table\" else "\"$(f[:cols][1])\"" end - # colnames = "r4r4W" + str = "$(repeat(indent,1)) :$(field_name) => $colnames, \n" f[:struct][:orm_content] *= str - end # ENDOF `for id_field in object_model[:id_fields]` + end # Close the Dict for 'columns_selection_and_mapping' for _struct in object_model[:structs] _struct[:orm_content] *= ")\n\n" end + # ###################################################### # + # Columns selection and mapping for the referenced table # + # ###################################################### # + # Declare the function and open the Dict + for _struct in object_model[:structs] + str = "\n\n" + str *= "# Declare the mapping between the properties and the referenced tables columns\n" + str *= "get_columns_mapping_to_referenced_tables() = return columns_mapping_to_referenced_tables" + str *= "\nconst columns_mapping_to_referenced_tables = Dict(\n" + _struct[:orm_content] *= str + end + + + mapping_arr = [] + for f in fields + + # Skip the onetomany fields because they do not have any corresponding column + if f[:is_onetomany] || !haskey(f,:referenced_cols) continue end + + field_name = f[:name] + + colnames = if length(f[:referenced_cols]) > 1 + "[" * join( string.("\"", f[:referenced_cols], "\""), ", ") * "]" + else + "\"$(f[:referenced_cols][1])\"" + end + + str = "$(repeat(indent,1)) :$(field_name) => $colnames, \n" + f[:struct][:orm_content] *= str + + end + + # Close the Dict for 'columns_mapping_to_referenced_tables' + for _struct in object_model[:structs] + _struct[:orm_content] *= ")\n\n" + end # ############# # # ID properties # diff --git a/src/model/FKInfo.jl b/src/model/FKInfo.jl new file mode 100644 index 0000000..8c3bb10 --- /dev/null +++ b/src/model/FKInfo.jl @@ -0,0 +1,9 @@ +@kwdef mutable struct FKInfo + referencing_table::String + referencing_schema::String + referencing_col::String + referenced_table::String + referenced_schema::String + referenced_col::String + constraint_name::String +end