Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(defmacro execute-query
"Wrapper around with-connection & with-query-results"
[results query & body]
(debug (str "[SQL] " ~query))
(with-connection {:datasource (data-source)}
(with-query-results ~results [~query] ~@body))))
(defmacro with-items-in
[ids options & body]
`(let [ids-cond# (str-utils2/join "," ~ids)
query# ~(options :query)
table# ~(options :table)]
(info ~(options :msg))
(str query#
" WHERE " table# ".id IN (" ids-cond#
") GROUP BY " table# ".id ORDER BY NULL")
;; with `items at line 17 it gives
;; Unsupported binding form: (quote
;; and with quote removed I receive
;; Can't use qualified name as parameter:
;; [Thrown class java.lang.Exception]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.