add helper for obtaining a seq of keys from a view

This commit is contained in:
Gered 2013-05-21 22:40:05 -04:00
parent 65de2410a3
commit f70e17a653

View file

@ -18,6 +18,12 @@
(def posts (db-url "blarg_posts")) (def posts (db-url "blarg_posts"))
(def files (db-url "blarg_files")) (def files (db-url "blarg_files"))
(defmacro ->view-keys
"returns a sequence of only the keys returned by running a view"
[& body]
`(if-let [result# ~@body]
(map (fn [x#] (:key x#)) result#)))
(defmacro ->view-values (defmacro ->view-values
"returns a sequence of only the values returned by running a view" "returns a sequence of only the values returned by running a view"
[& body] [& body]