-
-
Save fogus/6f0bba78a6969bd614f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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