datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
2020-07-31T09:35:53.113300Z

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

2020-07-31T09:36:02.113500Z

Something like two transactions ago?

2020-07-31T17:55:06.114100Z

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

2020-07-31T17:56:45.115900Z

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.

2020-07-31T17:57:37.116800Z

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

2020-07-31T17:59:02.118100Z

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.

2020-07-31T17:59:58.118700Z

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.

2020-07-31T18:02:06.120300Z

More straightforward: just write a couple of api functions for abstracting over all of this (`http://my.wild.app/transact`, etc)

👍 1
lilactown 2020-07-31T23:45:42.123900Z

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
 }
?