Skip to content
Snippets Groups Projects
Commit a275c18d authored by Cam Saul's avatar Cam Saul
Browse files

test fix

parent 15e5f79e
No related branches found
No related tags found
No related merge requests found
......@@ -288,15 +288,19 @@
;; ## EXISTS?
(defn exists?
(defn -exists?
[entity kwargs]
(boolean (seq (k/select (i/entity->korma entity)
(k/fields [:id])
(k/where kwargs)
(k/limit 1)))))
(defmacro exists?
"Easy way to see if something exists in the db.
(exists? User :id 100)"
[entity & {:as kwargs}]
(boolean (seq (k/select (i/entity->korma entity)
(k/fields [:id])
(k/where (if (seq kwargs) kwargs {}))
(k/limit 1)))))
`(-exists? ~entity '~(if (seq kwargs) kwargs {})))
;; ## CASADE-DELETE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment