From f8a94c19620dee9f0314ed647afb0296a3b65695 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Wed, 17 Jan 2024 19:45:09 -0500 Subject: [PATCH] switch to use metadata on query-fn component --- build/deps.edn | 6 +++--- .../io/github/kit_clj/kit/versions.edn | 2 +- libs/kit-nrepl/deps.edn | 2 +- libs/kit-quartz/deps.edn | 2 +- libs/kit-redis/deps.edn | 2 +- libs/kit-sql-conman/deps.edn | 2 +- .../src/kit/edge/db/sql/conman.clj | 18 ++++++++---------- libs/kit-sql-hikari/deps.edn | 2 +- 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/build/deps.edn b/build/deps.edn index ea282b2..76b48aa 100644 --- a/build/deps.edn +++ b/build/deps.edn @@ -26,7 +26,7 @@ cheshire/cheshire {:mvn/version "5.11.0"} ;; kit-quartz com.troy-west/cronut {:mvn/version "0.2.6"} - io.github.kit-clj/kit-core {:mvn/version "1.0.4"} + io.github.kit-clj/kit-core {:mvn/version "1.0.6"} ;; kit-redis org.clojure/core.cache {:mvn/version "1.0.225"} com.taoensso/carmine {:mvn/version "3.2.0"} @@ -34,8 +34,8 @@ ;; kit-selmer selmer/selmer {:mvn/version "1.12.59"} ;; kit-sql - io.github.kit-clj/kit-sql-conman {:mvn/version "1.0.8"} - io.github.kit-clj/kit-sql-migratus {:mvn/version "1.0.3"} + io.github.kit-clj/kit-sql-conman {:mvn/version "1.10.0"} + io.github.kit-clj/kit-sql-migratus {:mvn/version "1.0.4"} ;; kit-sql-conman conman/conman {:mvn/version "0.9.6"} ;; kit-sql-hikari diff --git a/libs/deps-template/resources/io/github/kit_clj/kit/versions.edn b/libs/deps-template/resources/io/github/kit_clj/kit/versions.edn index e7cfb25..9e26b74 100644 --- a/libs/deps-template/resources/io/github/kit_clj/kit/versions.edn +++ b/libs/deps-template/resources/io/github/kit_clj/kit/versions.edn @@ -12,7 +12,7 @@ "kit-repl" "1.0.2" "kit-selmer" "1.0.3" "kit-sql-migratus" "1.0.4" - "kit-sql-conman" "1.0.9" + "kit-sql-conman" "1.10.0" "kit-sql-hikari" "1.0.4" "kit-sql" "1.1.4" "kit-undertow" "1.0.6" diff --git a/libs/kit-nrepl/deps.edn b/libs/kit-nrepl/deps.edn index ea35f47..fb84499 100644 --- a/libs/kit-nrepl/deps.edn +++ b/libs/kit-nrepl/deps.edn @@ -2,4 +2,4 @@ :deps {org.clojure/tools.logging {:mvn/version "1.2.4"} integrant/integrant {:mvn/version "0.8.1"} nrepl/nrepl {:mvn/version "1.0.0"} - io.github.kit-clj/kit-core {:mvn/version "1.0.4"}}} + io.github.kit-clj/kit-core {:mvn/version "1.0.6"}}} diff --git a/libs/kit-quartz/deps.edn b/libs/kit-quartz/deps.edn index d2c89bb..5005833 100644 --- a/libs/kit-quartz/deps.edn +++ b/libs/kit-quartz/deps.edn @@ -2,4 +2,4 @@ :deps {aero/aero {:mvn/version "1.1.6"} integrant/integrant {:mvn/version "0.8.1"} com.troy-west/cronut {:mvn/version "0.2.6"} - io.github.kit-clj/kit-core {:mvn/version "1.0.4"}}} + io.github.kit-clj/kit-core {:mvn/version "1.0.6"}}} diff --git a/libs/kit-redis/deps.edn b/libs/kit-redis/deps.edn index 093c141..14587b2 100644 --- a/libs/kit-redis/deps.edn +++ b/libs/kit-redis/deps.edn @@ -2,4 +2,4 @@ :deps {integrant/integrant {:mvn/version "0.8.1"} org.clojure/core.cache {:mvn/version "1.0.225"} com.taoensso/carmine {:mvn/version "3.2.0"} - io.github.kit-clj/kit-core {:mvn/version "1.0.4"}}} + io.github.kit-clj/kit-core {:mvn/version "1.0.6"}}} diff --git a/libs/kit-sql-conman/deps.edn b/libs/kit-sql-conman/deps.edn index 8953662..9638ed0 100644 --- a/libs/kit-sql-conman/deps.edn +++ b/libs/kit-sql-conman/deps.edn @@ -1,4 +1,4 @@ {:paths ["src"] :deps {integrant/integrant {:mvn/version "0.8.1"} conman/conman {:mvn/version "0.9.6"} - io.github.kit-clj/kit-core {:mvn/version "1.0.4"}}} + io.github.kit-clj/kit-core {:mvn/version "1.0.6"}}} diff --git a/libs/kit-sql-conman/src/kit/edge/db/sql/conman.clj b/libs/kit-sql-conman/src/kit/edge/db/sql/conman.clj index 511112d..3fd1b05 100644 --- a/libs/kit-sql-conman/src/kit/edge/db/sql/conman.clj +++ b/libs/kit-sql-conman/src/kit/edge/db/sql/conman.clj @@ -23,15 +23,13 @@ :or {options {}}}] (let [filenames (or filenames [filename]) queries (apply conman/bind-connection-map conn options filenames)] - {:mtimes (map ig-utils/last-modified filenames) - :query-fn (fn - ([query params] - (conman/query queries query params)) - ([conn query params & opts] - (apply conman/query conn queries query params opts)))})) - -(defmethod ig/resolve-key :db.sql/query-fn [_ {:keys [query-fn]}] - query-fn) + (with-meta + (fn + ([query params] + (conman/query queries query params)) + ([conn query params & opts] + (apply conman/query conn queries query params opts))) + {:mtimes (map ig-utils/last-modified filenames)}))) (defmethod ig/suspend-key! :db.sql/query-fn [_ _]) @@ -39,7 +37,7 @@ [k {:keys [filename filenames] :as opts} old-opts old-impl] (if (and (= opts old-opts) (= (map ig-utils/last-modified (or filenames [filename])) - (:mtimes old-impl))) + (:mtimes (meta old-impl)))) old-impl (do (ig/halt-key! k old-impl) (ig/init-key k opts)))) diff --git a/libs/kit-sql-hikari/deps.edn b/libs/kit-sql-hikari/deps.edn index fe0a48b..8f34cf8 100644 --- a/libs/kit-sql-hikari/deps.edn +++ b/libs/kit-sql-hikari/deps.edn @@ -2,4 +2,4 @@ :deps {integrant/integrant {:mvn/version "0.8.1"} com.github.seancorfield/next.jdbc {:mvn/version "1.3.883"} ;; TODO: is this required here? hikari-cp/hikari-cp {:mvn/version "3.0.1"} - io.github.kit-clj/kit-core {:mvn/version "1.0.4"}}} + io.github.kit-clj/kit-core {:mvn/version "1.0.6"}}}