From f408cfd314c654c002fddbfa5b74d4f5530c32c8 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Thu, 4 Aug 2016 16:20:48 -0700 Subject: [PATCH] Follow-up: lift helpers to IDB. --- src/datomish/db.cljc | 52 ++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/datomish/db.cljc b/src/datomish/db.cljc index 25241e94..6d4dc3c4 100644 --- a/src/datomish/db.cljc +++ b/src/datomish/db.cljc @@ -79,6 +79,14 @@ [db datoms] "Apply datoms to the store.") + (SQLite (get-in ds/value-type-map [:db.type/keyword :->SQLite]) ;; TODO: make this a protocol. + exec (partial s/execute! (:sqlite-connection db))] + ;; TODO: batch insert. + (doseq [[ident entid] added-idents] + (SQLite ident) entid])))) + db)) + + (SQLite (get-in ds/value-type-map [:db.type/keyword :->SQLite]) ;; TODO: make this a protocol. + exec (partial s/execute! (:sqlite-connection db))] + ;; TODO: batch insert. + (doseq [[ident attr-map] fragment] + (doseq [[attr value] attr-map] + (SQLite ident) (->SQLite attr) (->SQLite value)]))))) + db)) (close-db [db] (s/close (.-sqlite-connection db))) @@ -984,28 +1012,6 @@ schema-fragment (datomish.schema-changes/datoms->schema-fragment datoms)] (assoc-in report [:added-attributes] schema-fragment))) -;; TODO: lift to IDB. -(defn SQLite (get-in ds/value-type-map [:db.type/keyword :->SQLite]) ;; TODO: make this a protocol. - exec (partial s/execute! (:sqlite-connection db))] - ;; TODO: batch insert. - (doseq [[ident entid] added-idents] - (SQLite ident) entid])))) - db)) - -(defn SQLite (get-in ds/value-type-map [:db.type/keyword :->SQLite]) ;; TODO: make this a protocol. - exec (partial s/execute! (:sqlite-connection db))] - ;; TODO: batch insert. - (doseq [[ident attr-map] fragment] - (doseq [[attr value] attr-map] - (SQLite ident) (->SQLite attr) (->SQLite value)]))))) - db)) - (defn- >