From 0b6ac81ed5fcb37d92b743e26de6622a9cdfe55d Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Wed, 5 Oct 2016 12:53:57 -0700 Subject: [PATCH] Part 1: extend 'db' JS object with more useful methods. --- src/common/datomish/js.cljs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common/datomish/js.cljs b/src/common/datomish/js.cljs index 0c7ab46b..2cc72d68 100644 --- a/src/common/datomish/js.cljs +++ b/src/common/datomish/js.cljs @@ -73,10 +73,20 @@ ;; We pickle the connection as a thunk here so it roundtrips through JS ;; without incident. {:conn (fn [] c) - :roundtrip (fn [x] (clj->js (cljify x))) :db (fn [] (transact/db c)) + :path path + + ;; Primary API. :ensureSchema (fn [simple-schema] (ensure-schema c simple-schema)) :transact (fn [tx-data] (transact c tx-data)) + :q (fn [find opts] (q (transact/db c) find opts)) :close (fn [] (db/close-db db)) + + ;; Some helpers for testing the bridge. + :equal = + :idx (fn [tempid] (:idx tempid)) + :cljify cljify + :roundtrip (fn [x] (clj->js (cljify x))) + :toString (fn [] (str "#")) - :path path})))) + }))))