add helper for obtaining a seq of keys from a view
This commit is contained in:
parent
65de2410a3
commit
f70e17a653
|
@ -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]
|
||||||
|
|
Reference in a new issue