Created
August 24, 2012 21:36
-
-
Save michaelsbradleyjr/3455905 to your computer and use it in GitHub Desktop.
defcrudo macro
This file contains 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
(defmacro defcrudo | |
[name & forms] | |
(let [forms (if (vector? (first forms)) | |
(list forms) | |
forms)] | |
`(defn ~name | |
~@(map (fn [form] | |
(let [args (first form)] | |
`(~args (oc/with-db | |
(apply og/open-graph-db! orient-rconn-info) | |
(oc/with-tx | |
~@(rest form)))))) | |
forms)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment