diff --git a/.clj-kondo/imports/com.github.seancorfield/next.jdbc/config.edn b/.clj-kondo/imports/com.github.seancorfield/next.jdbc/config.edn new file mode 100644 index 0000000..c02325b --- /dev/null +++ b/.clj-kondo/imports/com.github.seancorfield/next.jdbc/config.edn @@ -0,0 +1,8 @@ +{:hooks + {:analyze-call + {next.jdbc/with-transaction + hooks.com.github.seancorfield.next-jdbc/with-transaction + next.jdbc/with-transaction+options + hooks.com.github.seancorfield.next-jdbc/with-transaction+options}} + :lint-as {next.jdbc/on-connection clojure.core/with-open + next.jdbc/on-connection+options clojure.core/with-open}} diff --git a/.clj-kondo/imports/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj_kondo b/.clj-kondo/imports/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj_kondo new file mode 100644 index 0000000..9fc398d --- /dev/null +++ b/.clj-kondo/imports/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj_kondo @@ -0,0 +1,34 @@ +(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) per 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}))) + +(defn with-transaction+options + "Expands (with-transaction+options [tx expr opts] body) + to (let [tx expr] opts body) per 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}))) diff --git a/.gitignore b/.gitignore index 50ebdfd..c59da33 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ .calva/repl.calva-repl .classpath .clj-kondo/.cache -.clj-kondo/com.github.seancorfield/next.jdbc .cpcache .eastwood .factorypath