diff --git a/.clj-kondo/com.github.seancorfield/next.jdbc/config.edn b/.clj-kondo/com.github.seancorfield/next.jdbc/config.edn new file mode 100644 index 0000000..a67a5c6 --- /dev/null +++ b/.clj-kondo/com.github.seancorfield/next.jdbc/config.edn @@ -0,0 +1,4 @@ +{:hooks + {:analyze-call + {next.jdbc/with-transaction + hooks.com.github.seancorfield.next-jdbc/with-transaction}}} diff --git a/.clj-kondo/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj b/.clj-kondo/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj new file mode 100644 index 0000000..6ff1e8b --- /dev/null +++ b/.clj-kondo/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj @@ -0,0 +1,19 @@ +(ns hooks.com.github.seancorfield.next-jdbc + (:require + [clj-kondo.hooks-api :as api])) + +(defn with-transaction + "Expands (with-transaction [tx expr opts] body) + to (let [tx expr] opts body) pre clj-kondo examples." + [{:keys [:node]}] + (let [[binding-vec & body] (rest (:children node)) + [sym val opts] (:children binding-vec)] + (when-not (and sym val) + (throw (ex-info "No sym and val provided" {}))) + (let [new-node (api/list-node + (list* + (api/token-node 'let) + (api/vector-node [sym val]) + opts + body))] + {:node new-node})))