cumin.core
defscoped
macro
(defscoped [name parent] & body)
Define entity name
that merges all properties of parent
before applying body
include
macro
(include query sub-ent m & body)
Eager load records with custom relationship mapping
(select person
(include email {:id :email_id :as person_emails}
(where {:valid true})))
post-order
(post-order query f coll)
Setup post-query to order results based on f
and coll
any record where (f record) is not in coll
will be appended in their original SQL ordering.
(select person
(post-order :id [5 4 3 2 1]))
re-order
(re-order query field & [dir])
Remove any order
clause from a query map and replace with [field dir]
(-> (select* person)
(order :name)
(re-order :id))
scope
macro
(scope ent & body)
Apply a default query body for all queries executed for entity ent
(defentity teenager
(table :person)
(scope
(where {:age [between [13 19]]})
(order :name :desc)))