Skip to content

Instantly share code, notes, and snippets.

(ns datascript-to-datomic-util
(:require [datascript :as d]))
;;;; a utility to help with a datomic-datascript roundtrip process involving:
;;; 1. export some data from a datomic database and transact into a datascript instance.
;;; 2. perform one or more transactions against datascript.
;;; 3. transact the sum of all changes made against datascript back into datomic in a single tx
;;; this namespace contains two public functions:
;;; listen-for-changes: listen to datascript transactions and build up a record of changes
(ns com.x.aleph-test
(require [aleph.http :as http]
[manifold.deferred :as d]
[manifold.stream :as s]
[compojure.core :only [routes ANY GET PUT POST] :as compojure]
[compojure.handler :as handler]
[clj-http.client :as http-client]
))
(comment
@henryw-erudine
henryw-erudine / gist:614fee493d2e0535fd48
Last active August 29, 2015 14:07
datomic backreferences where iscomponent=true
(def uri "datomic:mem://my-db")
(d/create-database uri)
(def conn (d/connect uri))
(d/transact conn [
{:db/id #db/id [:db.part/db]
:db/ident :entity/name
:db/valueType :db.type/string
:db/isComponent true