Fork me on GitHub
David Pham09:07:53

Is there a way to have historical version of the database in datascript?

David Pham09:07:02

Something like two transactions ago?


Datascript Databases are persistent datastructures, just like regular ol clojure data


So if you take d1 , use (d/with-tx ...) (or whatever; forget the exact function), you get a new db d2 which shared structure with d1 , but remains a separate referenceable value.


Datascript conn s are just simple atom containers with just a bit of extra metadata.


It doesn't do any historical tracking other than what an atom would do. But you could easily come up with your own state management that kept references to snapshots on whatever basis you like.


If you got fancy enough, you might even be able to bake it into a regular conn atom's metadata, the way that posh does.


More straightforward: just write a couple of api functions for abstracting over all of this (``, etc)

👍 3

is it possible to transact something like:

{::folder/id "asdf"
 ::folder/parent "jkl"}

{::folder/id "jkl"
 ::folder/children [,,,] ;; something that will associate anything that declares "jkl" as a parent