datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
feelextra 2019-05-15T13:11:55.099Z

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?

2019-05-15T13:16:16.099900Z

It's still queryable, and you can maintain your own transaction log.

2019-05-15T13:16:39.100200Z

I'm sure it has more utility, but can't think atm

feelextra 2019-05-15T13:30:49.100500Z

@danielstockton thanks!

feelextra 2019-05-15T13:35:44.104100Z

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?

2019-05-15T13:36:57.104500Z

(pr-str @conn)

2019-05-15T13:37:05.104800Z

The conn is just an atom holding the db value

feelextra 2019-05-15T13:37:18.105200Z

ahh that makes sense 🙂

feelextra 2019-05-15T13:38:05.105600Z

yea that works just fine now, thanks again @danielstockton

1👍
lilactown 2019-05-15T15:14:17.106500Z

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

lilactown 2019-05-15T15:14:24.106700Z

I assume someone must have done this before?

chrstphrhrt 2019-05-15T17:25:52.107600Z

hey, just discovered datascript.. do people consider it a viable open source alternative to datomic?

2019-05-15T17:34:16.108200Z

It lacks persistence. Datahike is aiming to be more in that space.

1👀
2019-05-15T17:34:35.108700Z

Or, rather, lacks durability.

urzds 2019-05-15T19:04:40.109800Z

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?

kenny 2019-05-15T19:09:14.109900Z

No. Pretty easy to write a function that does this.