;; This Source Code Form is subject to the terms of the Mozilla Public ;; License, v. 2.0. If a copy of the MPL was not distributed with this ;; file, You can obtain one at http://mozilla.org/MPL/2.0/. (ns datomish.db-test #?(:cljs (:require-macros [datomish.pair-chan :refer [go-pair !]]]) #?@(:cljs [[datomish.pair-chan] [datomish.test-macros :refer-macros [deftest-async]] [datomish.node-tempfile :refer [tempfile]] [cljs.test :as t :refer-macros [is are deftest testing async]] [cljs.core.async :as a :refer [!]]])) #?(:clj (:import [clojure.lang ExceptionInfo])) #?(:clj (:import [datascript.db DB]))) #?(:cljs (def Throwable js/Error)) (defn- tempids [tx] (into {} (map (juxt (comp :idx first) second) (:tempids tx)))) (defn- > (s/all-rows (:sqlite-connection db) ["SELECT e, a, v, tx FROM datoms WHERE tx > ?" tx]) (> (s/all-rows (:sqlite-connection db) ["SELECT a, v FROM datoms WHERE e = ?" eid]) (> (s/all-rows (:sqlite-connection db) ["SELECT e, a, v, tx, added FROM transactions WHERE tx > ? ORDER BY tx ASC, e, a, v, added" tx]) (> (s/all-rows (:sqlite-connection db) ["SELECT rowid, text FROM fulltext_values"]) (