2016-08-05 00:40:38 +00:00
|
|
|
;; 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.api
|
|
|
|
#?(:cljs
|
|
|
|
(:require-macros
|
|
|
|
[datomish.pair-chan :refer [go-pair <?]]
|
|
|
|
[cljs.core.async.macros :as a :refer [go]]))
|
|
|
|
(:require
|
|
|
|
[datomish.db :as db]
|
|
|
|
[datomish.db-factory :as db-factory]
|
|
|
|
[datomish.sqlite :as sqlite]
|
|
|
|
[datomish.transact :as transact]
|
|
|
|
#?@(:clj [[datomish.pair-chan :refer [go-pair <?]]
|
|
|
|
[clojure.core.async :refer [go <! >!]]])
|
|
|
|
#?@(:cljs [[datomish.pair-chan]
|
|
|
|
[cljs.core.async :as a :refer [<! >!]]])))
|
|
|
|
|
|
|
|
(defn <connect [uri]
|
|
|
|
;; Eventually, URI. For now, just a plain path (no file://).
|
|
|
|
(go-pair
|
2016-08-19 16:14:27 +00:00
|
|
|
(let [conn (<? (sqlite/<sqlite-connection uri))
|
|
|
|
db (<? (db-factory/<db-with-sqlite-connection conn))]
|
|
|
|
(transact/connection-with-db db))))
|
2016-08-05 00:40:38 +00:00
|
|
|
|
|
|
|
(def <transact! transact/<transact!)
|
|
|
|
|
|
|
|
;; TODO: use Potemkin, or a subset of Potemkin that is CLJS friendly (like
|
|
|
|
;; https://github.com/ztellman/potemkin/issues/31) to improve this re-exporting process.
|
|
|
|
(def <close transact/close)
|
|
|
|
|
2016-08-05 00:54:50 +00:00
|
|
|
(def id-literal db/id-literal)
|
2016-08-05 00:40:38 +00:00
|
|
|
|
2016-09-09 22:26:13 +00:00
|
|
|
(def lookup-ref db/lookup-ref)
|
|
|
|
|
2016-08-05 00:40:38 +00:00
|
|
|
(def db transact/db)
|
2016-08-05 20:59:07 +00:00
|
|
|
|
|
|
|
(def entid db/entid)
|
|
|
|
|
|
|
|
(def ident db/ident)
|
2016-08-06 00:58:46 +00:00
|
|
|
|
|
|
|
(def <q db/<?q)
|
2016-08-12 00:20:27 +00:00
|
|
|
|
|
|
|
(def schema db/schema)
|