Skip to content

Instantly share code, notes, and snippets.

@alandipert
Created February 24, 2015 19:52
Show Gist options
  • Save alandipert/9ecad44a91cf883c7ba1 to your computer and use it in GitHub Desktop.
Save alandipert/9ecad44a91cf883c7ba1 to your computer and use it in GitHub Desktop.
(require '[clojure.core.strint :as si] ;[org.clojure/core.incubator "0.1.3"]
'[clojure.string :as str])
(defn deterpolate
[s]
(let [inter (@#'si/interpolate s)]
(vec (list* (str/join "?" (filter string? inter))
(filter (complement string?) inter)))))
(defmacro <?
[q]
`(j/query (get-connection) ~(deterpolate q)))
(mapv #(<? "select * from foop where id = ~{%}") [1 2 3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment