Compare commits

..

40 Commits

Author SHA1 Message Date
ton f88656172c object lifecycle works 2026-08-29 09:52:33 +07:00
ton 5c1b70107a slash works 2026-08-29 09:24:30 +07:00
ton 2b2b7a378e works 2026-08-29 09:00:21 +07:00
ton 3fb7457f61 1st commit 2026-08-29 08:22:46 +07:00
ton 1fc0f790d9 update 2026-08-28 19:48:29 +07:00
ton a559824faa update 2026-08-28 18:40:33 +07:00
ton d74635c47a update 2026-08-28 18:33:21 +07:00
ton 9d6a943503 update 2026-08-28 14:34:55 +07:00
ton c1c83eba77 update 2026-08-28 14:31:26 +07:00
ton dee5649254 update 2026-08-28 14:23:18 +07:00
ton fc62098071 update 2026-08-28 12:49:38 +07:00
ton 99996c1b04 update 2026-08-28 11:08:34 +07:00
ton 4466320927 update 2026-08-28 08:30:46 +07:00
ton ff757c19dd update 2026-08-28 08:29:07 +07:00
ton c4741140f5 update 2026-08-28 08:28:35 +07:00
ton 27703c3324 update docs 2026-08-28 08:25:21 +07:00
ton 86b8582584 update 2026-08-28 07:52:07 +07:00
ton 32cd21e1ee update 2026-08-28 07:47:12 +07:00
ton 517a08365d update 2026-08-27 20:47:33 +07:00
ton d032cec0b2 fix garageS3 2026-08-27 20:46:23 +07:00
ton 64575d81b5 add garageS3 feature 2026-08-27 19:40:21 +07:00
ton fb54fddf10 update 2026-08-25 16:51:04 +07:00
ton 407447831a update 2026-07-24 20:23:54 +07:00
ton c475eb169c update 2026-07-24 20:12:54 +07:00
ton d1a279cca2 update 2026-07-24 20:09:21 +07:00
ton bf3b65ee7b update 2026-07-24 17:35:31 +07:00
ton 360d64c474 update 2026-07-24 16:42:23 +07:00
ton 41a354fa73 update 2026-07-24 15:34:02 +07:00
ton 801596fa7f update 2026-07-24 14:32:44 +07:00
ton 2fbe9d6e1a update 2026-07-24 13:21:04 +07:00
ton 2c2690e5dd update 2026-07-24 13:18:35 +07:00
ton 95db5f877d up version 2026-07-24 13:04:04 +07:00
ton 7e2ddd846e update 2026-07-24 13:03:40 +07:00
ton ab113acde5 up version 2026-07-24 12:45:55 +07:00
ton 7391f0f2ce add execute_postgres_sql 2026-07-24 12:45:14 +07:00
ton 01f4e52c64 Merge pull request 'v0.5.0-add_llmutils' (#12) from v0.5.0-add_llmutils into main
Reviewed-on: #12
2026-07-15 09:21:25 +00:00
ton 35acfe5b70 update 2026-07-15 16:21:03 +07:00
ton e1ebbf370e update 2026-07-15 15:55:20 +07:00
ton 1fd3fa1bee update 2026-07-15 15:50:09 +07:00
ton 9721a393bc update 2026-07-15 15:49:34 +07:00
9 changed files with 1205 additions and 119 deletions
+151 -79
View File
@@ -1,8 +1,20 @@
# This file is machine-generated - editing it directly is not advised # This file is machine-generated - editing it directly is not advised
julia_version = "1.12.6" julia_version = "1.12.7"
manifest_format = "2.0" manifest_format = "2.0"
project_hash = "a1c572efdd97cec1f432040f02784b67635102aa" project_hash = "92e6bf163bcece135b000f14dcd39dd92d77a044"
[[deps.AWS]]
deps = ["Base64", "Compat", "Dates", "Downloads", "GitHub", "HTTP", "IniFile", "JSON", "MD5", "Mocking", "OrderedCollections", "Random", "SHA", "ScopedValues", "Sockets", "URIs", "UUIDs", "XMLDict"]
git-tree-sha1 = "842075b12a7f763c5f815a04037a99b6ac346df9"
uuid = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
version = "1.99.0"
[[deps.AWSS3]]
deps = ["AWS", "ArrowTypes", "Base64", "Compat", "Dates", "EzXML", "FilePathsBase", "HTTP", "MbedTLS", "Mocking", "OrderedCollections", "Retry", "SymDict", "URIs", "UUIDs", "XMLDict"]
git-tree-sha1 = "af99cea71364c8c4483405a6b03697d197ab4d3b"
uuid = "1c724243-ef5b-51ab-93f4-b0a88ac62a95"
version = "0.11.6"
[[deps.Accessors]] [[deps.Accessors]]
deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "MacroTools"] deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "MacroTools"]
@@ -74,9 +86,9 @@ version = "1.11.0"
[[deps.CSV]] [[deps.CSV]]
deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "PrecompileTools", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings", "WorkerUtilities"] deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "PrecompileTools", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings", "WorkerUtilities"]
git-tree-sha1 = "8d8e0b0f350b8e1c91420b5e64e5de774c2f0f4d" git-tree-sha1 = "abed1e735dd4152f48c90cf0767e1790e25f332f"
uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
version = "0.10.16" version = "0.10.17"
[[deps.CodeTracking]] [[deps.CodeTracking]]
deps = ["InteractiveUtils", "REPL", "UUIDs"] deps = ["InteractiveUtils", "REPL", "UUIDs"]
@@ -92,14 +104,15 @@ version = "0.3.4"
[[deps.CodecZlib]] [[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"] deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "962834c22b66e32aa10f7611c08c8ca4e20749a9" git-tree-sha1 = "970758a3d591a2a5c2a907c53f2e2f8c1b1d3537"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193" uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.8" version = "0.7.9"
[[deps.CommonSolve]] [[deps.CommonSolve]]
git-tree-sha1 = "eeaad7cef88554c2fa56b5a3f71cfd5cb708c662" deps = ["PrecompileTools"]
git-tree-sha1 = "6c389fa857f6ca5a95474b52a52023fd77f24cb7"
uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
version = "0.2.11" version = "0.2.14"
[[deps.Compat]] [[deps.Compat]]
deps = ["TOML", "UUIDs"] deps = ["TOML", "UUIDs"]
@@ -119,7 +132,7 @@ version = "0.1.1"
[[deps.CompilerSupportLibraries_jll]] [[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"] deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.3.0+1" version = "1.3.1+2"
[[deps.CompositionsBase]] [[deps.CompositionsBase]]
git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad" git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad"
@@ -146,14 +159,14 @@ version = "1.6.0"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
[[deps.Crayons]] [[deps.Crayons]]
git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" git-tree-sha1 = "54b76cbb40d9a0f5368c880725b2f141da77c94f"
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
version = "4.1.1" version = "4.2.0"
[[deps.DBInterface]] [[deps.DBInterface]]
git-tree-sha1 = "a444404b3f94deaa43ca2a58e18153a82695282b" git-tree-sha1 = "265d7f87f329c063cbde41920f9d00713a43cedd"
uuid = "a10d1c49-ce27-4219-8d33-6db1a4562965" uuid = "a10d1c49-ce27-4219-8d33-6db1a4562965"
version = "2.6.1" version = "2.7.0"
[[deps.DataAPI]] [[deps.DataAPI]]
git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe" git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe"
@@ -168,9 +181,9 @@ version = "1.8.2"
[[deps.DataStructures]] [[deps.DataStructures]]
deps = ["OrderedCollections"] deps = ["OrderedCollections"]
git-tree-sha1 = "6fb53a69613a0b2b68a0d12671717d307ab8b24e" git-tree-sha1 = "b0bc6d2cad1fed8b7fd59a1551a991cb3d2809e6"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.19.5" version = "0.19.6"
[[deps.DataValueInterfaces]] [[deps.DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
@@ -208,9 +221,9 @@ version = "1.11.0"
[[deps.Distributions]] [[deps.Distributions]]
deps = ["AliasTables", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "Roots", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"] deps = ["AliasTables", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "Roots", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"]
git-tree-sha1 = "cd3c5ac74cd3923c8945c6a81518c46abd0e73a3" git-tree-sha1 = "a958ab3a40c755563f5e1405c0846cb0446bf19d"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
version = "0.25.129" version = "0.25.131"
[deps.Distributions.extensions] [deps.Distributions.extensions]
DistributionsChainRulesCoreExt = "ChainRulesCore" DistributionsChainRulesCoreExt = "ChainRulesCore"
@@ -240,9 +253,15 @@ uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
version = "1.0.7" version = "1.0.7"
[[deps.ExprTools]] [[deps.ExprTools]]
git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec" git-tree-sha1 = "d2e49e7efd29719d6f28b891b0e0e159daa9d2b4"
uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
version = "0.1.10" version = "0.1.11"
[[deps.EzXML]]
deps = ["Printf", "XML2_jll"]
git-tree-sha1 = "7ea1aa5869e2626ccae84480e4f37185bc6f41d3"
uuid = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615"
version = "1.2.3"
[[deps.FilePathsBase]] [[deps.FilePathsBase]]
deps = ["Compat", "Dates"] deps = ["Compat", "Dates"]
@@ -261,9 +280,9 @@ version = "1.11.0"
[[deps.FillArrays]] [[deps.FillArrays]]
deps = ["LinearAlgebra"] deps = ["LinearAlgebra"]
git-tree-sha1 = "2f979084d1e13948a3352cf64a25df6bd3b4dca3" git-tree-sha1 = "5bad39456d9f0166184fce2248783dd9862645c1"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "1.16.0" version = "1.17.0"
weakdeps = ["PDMats", "SparseArrays", "StaticArrays", "Statistics"] weakdeps = ["PDMats", "SparseArrays", "StaticArrays", "Statistics"]
[deps.FillArrays.extensions] [deps.FillArrays.extensions]
@@ -278,15 +297,22 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"
version = "1.11.0" version = "1.11.0"
[[deps.Gamma]] [[deps.Gamma]]
git-tree-sha1 = "86f86b6168a016ed88e4ae4e64577b98c3b59e8e" deps = ["LogExpFunctions"]
git-tree-sha1 = "becc397f7cfb06e343496ae6ffb04818a851da51"
uuid = "a0844989-3bd2-4988-8bea-c9407ab0941b" uuid = "a0844989-3bd2-4988-8bea-c9407ab0941b"
version = "1.1.0" version = "1.2.0"
[[deps.GeneralUtils]] [[deps.GeneralUtils]]
deps = ["CSV", "DataFrames", "DataStructures", "Dates", "Distributions", "Graphs", "HTTP", "JSON", "LibPQ", "NATS", "PrettyPrinting", "Random", "Revise", "SHA", "StringDistances", "UUIDs"] deps = ["AWS", "AWSS3", "CSV", "DataFrames", "DataStructures", "Dates", "Distributions", "Graphs", "HTTP", "JSON", "LibPQ", "NATS", "PrettyPrinting", "Random", "Revise", "SHA", "StringDistances", "UUIDs"]
path = "." path = "."
uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe" uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe"
version = "0.4.10" version = "0.6.1"
[[deps.GitHub]]
deps = ["Base64", "Dates", "HTTP", "JSON", "MbedTLS", "Sockets", "SodiumSeal", "URIs"]
git-tree-sha1 = "33de1bc5665494f0a9669fd6027e28180709d874"
uuid = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
version = "5.13.0"
[[deps.Graphs]] [[deps.Graphs]]
deps = ["ArnoldiMethod", "DataStructures", "Inflate", "LinearAlgebra", "Random", "SimpleTraits", "SparseArrays", "Statistics"] deps = ["ArnoldiMethod", "DataStructures", "Inflate", "LinearAlgebra", "Random", "SimpleTraits", "SparseArrays", "Statistics"]
@@ -303,9 +329,9 @@ version = "1.14.0"
[[deps.HTTP]] [[deps.HTTP]]
deps = ["Base64", "CodecZlib", "Dates", "EnumX", "PrecompileTools", "Random", "Reseau", "SHA", "URIs", "UUIDs", "Zlib_jll"] deps = ["Base64", "CodecZlib", "Dates", "EnumX", "PrecompileTools", "Random", "Reseau", "SHA", "URIs", "UUIDs", "Zlib_jll"]
git-tree-sha1 = "c2c808326222b6dc4bec295a83b55f79aeec98e0" git-tree-sha1 = "d6e390d1515836237b837fb7b6fca7ba1d752db6"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "2.5.5" version = "2.6.5"
[[deps.HashArrayMappedTries]] [[deps.HashArrayMappedTries]]
git-tree-sha1 = "2eaa69a7cab70a52b9687c8bf950a5a93ec895ae" git-tree-sha1 = "2eaa69a7cab70a52b9687c8bf950a5a93ec895ae"
@@ -314,9 +340,9 @@ version = "0.2.0"
[[deps.HypergeometricFunctions]] [[deps.HypergeometricFunctions]]
deps = ["Gamma", "LinearAlgebra"] deps = ["Gamma", "LinearAlgebra"]
git-tree-sha1 = "18d7deab5fb0440dc6a7b6993c5c27b25420de10" git-tree-sha1 = "31bb6c92405c084617facc1d7ed9eb6c402d061e"
uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a" uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a"
version = "0.3.29" version = "0.3.30"
[[deps.ICU_jll]] [[deps.ICU_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"] deps = ["Artifacts", "JLLWrappers", "Libdl"]
@@ -335,6 +361,11 @@ git-tree-sha1 = "d1b1b796e47d94588b3757fe84fbf65a5ec4a80d"
uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9"
version = "0.1.5" version = "0.1.5"
[[deps.IniFile]]
git-tree-sha1 = "f550e6e32074c939295eb5ea6de31849ac2c9625"
uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f"
version = "0.5.1"
[[deps.InlineStrings]] [[deps.InlineStrings]]
git-tree-sha1 = "8f3d257792a522b4601c24a577954b0a8cd7334d" git-tree-sha1 = "8f3d257792a522b4601c24a577954b0a8cd7334d"
uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48"
@@ -394,9 +425,9 @@ version = "1.8.0"
[[deps.JSON]] [[deps.JSON]]
deps = ["Dates", "Logging", "Parsers", "PrecompileTools", "StructUtils", "UUIDs", "Unicode"] deps = ["Dates", "Logging", "Parsers", "PrecompileTools", "StructUtils", "UUIDs", "Unicode"]
git-tree-sha1 = "c89d196f5ffb64bfbf80985b699ea913b0d2c211" git-tree-sha1 = "c7345ab1a7ca4dc8a02c9f6510da0d9857bbe513"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "1.6.1" version = "1.7.1"
weakdeps = ["ArrowTypes"] weakdeps = ["ArrowTypes"]
[deps.JSON.extensions] [deps.JSON.extensions]
@@ -414,9 +445,9 @@ weakdeps = ["ArrowTypes"]
[[deps.JuliaInterpreter]] [[deps.JuliaInterpreter]]
deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"] deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"]
git-tree-sha1 = "58927c485919bf17ea308d9d82156de1adf4b006" git-tree-sha1 = "c3d401f110454b4ea24a76be33f6ee0d7d385103"
uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a" uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
version = "0.10.12" version = "0.11.4"
[[deps.JuliaSyntaxHighlighting]] [[deps.JuliaSyntaxHighlighting]]
deps = ["StyledStrings"] deps = ["StyledStrings"]
@@ -430,9 +461,9 @@ uuid = "b39eb1a6-c29a-53d7-8c32-632cd16f18da"
version = "1.21.3+0" version = "1.21.3+0"
[[deps.LaTeXStrings]] [[deps.LaTeXStrings]]
git-tree-sha1 = "dda21b8cbd6a6c40d9d02a73230f9d70fed6918c" git-tree-sha1 = "f88f3ccef05a6a72a0cf0ed417c8fd68530f4ab2"
uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version = "1.4.0" version = "1.4.1"
[[deps.LayerDicts]] [[deps.LayerDicts]]
git-tree-sha1 = "6087ad3521d6278ebe5c27ae55e7bbb15ca312cb" git-tree-sha1 = "6087ad3521d6278ebe5c27ae55e7bbb15ca312cb"
@@ -480,6 +511,12 @@ version = "1.11.3+1"
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
version = "1.11.0" version = "1.11.0"
[[deps.Libiconv_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "be484f5c92fad0bd8acfef35fe017900b0b73809"
uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
version = "1.18.0+0"
[[deps.LinearAlgebra]] [[deps.LinearAlgebra]]
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -507,9 +544,15 @@ version = "1.11.0"
[[deps.LoweredCodeUtils]] [[deps.LoweredCodeUtils]]
deps = ["CodeTracking", "Compiler", "JuliaInterpreter"] deps = ["CodeTracking", "Compiler", "JuliaInterpreter"]
git-tree-sha1 = "3733419e9a71156b389f3e331672d2e95436783f" git-tree-sha1 = "1d4c737ab26f51ceed52ab2019c09b7660eb7440"
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b" uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
version = "3.6.2" version = "3.8.0"
[[deps.MD5]]
deps = ["Random", "SHA"]
git-tree-sha1 = "1576f756617d31eb397a4a517b68562fd28dc2b4"
uuid = "6ac74813-4b46-53a4-afec-0b5dc9d7885c"
version = "0.2.3"
[[deps.MacroTools]] [[deps.MacroTools]]
git-tree-sha1 = "1e0228a030642014fe5cfe68c2c0a818f9e3f522" git-tree-sha1 = "1e0228a030642014fe5cfe68c2c0a818f9e3f522"
@@ -567,9 +610,9 @@ version = "0.1.1"
[[deps.NanoDates]] [[deps.NanoDates]]
deps = ["Dates", "Parsers"] deps = ["Dates", "Parsers"]
git-tree-sha1 = "850a0557ae5934f6e67ac0dc5ca13d0328422d1f" git-tree-sha1 = "77c7e98ca39aefb481f9b97a2f4f5c5471c08a1d"
uuid = "46f1a544-deae-4307-8689-c12aa3c955c6" uuid = "46f1a544-deae-4307-8689-c12aa3c955c6"
version = "1.0.3" version = "1.1.0"
[[deps.NetworkOptions]] [[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
@@ -599,7 +642,7 @@ version = "0.8.7+0"
[[deps.OpenSSL_jll]] [[deps.OpenSSL_jll]]
deps = ["Artifacts", "Libdl"] deps = ["Artifacts", "Libdl"]
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "3.5.4+0" version = "3.5.6+0"
[[deps.OpenSpecFun_jll]] [[deps.OpenSpecFun_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl"] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl"]
@@ -608,15 +651,15 @@ uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e"
version = "0.5.6+0" version = "0.5.6+0"
[[deps.OrderedCollections]] [[deps.OrderedCollections]]
git-tree-sha1 = "94ba93778373a53bfd5a0caaf7d809c445292ff4" git-tree-sha1 = "05f45c2e0de6259db764adbfd2f1dc6d3f8de13c"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.8.2" version = "2.0.1"
[[deps.PDMats]] [[deps.PDMats]]
deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"]
git-tree-sha1 = "26766d4b5f1a410c218a19b85a672c6edb693c65" git-tree-sha1 = "123266c25174ef6c8d4718920abc206452cf8de6"
uuid = "90014a1f-27ba-587c-ab20-58faa44d9150" uuid = "90014a1f-27ba-587c-ab20-58faa44d9150"
version = "0.11.40" version = "0.11.41"
weakdeps = ["StatsBase"] weakdeps = ["StatsBase"]
[deps.PDMats.extensions] [deps.PDMats.extensions]
@@ -624,9 +667,9 @@ weakdeps = ["StatsBase"]
[[deps.Parsers]] [[deps.Parsers]]
deps = ["Dates", "PrecompileTools", "UUIDs"] deps = ["Dates", "PrecompileTools", "UUIDs"]
git-tree-sha1 = "32a4e09c5f29402573d673901778a0e03b0807b9" git-tree-sha1 = "3de8f5e6e90ebfa8d6d1f86997d6cdcd6a912ff3"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.8.6" version = "2.8.7"
[[deps.PooledArrays]] [[deps.PooledArrays]]
deps = ["DataAPI", "Future"] deps = ["DataAPI", "Future"]
@@ -647,15 +690,15 @@ uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.5.2" version = "1.5.2"
[[deps.PrettyPrinting]] [[deps.PrettyPrinting]]
git-tree-sha1 = "142ee93724a9c5d04d78df7006670a93ed1b244e" git-tree-sha1 = "0b7f4ad437e31c51cf5b91fb103579b04025170a"
uuid = "54e16d92-306c-5ea0-a30b-337be88ac337" uuid = "54e16d92-306c-5ea0-a30b-337be88ac337"
version = "0.4.2" version = "0.4.3"
[[deps.PrettyTables]] [[deps.PrettyTables]]
deps = ["Crayons", "LaTeXStrings", "Markdown", "PrecompileTools", "Printf", "REPL", "Reexport", "StringManipulation", "Tables"] deps = ["Crayons", "LaTeXStrings", "Markdown", "PrecompileTools", "Printf", "REPL", "Reexport", "StringManipulation", "Tables"]
git-tree-sha1 = "ebf455bb866ee6737030e3d3816bb6a0683c4325" git-tree-sha1 = "1b8aa19f229b1cea7fc93874a52e49db6a854450"
uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
version = "3.4.0" version = "3.4.8"
[deps.PrettyTables.extensions] [deps.PrettyTables.extensions]
PrettyTablesExcelExt = "XLSX" PrettyTablesExcelExt = "XLSX"
@@ -716,15 +759,20 @@ version = "1.3.1"
[[deps.Reseau]] [[deps.Reseau]]
deps = ["NetworkOptions", "OpenSSL_jll", "PrecompileTools", "Random", "SHA"] deps = ["NetworkOptions", "OpenSSL_jll", "PrecompileTools", "Random", "SHA"]
git-tree-sha1 = "0eab6d95ed40c2ef3992255c1c71e4f9748932b5" git-tree-sha1 = "aaee74fab545e9af4b21d10c2203c93c636c4ae0"
uuid = "802f3686-a58f-41ce-bb0c-3c43c75bba36" uuid = "802f3686-a58f-41ce-bb0c-3c43c75bba36"
version = "1.3.1" version = "1.4.1"
[[deps.Retry]]
git-tree-sha1 = "41ac127cd281bb33e42aba46a9d3b25cd35fc6d5"
uuid = "20febd7b-183b-5ae2-ac4a-720e7ce64774"
version = "0.4.1"
[[deps.Revise]] [[deps.Revise]]
deps = ["CRC32c", "CodeTracking", "FileWatching", "InteractiveUtils", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Preferences", "REPL", "UUIDs"] deps = ["CRC32c", "CodeTracking", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Preferences", "REPL", "UUIDs"]
git-tree-sha1 = "27e3ee13fc8739a59b380d6163d6a82f52c03bd7" git-tree-sha1 = "f6ad10ad2fa1063c2ae0f75d17d92d1d0cae4c77"
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe" uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
version = "3.15.1" version = "3.16.5"
weakdeps = ["Distributed"] weakdeps = ["Distributed"]
[deps.Revise.extensions] [deps.Revise.extensions]
@@ -738,15 +786,15 @@ version = "0.9.0"
[[deps.Rmath_jll]] [[deps.Rmath_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"] deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "58cdd8fb2201a6267e1db87ff148dd6c1dbd8ad8" git-tree-sha1 = "6d40b2fe70437b01397d2a4d5b020008da4e7019"
uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f" uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f"
version = "0.5.1+0" version = "0.5.2+0"
[[deps.Roots]] [[deps.Roots]]
deps = ["Accessors", "CommonSolve", "Printf"] deps = ["Accessors", "CommonSolve", "Printf"]
git-tree-sha1 = "125cbd31a56de53169c3eed9c17180bc6c245f83" git-tree-sha1 = "13a9e0164267bb9ebc55c1c5d72fceea8f09555b"
uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
version = "3.0.4" version = "3.0.7"
[deps.Roots.extensions] [deps.Roots.extensions]
RootsChainRulesCoreExt = "ChainRulesCore" RootsChainRulesCoreExt = "ChainRulesCore"
@@ -811,6 +859,12 @@ git-tree-sha1 = "907703e0d50846f300650d7225bdcab145b7bca9"
uuid = "4f5b5e99-b0ad-42cd-b47a-334e172ec8bd" uuid = "4f5b5e99-b0ad-42cd-b47a-334e172ec8bd"
version = "1.1.2" version = "1.1.2"
[[deps.SodiumSeal]]
deps = ["Base64", "Libdl", "libsodium_jll"]
git-tree-sha1 = "80cef67d2953e33935b41c6ab0a178b9987b1c99"
uuid = "2133526b-2bfb-4018-ac12-889fb3908a75"
version = "0.1.1"
[[deps.SortingAlgorithms]] [[deps.SortingAlgorithms]]
deps = ["DataStructures"] deps = ["DataStructures"]
git-tree-sha1 = "13cd91cc9be159e3f4d95b857fa2aa383b53772a" git-tree-sha1 = "13cd91cc9be159e3f4d95b857fa2aa383b53772a"
@@ -824,9 +878,9 @@ version = "1.12.0"
[[deps.SpecialFunctions]] [[deps.SpecialFunctions]]
deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"]
git-tree-sha1 = "6547cbdd8ce32efba0d21c5a40fa96d1a3548f9f" git-tree-sha1 = "429071b23f4c9a13fb6582f807cc2ef454082408"
uuid = "276daf66-3868-5448-9aa4-cd146d93841b" uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
version = "2.8.0" version = "2.9.0"
[deps.SpecialFunctions.extensions] [deps.SpecialFunctions.extensions]
SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" SpecialFunctionsChainRulesCoreExt = "ChainRulesCore"
@@ -836,9 +890,9 @@ version = "2.8.0"
[[deps.StaticArrays]] [[deps.StaticArrays]]
deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
git-tree-sha1 = "246a8bb2e6667f832eea063c3a56aef96429a3db" git-tree-sha1 = "fac51faf3bb96e8bc0bf6f9f39ca4955652776bb"
uuid = "90137ffa-7385-5640-81b9-e52037218182" uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.9.18" version = "1.9.19"
[deps.StaticArrays.extensions] [deps.StaticArrays.extensions]
StaticArraysChainRulesCoreExt = "ChainRulesCore" StaticArraysChainRulesCoreExt = "ChainRulesCore"
@@ -871,15 +925,15 @@ version = "1.8.0"
[[deps.StatsBase]] [[deps.StatsBase]]
deps = ["AliasTables", "DataAPI", "DataStructures", "IrrationalConstants", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] deps = ["AliasTables", "DataAPI", "DataStructures", "IrrationalConstants", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"]
git-tree-sha1 = "e4d7a1a0edc20af42689ea6f4f3587a2175d50ee" git-tree-sha1 = "adb9da019510162e67a4493fc235c23203d8b09e"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
version = "0.34.12" version = "0.34.13"
[[deps.StatsFuns]] [[deps.StatsFuns]]
deps = ["HypergeometricFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"] deps = ["HypergeometricFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"]
git-tree-sha1 = "770240df9a3b8888065046948f7a09b4e0f997d5" git-tree-sha1 = "91a5737baed20ee31f3faea0e51f57461f6a689e"
uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
version = "2.2.0" version = "2.2.1"
[deps.StatsFuns.extensions] [deps.StatsFuns.extensions]
StatsFunsChainRulesCoreExt = "ChainRulesCore" StatsFunsChainRulesCoreExt = "ChainRulesCore"
@@ -891,15 +945,15 @@ version = "2.2.0"
[[deps.StringDistances]] [[deps.StringDistances]]
deps = ["Distances", "StatsAPI"] deps = ["Distances", "StatsAPI"]
git-tree-sha1 = "cd83a04baf746e3b43b83c61b7de77ab0409b80a" git-tree-sha1 = "456f343c7a6c8f52d8b501c0da2a05538ab1b907"
uuid = "88034a9c-02f8-509d-84a9-84ec65e18404" uuid = "88034a9c-02f8-509d-84a9-84ec65e18404"
version = "1.0.0" version = "1.0.1"
[[deps.StringManipulation]] [[deps.StringManipulation]]
deps = ["PrecompileTools"] deps = ["PrecompileTools"]
git-tree-sha1 = "d05693d339e37d6ab134c5ab53c29fce5ee5d7d5" git-tree-sha1 = "773065c6e0e903924a9d838259be74338422aef2"
uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e" uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e"
version = "0.4.4" version = "0.5.0"
[[deps.StructTypes]] [[deps.StructTypes]]
deps = ["Dates", "UUIDs"] deps = ["Dates", "UUIDs"]
@@ -909,9 +963,9 @@ version = "1.11.0"
[[deps.StructUtils]] [[deps.StructUtils]]
deps = ["Dates", "UUIDs"] deps = ["Dates", "UUIDs"]
git-tree-sha1 = "82bee338d650aa515f31866c460cb7e3bcef90b8" git-tree-sha1 = "2d0fc55c61321ba245c47be599570d11bac50303"
uuid = "ec057cc2-7a8d-4b58-b3b3-92acb9f63b42" uuid = "ec057cc2-7a8d-4b58-b3b3-92acb9f63b42"
version = "2.8.2" version = "2.8.5"
[deps.StructUtils.extensions] [deps.StructUtils.extensions]
StructUtilsMeasurementsExt = ["Measurements"] StructUtilsMeasurementsExt = ["Measurements"]
@@ -936,6 +990,12 @@ deps = ["Artifacts", "Libdl", "libblastrampoline_jll"]
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
version = "7.8.3+2" version = "7.8.3+2"
[[deps.SymDict]]
deps = ["Test"]
git-tree-sha1 = "0108ccdaea3ef69d9680eeafc8d5ad198b896ec8"
uuid = "2da68c74-98d7-5633-99d6-8493888d7b1e"
version = "0.3.0"
[[deps.TOML]] [[deps.TOML]]
deps = ["Dates"] deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
@@ -943,9 +1003,9 @@ version = "1.0.3"
[[deps.TZJData]] [[deps.TZJData]]
deps = ["Artifacts"] deps = ["Artifacts"]
git-tree-sha1 = "72df96b3a595b7aab1e101eb07d2a435963a97e2" git-tree-sha1 = "d3b30a9f29a898e21fb4bdf280101b7a12e1f39c"
uuid = "dc5dba14-91b3-4cab-a142-028a31da12f7" uuid = "dc5dba14-91b3-4cab-a142-028a31da12f7"
version = "1.5.0+2025b" version = "1.5.1+2025b"
[[deps.TableTraits]] [[deps.TableTraits]]
deps = ["IteratorInterfaceExtensions"] deps = ["IteratorInterfaceExtensions"]
@@ -955,9 +1015,9 @@ version = "1.0.1"
[[deps.Tables]] [[deps.Tables]]
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "OrderedCollections", "TableTraits"] deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "OrderedCollections", "TableTraits"]
git-tree-sha1 = "0f38a06c83f0007bbab3cf911262841c9a0f07e0" git-tree-sha1 = "a94d9bdda1b7bed0046cea645639ab3f62196fac"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "1.13.0" version = "1.14.0"
[[deps.Test]] [[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
@@ -980,9 +1040,9 @@ uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.11.3" version = "0.11.3"
[[deps.URIs]] [[deps.URIs]]
git-tree-sha1 = "bef26fb046d031353ef97a82e3fdb6afe7f21b1a" git-tree-sha1 = "908fec9df6c5de98548ead82a468c95ccf6cd263"
uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
version = "1.6.1" version = "1.7.0"
[[deps.UTCDateTimes]] [[deps.UTCDateTimes]]
deps = ["Dates", "TimeZones"] deps = ["Dates", "TimeZones"]
@@ -1010,6 +1070,18 @@ git-tree-sha1 = "cd1659ba0d57b71a464a29e64dbc67cfe83d54e7"
uuid = "76eceee3-57b5-4d4a-8e66-0e911cebbf60" uuid = "76eceee3-57b5-4d4a-8e66-0e911cebbf60"
version = "1.6.1" version = "1.6.1"
[[deps.XML2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"]
git-tree-sha1 = "3f3315d89fc954a28f5b471bce698ed6e27481be"
uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a"
version = "2.15.3+0"
[[deps.XMLDict]]
deps = ["EzXML", "IterTools", "OrderedCollections"]
git-tree-sha1 = "8e8cdc9c93e1f442eba471b56db6f86ffeb1a33a"
uuid = "228000da-037f-5747-90a9-8195ccbf91a5"
version = "0.4.2"
[[deps.Zlib_jll]] [[deps.Zlib_jll]]
deps = ["Libdl"] deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a" uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
+9 -1
View File
@@ -1,9 +1,11 @@
name = "GeneralUtils" name = "GeneralUtils"
uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe" uuid = "c6c72f09-b708-4ac8-ac7c-2084d70108fe"
version = "0.5.0" version = "0.6.2"
authors = ["tonaerospace <tonaerospace.etc@gmail.com>"] authors = ["tonaerospace <tonaerospace.etc@gmail.com>"]
[deps] [deps]
AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
AWSS3 = "1c724243-ef5b-51ab-93f4-b0a88ac62a95"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
@@ -14,18 +16,24 @@ HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LibPQ = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1" LibPQ = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1"
NATS = "55e73f9c-eeeb-467f-b4cc-a633fde63d2a" NATS = "55e73f9c-eeeb-467f-b4cc-a633fde63d2a"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
PrettyPrinting = "54e16d92-306c-5ea0-a30b-337be88ac337" PrettyPrinting = "54e16d92-306c-5ea0-a30b-337be88ac337"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
StringDistances = "88034a9c-02f8-509d-84a9-84ec65e18404" StringDistances = "88034a9c-02f8-509d-84a9-84ec65e18404"
URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[compat] [compat]
AWS = "1.99.0"
AWSS3 = "0.11.6"
Graphs = "1.14.0" Graphs = "1.14.0"
HTTP = "2.5.0 - 2.9.9" HTTP = "2.5.0 - 2.9.9"
JSON = "1.3.0 - 1.9.9" JSON = "1.3.0 - 1.9.9"
LibPQ = "1.18.0" LibPQ = "1.18.0"
NATS = "0.1.0" NATS = "0.1.0"
OrderedCollections = "2.0.1"
Revise = "3.13.2" Revise = "3.13.2"
StringDistances = "1.0.0" StringDistances = "1.0.0"
URIs = "1.7.0"
View File
+2
View File
@@ -0,0 +1,2 @@
# dummy main.jl so i can do GeneralUtils precompile
using GeneralUtils
+2
View File
@@ -21,6 +21,8 @@ using .llmUtil
include("interface.jl") include("interface.jl")
using .interface using .interface
include("garageS3.jl")
using .garageS3
#------------------------------------------------------------------------------------------------100 #------------------------------------------------------------------------------------------------100
+96 -2
View File
@@ -1,13 +1,107 @@
module dbUtil module dbUtil
export dictToPostgresKeyValueString, generateInsertSQL, generateUpdateSQL export dictToPostgresKeyValueString, generateInsertSQL, generateUpdateSQL, find_text_vector_similarity,
execute_postgres_sql
using JSON, DataStructures, Distributions, Random, Dates, UUIDs, DataFrames, using JSON, DataStructures, Distributions, Random, Dates, UUIDs, DataFrames,
SHA SHA, NATS, LibPQ
using ..util using ..util
#[PENDING] update code to use JSON #[PENDING] update code to use JSON
# ---------------------------------------------- 100 --------------------------------------------- # # ---------------------------------------------- 100 --------------------------------------------- #
""" Execute SQL against a PostgreSQL database using LibPQ connection string.
# Arguments
- `pg_conn_str::AbstractString`: PostgreSQL connection string in format "host=... port=... dbname=... user=... password=..."
- `sql::AbstractString`: SQL query to execute
# Returns
- `LibPQ.Result` on success, `nothing` on failure
# Example
```julia
pg_conn_str = "host=localhost port=5432 dbname=mydb user=myuser password=mypass"
sql = "SELECT * FROM wine;"
result = execute_postgres_sql(pg_conn_str, sql)
```
"""
function execute_postgres_sql(pg_conn_str::T, sql::T) where {T<:AbstractString}
db_connection = LibPQ.Connection(pg_conn_str)
result = nothing
try
result = LibPQ.execute(db_connection, sql)
catch e
@error e
LibPQ.close(db_connection)
end
LibPQ.close(db_connection)
return result
end
""" find_text_vector_similarity
Find the most similar text records in a PostgreSQL database using vector embeddings and cosine similarity.
This function computes an embedding for the input text using the provided embedding function,
then queries the database to find records with the most similar vector representations using
PostgreSQL's cosine similarity operator (`<->`).
# Arguments
- `text::AbstractString`: The input text to find similar records for
- `tablename::AbstractString`: Name of the database table containing the embedding column
- `embeddingColumnName::AbstractString`: Name of the column storing vector embeddings
- `executesql::Function`: Function that executes SQL queries and returns results
- `get_embedding::Function`: Function that generates embeddings for text inputs
# Keyword Arguments
- `limit::Integer=1`: Maximum number of similar records to return
# Returns
- `DataFrame`: Database records ordered by similarity (most similar first), including a `distance` column
where smaller values indicate higher similarity
# Example
```julia
# Assume you have embedding and SQL execution functions
text = "a rich structured red wine"
tablename = "wine"
embeddingColumnName = "description_embedding"
df = find_text_vector_similarity(
text, tablename, embeddingColumnName,
executesql, get_embedding;
limit = 5
)
# Result contains columns from the table plus a 'distance' column
# where distance = 1 - cosine_similarity (smaller = more similar)
```
"""
function find_text_vector_similarity(text::T1, tablename::T2, embeddingColumnName::T3,
executesql::Function, get_embedding;
limit::Integer=1
)::DataFrame where {T1<:AbstractString, T2<:AbstractString, T3<:AbstractString}
# get embedding from LLM service
_embedding = get_embedding([text])
_embedding = _embedding["data"][1]["embedding"]
_embedding = "$_embedding"
embedding = _embedding[4:end] # remove 'Any' from Any[...]
# check whether there is close enough vector already store in executesql. if no, add, else skip
sql = """
SELECT *, $embeddingColumnName <-> '$embedding' as distance
FROM $tablename
ORDER BY distance LIMIT $limit;
"""
response = executesql(sql)
df = DataFrame(response)
return df
end
""" """
dictToPostgresKeyValueString - Convert dictionary to PostgreSQL key-value string format dictToPostgresKeyValueString - Convert dictionary to PostgreSQL key-value string format
+376
View File
@@ -0,0 +1,376 @@
module garageS3
export
LifecycleExpiration, build_lifecycle_xml,
GarageStorage, put_file, get_file, list_files, delete_file,
set_lifecycle_expiration, get_lifecycle, delete_lifecycle
using AWS
@service S3
using AWSS3
# ---------------------------------------------- 100 --------------------------------------------- #
# Garage uses Path-Style routing (https://s3-api.my-domain.com/bucket/key).
# this file use local AWS config
""" Example
storage1 = GeneralUtils.GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e", # key ID (create at garage-ui.yiem.cc)
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1", # key ID's secret key
"testbucket"
)
# Safe to run inside concurrent HTTP handlers (e.g., Oxygen.jl, HTTP.jl)
# use UUID as filename because GarageS3 requires unique filename for each uploaded object
urls = GeneralUtils.put_file(storage1, "transferjob-(GeneralUtils.uuid4snakecase())", "{\"status\": \"inactive\"}")
key = GeneralUtils.list_files(storage)
println("Read back: ", data)
println("Bucket keys: ", key)
# test with curl
curl -v \
-H 'Host: testbucket.s3-web.yiem.cc' \
http://192.168.88.106:3902/users-1002.json
# test with API
data = String(GeneralUtils.get_file(storage, key[1]))
# test with a browser (urls.web)
https://s3-web.mydomain.com/my_bucket_name/users-1005.json
"""
# ===================================================================
# 1. Custom GarageConfig Definition (Thread-Safe, No Global State)
# ===================================================================
struct SimpleCredentials
access_key_id::String
secret_key::String
token::String
end
struct GarageConfig <: AWS.AbstractAWSConfig
endpoint::String
region::String
credentials::SimpleCredentials
end
# Required extensions for AWS.jl pipeline
AWS.refresh!(c::SimpleCredentials; force::Bool=false) = c
AWS.credentials(c::SimpleCredentials) = c
AWS.check_credentials(c::SimpleCredentials) = c
AWS.region(aws::GarageConfig) = aws.region
AWS.credentials(aws::GarageConfig) = aws.credentials
""" Generate the full service URL including the resource path for a Garage S3 request.
# Arguments
- `aws::GarageConfig`
The Garage configuration containing the endpoint.
- `service::String`
The AWS service name (e.g., `"s3"`).
- `resource::String`
The S3 resource path (e.g., `"/bucket/key"`).
# Return
- `String`: The full URL combining the endpoint and resource path.
"""
function AWS.generate_service_url(aws::GarageConfig, service::String, resource::String)
endpoint = strip(aws.endpoint, '/')
resource_path = startswith(resource, '/') ? resource : "/" * resource
return string(endpoint, resource_path)
end
# ===================================================================
# 2. Thread-Safe Storage Client Wrapper
# ===================================================================
""" Create a thread-safe Garage S3 storage client.
# Arguments
- `endpoint::String`
The Garage S3 API endpoint URL (e.g., `"https://s3-api.yiem.cc"`).
- `key::String`
The Garage access key ID (created via garage-ui).
- `secret::String`
The secret key corresponding to the access key.
- `bucket::String`
The name of the S3 bucket to use.
# Keyword Arguments
- `region::String = "garage"`
The region identifier for the Garage instance.
# Return
- `GarageStorage`: A thread-safe storage client instance.
# Examples
```jldoctest
julia> storage = GarageStorage("https://s3-api.yiem.cc", "GKb08015", "55114ff94828febca1", "sommpanion-s3")
GarageStorage(GarageConfig(...), "sommpanion-s3")
```
"""
struct GarageStorage
config::GarageConfig
bucket::String
end
function GarageStorage(endpoint::String, key::String, secret::String, bucket::String; region::String="garage")
creds = SimpleCredentials(key, secret, "")
config = GarageConfig(endpoint, region, creds)
return GarageStorage(config, bucket)
end
""" Upload an object to the Garage S3 bucket (callable struct).
# Arguments
- `key::String`
The object key (name) in the bucket.
- `data::Union{String, Vector{UInt8}}`
The data to upload.
# Return
- `NamedTuple{(:api, :web)}`: A tuple with `api` and `web` URLs.
# Examples
```jldoctest
julia> storage1 = GarageStorage("https://s3-api.yiem.cc", "GKb08015", "55114ff94828febca1", "sommpanion-s3")
julia> put_file1 = put_file(storage1)
julia> downloadUrl = put_file1("test.json", "{\"status\": \"active\"}")
Successfully uploaded: test.json
julia> downloadUrl.api
"https://s3-api.yiem.cc/sommpanion-s3/test.json"
julia> downloadUrl.web
"https://s3-web.yiem.cc/sommpanion-s3/test.json"
```
"""
struct put_file
storage::GarageStorage
end
function (pf::put_file)(key::String, data::Union{String, Vector{UInt8}}
)::NamedTuple{(:api, :web), Tuple{String, String}}
AWSS3.s3_put(pf.storage.config, pf.storage.bucket, key, data)
println("Successfully uploaded: ", key)
# object url
api = "$(pf.storage.config.endpoint)/$(pf.storage.bucket)/$key"
# file download URL using browser
web = replace(api, "s3-api" => "s3-web")
return (api=api, web=web)
end
""" Upload an object to the Garage S3 bucket.
# Arguments
- `storage::GarageStorage`
The storage client instance.
- `key::String`
The object key (name) in the bucket.
- `data::Union{String, Vector{UInt8}}`
The data to upload.
# Return
- `NamedTuple{(:api, :web)}`: A tuple with `api` and `web` URLs.
# Examples
```julia
julia> result = put_file(storage, "test.json", "{\"status\": \"active\"}")
Successfully uploaded: test.json
julia> result.api
"https://s3-api.yiem.cc/sommpanion-s3/test.json"
julia> result.web
"https://s3-web.yiem.cc/sommpanion-s3/test.json"
```
"""
function put_file(storage::GarageStorage, key::String, data::Union{String, Vector{UInt8}}
)::NamedTuple{(:api, :web), Tuple{String, String}}
AWSS3.s3_put(storage.config, storage.bucket, key, data)
println("Successfully uploaded: ", key)
# object url
api = "$(storage.config.endpoint)/$(storage.bucket)/$key"
# file download URL using browser
web = replace(api, "s3-api" => "s3-web")
return (api=api, web=web)
end
""" Download an object from the Garage S3 bucket.
# Arguments
- `storage::GarageStorage`
The storage client instance.
- `key::String`
The object key (name) in the bucket.
# Return
- `Vector{UInt8}`: The raw bytes of the downloaded object.
# Examples
```julia
julia> data = String(get_file(storage, "test.json"))
"\"{\\\"status\\\": \\\"active\\\"}\""
```
"""
function get_file(storage::GarageStorage, key::String)::Union{Vector{UInt8}, Nothing}
try
return AWSS3.s3_get(storage.config, storage.bucket, key)
catch
return nothing
end
end
""" List all object keys in the Garage S3 bucket.
# Arguments
- `storage::GarageStorage`
The storage client instance.
# Return
- `Vector{String}`: A list of object keys (file names) in the bucket.
# Examples
```julia
julia> keys = list_files(storage)
3-element Vector{String}:
"test1.json"
"test2.json"
"users-1002.json"
```
"""
function list_files(storage::GarageStorage)
# Use delimiter="" to get all individual keys (no grouping by "directory")
objects = AWSS3.s3_list_objects(storage.config, storage.bucket; delimiter="")
return [obj["Key"] for obj in objects]
end
""" Delete an object from the Garage S3 bucket.
# Arguments
- `storage::GarageStorage`
The storage client instance.
- `key::String`
The object key (name) to delete.
# Examples
```julia
julia> delete_file(storage, "test.json")
```
"""
function delete_file(storage::GarageStorage, key::String)
AWSS3.s3_delete(storage.config, storage.bucket, key)
end
# ===================================================================
# 3. Bucket Lifecycle Configuration
# ===================================================================
""" Lifecycle expiration configuration for a bucket.
# Fields
- `prefix::String`: Object key prefix this rule applies to.
- `days::Int`: Number of days after object creation to expire/delete.
- `enabled::Bool`: Whether the rule is active (default: `true`).
- `id::String`: Unique identifier for the rule (default: auto-generated).
"""
struct LifecycleExpiration
prefix::String
days::Int
enabled::Bool
id::String
end
function LifecycleExpiration(prefix::String, days::Int; enabled::Bool=true, id::String="")
rule_id = isempty(id) ? "expire-" * replace(prefix, "/" => "_") * "-" * string(days) * "d" : id
return LifecycleExpiration(prefix, days, enabled, rule_id)
end
""" Build the XML body for a PutBucketLifecycleConfiguration request.
Supports a single rule with expiration by prefix.
"""
function build_lifecycle_xml(rule::LifecycleExpiration)::String
status = rule.enabled ? "Enabled" : "Disabled"
return """<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
<Rule>
<ID>$(rule.id)</ID>
<Filter>
<Prefix>$(rule.prefix)</Prefix>
</Filter>
<Status>$status</Status>
<Expiration>
<Days>$(rule.days)</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>"""
end
""" Set bucket lifecycle expiration rule.
# Arguments
- `storage::GarageStorage`: The storage client instance.
- `rule::LifecycleExpiration`: The lifecycle expiration rule.
# Returns
- `Dict{String, Any}`: Parsed response from the server.
# Example
```julia
rule = LifecycleExpiration("uploads/", 30)
set_lifecycle_expiration(storage, rule)
```
"""
function set_lifecycle_expiration(storage::GarageStorage, rule::LifecycleExpiration)
xml_body = build_lifecycle_xml(rule)
args = Dict{String,Any}("body" => xml_body)
return S3.put_bucket_lifecycle_configuration(storage.bucket, args; aws_config=storage.config)
end
""" Get the bucket lifecycle configuration.
# Arguments
- `storage::GarageStorage`: The storage client instance.
# Returns
- `Dict{String, Any}`: Parsed lifecycle configuration, or `nothing` if no lifecycle is configured.
# Example
```julia
config = get_lifecycle(storage)
```
"""
function get_lifecycle(storage::GarageStorage)::Union{Dict{String,Any},Nothing}
try
return S3.get_bucket_lifecycle_configuration(storage.bucket; aws_config=storage.config)
catch e
if isa(e, AWS.AWSException) && e.code == "NoSuchLifecycleConfiguration"
return nothing
end
rethrow(e)
end
end
""" Delete the bucket lifecycle configuration.
# Arguments
- `storage::GarageStorage`: The storage client instance.
# Returns
- `Dict{String, Any}`: Parsed response from the server.
# Example
```julia
delete_lifecycle(storage)
```
"""
function delete_lifecycle(storage::GarageStorage)
return S3.delete_bucket_lifecycle(storage.bucket; aws_config=storage.config)
end
end # module GarageS3
+109 -1
View File
@@ -3,7 +3,7 @@ module llmUtil
export formatLLMtext, extractthink, checkAgentResponse_JSON, clean_json_response, export formatLLMtext, extractthink, checkAgentResponse_JSON, clean_json_response,
extract_column_metadata, generate_embedding_payloads, resolve_semantic_cluster, extract_column_metadata, generate_embedding_payloads, resolve_semantic_cluster,
harvest_entity_catalog, resolve_entity, harvest_db_undirected_schema_graph, harvest_entity_catalog, resolve_entity, harvest_db_undirected_schema_graph,
get_db_table_schema get_db_table_schema, get_db_table_schema_simple
using UUIDs, JSON, Dates, DataFrames, StringDistances, Graphs, LibPQ using UUIDs, JSON, Dates, DataFrames, StringDistances, Graphs, LibPQ
using ..util using ..util
@@ -1016,7 +1016,115 @@ function get_db_table_schema(conn::LibPQ.Connection, table_name::String)::DataFr
end end
""" Generate simplified DDL statement for a PostgreSQL table.
Extracts table structure from PostgreSQL and returns a clean CREATE TABLE statement
without NULL/NOT NULL constraints, useful for schema documentation or migration purposes.
# Arguments
- `conn::LibPQ.Connection`
A PostgreSQL connection object created via `LibPQ.Connection()`.
- `table_name::String`
The name of the table to extract.
- `schema_name::String` (default: `"public"`)
The schema containing the table.
# Return
- `String`
A CREATE TABLE DDL statement containing:
- Column definitions with names, types, and DEFAULT values
- Table-level constraints (PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK)
- Excludes NULL/NOT NULL specifications for cleaner output
# Details
The function:
1. Queries PostgreSQL system catalogs (`pg_attribute`, `pg_class`, `pg_namespace`)
2. Extracts column names, data types, and default values
3. Captures table-level constraints via `pg_constraint`
4. Omits NULL/NOT NULL checks to produce a simplified schema definition
5. Returns properly formatted DDL with quoted identifiers
# Example
```julia
julia> using GeneralUtils, LibPQ
julia> conn = LibPQ.Connection("host=localhost port=5432 dbname=winedb user=admin password=secret")
julia> ddl = GeneralUtils.get_db_table_schema_simple(conn, "wine")
"CREATE TABLE \"public\".\"wine\" (
\"id\" integer DEFAULT nextval('wine_id_seq'::regclass),
\"wine_name\" text,
\"year\" integer,
\"price\" numeric
);"
```
"""
function get_db_table_schema_simple(pg_conn_str::String, table_name::String;
schema_name::String="public")::String
conn = LibPQ.Connection(pg_conn_str)
return get_db_table_schema_simple(conn, table_name; schema_name=schema_name)
end
function get_db_table_schema_simple(conn, table_name::String; schema_name::String="public")::String
# 1. SQL query tailored to omit nullability checks
sql = """
SELECT
a.attname AS column_name,
format_type(a.atttypid, a.atttypmod) AS data_type,
pg_get_expr(def.adbin, def.adrelid) AS default_value,
COALESCE(
(SELECT pg_get_constraintdef(p.oid)
FROM pg_catalog.pg_constraint p
WHERE p.conrelid = c.oid AND a.attnum = ANY(p.conkey)
LIMIT 1), ''
) AS constraint_definition
FROM
pg_catalog.pg_attribute a
JOIN
pg_catalog.pg_class c ON a.attrelid = c.oid
JOIN
pg_catalog.pg_namespace n ON c.relnamespace = n.oid
LEFT JOIN
pg_catalog.pg_attrdef def ON def.adrelid = c.oid AND def.adnum = a.attnum
WHERE
c.relname = \$1
AND n.nspname = \$2
AND a.attnum > 0
AND NOT a.attisdropped
ORDER BY
a.attnum;
"""
result = execute(conn, sql, [table_name, schema_name])
if length(result) == 0
error("Table '$schema_name.$table_name' not found.")
end
ddl_lines = String[]
constraints = String[]
for row in result
col_name = row.column_name
data_type = row.data_type
# Handle the default value if it exists
default_val = ismissing(row.default_value) ? "" : " DEFAULT " * row.default_value
# Build the column definition line (without NULL/NOT NULL)
col_def = " \"$col_name\" $data_type$default_val"
push!(ddl_lines, col_def)
# Handle table-level constraints
con_def = ismissing(row.constraint_definition) ? "" : row.constraint_definition
if !isempty(con_def) && !(con_def in constraints)
push!(constraints, " " * con_def)
end
end
all_definitions = vcat(ddl_lines, constraints)
body = join(all_definitions, ",\n")
return "CREATE TABLE \"$schema_name\".\"$table_name\" (\n$body\n);"
end
+449 -25
View File
@@ -1,39 +1,463 @@
using Test using Test
using GeneralUtils: detect_keyword using GeneralUtils
using GeneralUtils.garageS3
using AWS
using Random: randstring
using UUIDs: uuid4
@testset "detect_keyword tests" begin @testset "garageS3.jl" begin
@test detect_keyword(["test"], "this is a test") == Dict("test" => 1)
@test detect_keyword(["hello", "world"], "hello world hello") == Dict("hello" => 2, "world" => 1) # --- SimpleCredentials ---
@test detect_keyword(["cat"], "category") == Dict("cat" => 1) @testset "SimpleCredentials construction" begin
creds = GeneralUtils.garageS3.SimpleCredentials("AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "sessiontoken")
@test creds.access_key_id == "AKIAIOSFODNN7EXAMPLE"
@test creds.secret_key == "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
@test creds.token == "sessiontoken"
end
@test detect_keyword(["cat"], "category"; mode="individual") == Dict("cat" => 0) @testset "SimpleCredentials AWS extensions" begin
creds = GeneralUtils.garageS3.SimpleCredentials("key1", "secret1", "token1")
@test AWS.credentials(creds) === creds
@test AWS.check_credentials(creds) === creds
@test AWS.refresh!(creds; force=false) === creds
@test AWS.refresh!(creds) === creds
end
@test detect_keyword(["dog"], "dogs and cats"; mode="individual", delimiter=[' ']) == Dict("dog" => 0) # --- GarageConfig ---
@test detect_keyword(["test"], "test.case"; mode="individual", delimiter=['.']) == Dict("test" => 1) @testset "GarageConfig construction" begin
creds = GeneralUtils.garageS3.SimpleCredentials("key", "secret", "")
config = GeneralUtils.garageS3.GarageConfig("https://s3-api.example.com", "us-east-1", creds)
@test config.endpoint == "https://s3-api.example.com"
@test config.region == "us-east-1"
@test config.credentials === creds
@test config isa AWS.AbstractAWSConfig
end
@test detect_keyword(["word"], "") == Dict("word" => 0) @testset "GarageConfig AWS extensions" begin
creds = GeneralUtils.garageS3.SimpleCredentials("key", "secret", "")
config = GeneralUtils.garageS3.GarageConfig("https://s3-api.example.com", "garage", creds)
@test AWS.region(config) == "garage"
@test AWS.credentials(config) === creds
end
@test detect_keyword(String[], "some text") == Dict{String, Integer}() # --- AWS.generate_service_url ---
@test detect_keyword(["a", "b"], "a.b\nc"; delimiter=['.', '\n']) == Dict("a" => 1, "b" => 1) @testset "generate_service_url with resource starting with /" begin
creds = GeneralUtils.garageS3.SimpleCredentials("key", "secret", "")
config = GeneralUtils.garageS3.GarageConfig("https://s3-api.example.com", "garage", creds)
url = AWS.generate_service_url(config, "s3", "/mybucket/key")
@test url == "https://s3-api.example.com/mybucket/key"
end
multiline_text = """ @testset "generate_service_url with resource NOT starting with /" begin
first line creds = GeneralUtils.garageS3.SimpleCredentials("key", "secret", "")
second line config = GeneralUtils.garageS3.GarageConfig("https://s3-api.example.com", "garage", creds)
first word url = AWS.generate_service_url(config, "s3", "mybucket/key")
""" @test url == "https://s3-api.example.com/mybucket/key"
@test detect_keyword(["first"], multiline_text) == Dict("first" => 2) end
@test detect_keyword(["word"], "word"; mode="individual") == Dict("word" => 1) @testset "generate_service_url strips trailing slashes from endpoint" begin
creds = GeneralUtils.garageS3.SimpleCredentials("key", "secret", "")
config = GeneralUtils.garageS3.GarageConfig("https://s3-api.example.com/", "garage", creds)
url = AWS.generate_service_url(config, "s3", "/bucket/key")
@test url == "https://s3-api.example.com/bucket/key"
end
@testset "generate_service_url with multiple trailing slashes" begin
creds = GeneralUtils.garageS3.SimpleCredentials("key", "secret", "")
config = GeneralUtils.garageS3.GarageConfig("https://s3-api.example.com///", "garage", creds)
url = AWS.generate_service_url(config, "s3", "/bucket/key")
@test url == "https://s3-api.example.com/bucket/key"
end
@testset "generate_service_url preserves http endpoint" begin
creds = GeneralUtils.garageS3.SimpleCredentials("key", "secret", "")
config = GeneralUtils.garageS3.GarageConfig("http://localhost:3900", "garage", creds)
url = AWS.generate_service_url(config, "s3", "/bucket/key")
@test url == "http://localhost:3900/bucket/key"
end
@testset "generate_service_url with http endpoint and trailing slash" begin
creds = GeneralUtils.garageS3.SimpleCredentials("key", "secret", "")
config = GeneralUtils.garageS3.GarageConfig("http://localhost:3900/", "garage", creds)
url = AWS.generate_service_url(config, "s3", "/bucket/key")
@test url == "http://localhost:3900/bucket/key"
end
# --- GarageStorage ---
@testset "GarageStorage default region" begin
storage = GarageStorage("https://s3-api.example.com", "key123", "secret123", "mybucket")
@test storage.bucket == "mybucket"
@test storage.config.region == "garage"
@test storage.config.endpoint == "https://s3-api.example.com"
end
@testset "GarageStorage custom region" begin
storage = GarageStorage("https://s3-api.example.com", "key123", "secret123", "mybucket"; region="custom-region")
@test storage.config.region == "custom-region"
end
@testset "GarageStorage endpoint without https" begin
storage = GarageStorage("http://localhost:3900", "key", "secret", "mybucket")
@test storage.config.endpoint == "http://localhost:3900"
end
@testset "GarageStorage credentials are SimpleCredentials" begin
storage = GarageStorage("https://s3-api.example.com", "mykey", "mysecret", "mybucket")
@test storage.config.credentials isa GeneralUtils.garageS3.SimpleCredentials
@test storage.config.credentials.access_key_id == "mykey"
@test storage.config.credentials.secret_key == "mysecret"
@test storage.config.credentials.token == ""
end
@testset "GarageStorage returns correct struct type" begin
storage = GarageStorage("https://s3-api.example.com", "key", "secret", "bucket")
@test storage isa GarageStorage
end
# --- put_file callable struct ---
@testset "put_file callable struct type is correct" begin
storage = GarageStorage("https://s3-api.example.com", "key", "secret", "bucket")
uploader = put_file(storage)
@test uploader isa put_file
end
@testset "put_file callable struct construction stores storage" begin
storage = GarageStorage("https://s3-api.example.com", "key", "secret", "bucket")
uploader = put_file(storage)
@test uploader.storage === storage
end
# --- Integration tests with real Garage server ---
@testset "integration: full CRUD lifecycle" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
test_key = "testrunner-$(randstring(8)).json"
test_data = "{\"status\": \"testing\", \"runner\": \"runtests\"}"
# Test put_file(storage, key, data) - successful upload
result = put_file(storage, test_key, test_data)
@test result !== nothing
@test haskey(result, :api)
@test haskey(result, :web)
@test occursin("testbucket", result.api)
@test occursin("s3-api", result.api)
@test occursin("s3-web", result.web)
# Test get_file - retrieve the uploaded data
downloaded = get_file(storage, test_key)
@test downloaded !== nothing
@test downloaded isa Vector{UInt8}
@test String(downloaded) == test_data
# Test list_files - verify key appears in listing
keys = list_files(storage)
@test test_key in keys
# Test put_file callable struct
test_key2 = "testrunner-callable-$(randstring(8)).json"
callable_result = put_file(storage)(test_key2, "callable-data")
@test callable_result !== nothing
@test callable_result.api != ""
@test callable_result.web != ""
# Verify callable upload
downloaded2 = get_file(storage, test_key2)
@test String(downloaded2) == "callable-data"
# Test delete_file
delete_file(storage, test_key)
deleted_data = get_file(storage, test_key)
@test deleted_data === nothing
# Cleanup callable test object
delete_file(storage, test_key2)
deleted_data2 = get_file(storage, test_key2)
@test deleted_data2 === nothing
end
@testset "integration: nested key CRUD - single level" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
test_key = "single/slash/test-$(randstring(8)).json"
test_data = "{\"level\": 1, \"nested\": true}"
# Upload nested key
result = put_file(storage, test_key, test_data)
@test result isa NamedTuple
@test haskey(result, :api)
@test haskey(result, :web)
@test occursin("single/slash/", result.api)
@test occursin("single/slash/", result.web)
# Download and verify
downloaded = get_file(storage, test_key)
@test downloaded !== nothing
@test String(downloaded) == test_data
# Verify in listing
keys = list_files(storage)
@test test_key in keys
# Delete and verify gone
delete_file(storage, test_key)
@test get_file(storage, test_key) === nothing
end
@testset "integration: nested key CRUD - multi level" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
test_key = "deep/nested/folder/subfolder/test-$(randstring(8)).json"
test_data = "{\"deeply\": \"nested\", \"path\": \"deep/nested/folder/subfolder/\"}"
# Upload deeply nested key
result = put_file(storage, test_key, test_data)
@test result isa NamedTuple
@test occursin("deep/nested/folder/subfolder/", result.api)
@test occursin("s3-api", result.api)
@test occursin("s3-web", result.web)
# Download and verify
downloaded = get_file(storage, test_key)
@test downloaded !== nothing
@test String(downloaded) == test_data
# Verify in listing
keys = list_files(storage)
@test test_key in keys
# Delete and verify gone
delete_file(storage, test_key)
@test get_file(storage, test_key) === nothing
end
@testset "integration: nested key with callable struct" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
test_key = "callable/nested/test-$(randstring(8)).json"
test_data = "{\"callable\": true, \"nested\": true}"
uploader = put_file(storage)
result = uploader(test_key, test_data)
@test result isa NamedTuple
@test occursin("callable/nested/", result.api)
downloaded = get_file(storage, test_key)
@test String(downloaded) == test_data
delete_file(storage, test_key)
@test get_file(storage, test_key) === nothing
end
@testset "integration: get_file returns nothing for missing key" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
result = get_file(storage, "nonexistent-key-$(randstring(8)).json")
@test result === nothing
end
@testset "integration: binary data upload and download" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
test_key = "testrunner-binary-$(randstring(8)).bin"
binary_data = UInt8[0x00, 0x01, 0x02, 0xFF, 0xFE, 0xFD, 0x48, 0x65, 0x6c, 0x6c, 0x6f]
result = put_file(storage, test_key, binary_data)
@test result !== nothing
downloaded = get_file(storage, test_key)
@test downloaded == binary_data
delete_file(storage, test_key)
@test get_file(storage, test_key) === nothing
end
@testset "integration: list_files returns vector of strings" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
test_key = "testrunner-list-$(randstring(8)).txt"
put_file(storage, test_key, "list-test-data")
keys = list_files(storage)
@test keys isa Vector{String}
@test test_key in keys
delete_file(storage, test_key)
end
@testset "integration: url format validation" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
test_key = "testrunner-url-$(randstring(8)).json"
result = put_file(storage, test_key, "url-test")
@test startswith(result.api, "https://s3-api.yiem.cc/testbucket/")
@test occursin("/$test_key", result.api)
@test startswith(result.web, "https://s3-web.yiem.cc/testbucket/")
@test occursin("/$test_key", result.web)
delete_file(storage, test_key)
end
# --- Lifecycle configuration tests ---
@testset "LifecycleExpiration construction with default ID" begin
rule = LifecycleExpiration("uploads/", 30)
@test rule.prefix == "uploads/"
@test rule.days == 30
@test rule.enabled == true
@test rule.id == "expire-uploads_-30d"
end
@testset "LifecycleExpiration construction with custom ID" begin
rule = LifecycleExpiration("data/", 7; id="my-rule")
@test rule.prefix == "data/"
@test rule.days == 7
@test rule.enabled == true
@test rule.id == "my-rule"
end
@testset "LifecycleExpiration with disabled flag" begin
rule = LifecycleExpiration("temp/", 1; enabled=false)
@test rule.enabled == false
end
@testset "LifecycleExpiration with nested prefix" begin
rule = LifecycleExpiration("deep/nested/", 90)
@test rule.prefix == "deep/nested/"
end
@testset "build_lifecycle_xml generates valid XML" begin
rule = LifecycleExpiration("test/", 14; id="test-rule")
xml = build_lifecycle_xml(rule)
@test occursin("<?xml version=\"1.0\"", xml)
@test occursin("<LifecycleConfiguration>", xml)
@test occursin("<ID>test-rule</ID>", xml)
@test occursin("<Prefix>test/</Prefix>", xml)
@test occursin("<Status>Enabled</Status>", xml)
@test occursin("<Days>14</Days>", xml)
@test occursin("</LifecycleConfiguration>", xml)
end
@testset "build_lifecycle_xml generates disabled rule XML" begin
rule = LifecycleExpiration("temp/", 1; enabled=false)
xml = build_lifecycle_xml(rule)
@test occursin("<Status>Disabled</Status>", xml)
end
@testset "integration: lifecycle CRUD - set and get" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
# Should return nothing when no lifecycle is set
lc = get_lifecycle(storage)
@test lc === nothing
# Set lifecycle
rule = LifecycleExpiration("lifecycle-test/", 45)
set_lifecycle_expiration(storage, rule)
# Should return configuration after setting
lc = get_lifecycle(storage)
@test lc !== nothing
@test haskey(lc, "Rule")
# Delete lifecycle
delete_lifecycle(storage)
# Should return nothing after deletion
lc = get_lifecycle(storage)
@test lc === nothing
end
@testset "integration: lifecycle with nested prefix" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
rule = LifecycleExpiration("a/b/c/", 20; id="nested-rule")
set_lifecycle_expiration(storage, rule)
lc = get_lifecycle(storage)
@test lc !== nothing
@test haskey(lc, "Rule")
delete_lifecycle(storage)
@test get_lifecycle(storage) === nothing
end
@testset "integration: lifecycle enabled/disabled toggle" begin
storage = GarageStorage(
"https://s3-api.yiem.cc",
"GKb080154a2e5b19100b1b2c6e",
"a2c6b1379c2f731d3e6e5a408dd4d6cffca7511717675f55114ff94828febca1",
"testbucket"
)
# Set enabled rule
rule1 = LifecycleExpiration("toggle/", 10; enabled=true)
set_lifecycle_expiration(storage, rule1)
lc = get_lifecycle(storage)
@test lc !== nothing
# Override with disabled rule
rule2 = LifecycleExpiration("toggle/", 10; enabled=false)
set_lifecycle_expiration(storage, rule2)
lc = get_lifecycle(storage)
@test lc !== nothing
delete_lifecycle(storage)
end
@test detect_keyword(["test"], "testing.test.tester"; mode="individual", delimiter=['.']) == Dict("test" => 1)
end end