Skip to content

Instantly share code, notes, and snippets.

@Nozistance
Nozistance / query.clj
Last active May 2, 2026 14:22
Convenient work with SQL queries (next.jdbc)
(ns project.db.query
(:require [clojure.java.io :as io]
[clojure.string :as str]))
(defn- sql-file [path]
(-> (format "sql/%s.sql" path)
io/resource slurp str/trim))
(defn- parse-placeholders [sql]
(loop [matches (re-seq #"\?(\d*)|\?" sql)