Pre: clarify comments.

This commit is contained in:
Nick Alexander 2016-10-11 20:21:48 -07:00
parent a89224673a
commit e1b1abe2de

View file

@ -111,9 +111,12 @@
(in-transaction! (in-transaction!
[db chan-fn] [db chan-fn]
"Evaluate the given pair-chan `chan-fn` in an exclusive transaction. If it returns non-nil, "Evaluate the given `chan-fn` in an exclusive transaction. If it returns non-nil,
commit the transaction; otherwise, rollback the transaction. Returns a pair-chan resolving to commit the transaction; otherwise, rollback the transaction.
the pair-chan returned by `chan-fn`.")
`chan-fn` should be a function of no arguments returning a pair-chan.
Returns a pair-chan resolving to the same pair as the pair-chan returned by `chan-fn`.")
(<bootstrapped? [db] (<bootstrapped? [db]
"Return true if this database has no transactions yet committed.") "Return true if this database has no transactions yet committed.")
@ -818,14 +821,14 @@
(<?q db find {})) (<?q db find {}))
([db find options] ([db find options]
(let [unexpected (seq (clojure.set/difference (set (keys options)) #{:limit :order-by :inputs}))] (let [unexpected (seq (clojure.set/difference (set (keys options)) #{:limit :order-by :inputs}))]
(when unexpected (when unexpected
(raise "Unexpected options: " unexpected {:bad-options unexpected}))) (raise "Unexpected options: " unexpected {:bad-options unexpected})))
(let [{:keys [limit order-by inputs]} options (let [{:keys [limit order-by inputs]} options
parsed (query/parse find) parsed (query/parse find)
context (-> db context (-> db
query-context query-context
(query/options-into-context limit order-by) (query/options-into-context limit order-by)
(query/find-into-context parsed)) (query/find-into-context parsed))
;; We turn each row into either an array of values or an unadorned ;; We turn each row into either an array of values or an unadorned
;; value. The row-pair-transducer does this work. ;; value. The row-pair-transducer does this work.