We're having success with the Datomic <-> Datascript scenario by treating the Datascript DB as an immutable value, rather than a ref + transactor, at least in the case for user's interactively changing data. When the user loads the data required for a scenario (e.g. editing an entity), we hold the value as obtained from datomic and the updated value used by applying user changes through the with or with-db functions. When the user chooses to commit, we essentially diff the sets of datoms between the original and changed Datascript values (twice - once to get adds and once for retracts), as well as identify the Datascript id's of added entities. On the server, the new Datascript id's are converted into Datomic temp id's, and we just transact the transformed diff.
There are some differences in behavior which need to be worked around, particularly the behavior of :db/ident. We strictly use :db/ident only for attribute names and enums. This allows us to do the appropriate transformations to the data and pull patterns so that the differences between Datascript and Datomic are more or less hidden. Works very well for editing hierarchical entities. The parent can simply pass it's Datascript value and the appropriate child id to the child editor. If the user commits the child changes, the parent simply takes the updated value of the db; if the user cancels, the parent doesn't need to do anything, as it is already holding the unchanged value. On Tuesday, February 17, 2015 at 2:00:03 AM UTC-8, henry w wrote: > > For anyone else looking at this option, here is some code which is doing > the work on the cljs side. > > https://gist.github.com/henryw-erudine/73cbcdea1eda150e78da > > The server code is straightforward so not included. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.