Skip to content

Instantly share code, notes, and snippets.

Created January 9, 2010 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/272977 to your computer and use it in GitHub Desktop.
Save anonymous/272977 to your computer and use it in GitHub Desktop.
(defmacro apply-sql
"Apply a function to the result of the sql query."
[handler & forms]
`(sql/run [*conn* results#] ~@forms (~handler results#)))
(defmacro dosql
"Simply package and return sql results"
[& forms]
`(apply-sql (fn [res#] (if (seq? res#) (doall res#) res#)) ~@forms))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment