Hacking on exec-repl.

This commit is contained in:
Richard Newman 2016-08-12 16:30:21 -07:00
parent c89f1f74c5
commit 7486c2a8ba

View file

@ -9,6 +9,7 @@
[datomish.pair-chan :refer [go-pair <?]] [datomish.pair-chan :refer [go-pair <?]]
[cljs.core.async.macros :refer [go]])) [cljs.core.async.macros :refer [go]]))
(:require (:require
[datomish.db-factory]
[datomish.db :as db] [datomish.db :as db]
[datomish.sqlite :as s] [datomish.sqlite :as s]
[datomish.sqlite-schema :as ss] [datomish.sqlite-schema :as ss]
@ -44,7 +45,7 @@
#_ #_
(defn xxopen [] (defn xxopen []
(datomish.pair-chan/go-pair (datomish.pair-chan/go-pair
(let [d (datomish.pair-chan/<? (s/<sqlite-connection "/tmp/foo.sqlite"))] (let [d (datomish.pair-chan/<? (s/<sqlite-connection "/tmp/import.sqlite"))]
(clojure.core.async/<!! (ss/<ensure-current-version d)) (clojure.core.async/<!! (ss/<ensure-current-version d))
(def db d)))) (def db d))))
@ -59,19 +60,26 @@
"/tmp/foo.sqlite" "/tmp/foo.sqlite"
'[:find ?page :in $ :where [?page :page/starred true ?t]])) '[:find ?page :in $ :where [?page :page/starred true ?t]]))
#_(require 'datomish.exec-repl)
#_(in-ns 'datomish.exec-repl)
#_ #_
(go-pair (go-pair
(let [connection (<? (s/<sqlite-connection "/tmp/foo.sqlite")) (let [connection (<? (s/<sqlite-connection "/tmp/bigport.db"))
d (<? (db/<with-sqlite-connection connection))] d (<? (datomish.db-factory/<db-with-sqlite-connection connection))]
(println (def db d)))
"Result: "
(<! (db/<?q d '[:find ?page :in $ :where [?page :page/starred true ?t]] {}))))) #_
(go-pair
(println (count (first (time
(<! (db/<?q db
'[:find ?url ?title :in $ :where
[?page :page/visitAt ?v] [(> ?v 1438748166567751)] [?page :page/title ?title] [?page :page/url ?url] ] {})))))))
#_ #_
(go-pair (go-pair
(let [connection (<? (s/<sqlite-connection "/tmp/foo.sqlite")) (let [connection (<? (s/<sqlite-connection "/tmp/foo.sqlite"))
dd (<? (db/<with-sqlite-connection connection))] dd (<? (datomish.db-factory/<db-with-sqlite-connection connection))]
(def *db* dd))) (def *db* dd)))
#_ #_
(clojure.core.async/<!! (clojure.core.async/<!!