       (sorted-map)
       (vals (:rmap db)))))
 
+(declare exec)
+
+(defn- q-mread [db queries]
+  (vec
+    (map (fn [query] (exec db query))
+         queries)))
+
 (def- query-fns
   {:select q-select
    :count  q-count
    :insert q-insert
    :update q-update
    :delete q-delete
-   :index  q-index})
+   :index  q-index
+   :mread  q-mread})
 
 (defn exec [db [query-type opts]]
   (if-let [queryfn (query-fns query-type)]

        int-imap))
    imap imap))

(defn- q-insert [db {:keys [record]}]
  (assert record)
  (let [id   (:id record)
        {old-rmap :rmap old-imap :imap} db]
    (assert id)
    (assert (not (contains? old-rmap id)))
    (let [new-rmap (assoc old-rmap id record)
          new-imap (indexes-insert old-imap record)]
      (assoc db :rmap new-rmap :imap new-imap))))

(def- conj-op?
  #{:and :or})

    (nil? op)
      (constantly true)
    :else
      (raise (str "where op " op " not recognized"))))

(defn- order-keyfn [attr dir]
  (assert (#{:asc :dsc} dir))
