Hi!
When serializing a DataScript conn
with pr-str
I see that all :datoms
tuples have a fourth value 536870913
e.g. [3 :tag/name \"Clojure\" 536870913]
Since DataScript doesn't maintain a transaction log, is this just a placeholder value that has no use whatsoever?
It's still queryable, and you can maintain your own transaction log.
I'm sure it has more utility, but can't think atm
@danielstockton thanks!
Also https://github.com/tonsky/datascript/wiki/Tips-&-tricks#preserving-order
I have another question regarding serialization:
When I pr-str
an empty db it gives me a nice format:
(pr-str (d/empty-db))
; => "#datascript/DB {:schema {} :datoms[]}"
But when I serialize a conn
I get this format:
(pr-str conn)
; => "#object[cljs.core.Atom {:val #datascript/DB {:schema {...} :datoms [...]}}"
How can I serialize this Atom object with the first format?(pr-str @conn)
The conn is just an atom holding the db value
ahh that makes sense 🙂
yea that works just fine now, thanks again @danielstockton
I was actually wondering yesterday, since it maintains the txid, how hard it would be to create an as-of
function if you maintained timestamps of transactions
I assume someone must have done this before?
hey, just discovered datascript.. do people consider it a viable open source alternative to datomic?
It lacks persistence. Datahike is aiming to be more in that space.
Or, rather, lacks durability.
Hi! Is there a version of the .
operator to :find
that will blow up if more than one result was found instead of silently discarding every result but the first?
No. Pretty easy to write a function that does this.