datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
mathpunk 2021-06-27T19:41:46.011100Z

I'm trying to read someone else's serialization of some datascript and I don't really know how reader functions work. I think I'm supposed to be able to do this w/o error:

(edn/read-string {:readers {datascript/Datom datascript.db/datom-from-reader
                            datascript/DB    datascript.db/db-from-reader}} "#datascript/DB {:schema {} :datoms[]}")

Linus Ericsson 2021-07-03T14:22:33.013900Z

Chances are they are using https://github.com/tonsky/datascript-transit

1
mathpunk 2021-06-27T19:42:42.012Z

but those names aren't found and I'm not sure if it's because I'm making a newbie mistake with data-readers, a newbie mistake with requiring namespaces, or these names are no longer correct

quoll 2021-06-27T20:04:00.012600Z

you need to quote the keys in that map

quoll 2021-06-27T20:04:29.013100Z

So that they’re namespaced symbols:

(edn/read-string {:readers {'datascript/Datom datascript.db/datom-from-reader
                            'datascript/DB    datascript.db/db-from-reader}} "#datascript/DB {:schema {} :datoms[]}")

mathpunk 2021-06-28T20:10:30.013400Z

it looks like a great answer that i won't have time to validate right now but i will. thank you!

mathpunk 2021-07-04T19:40:23.015500Z

:thumbsup::skin-tone-2: 🎉

quoll 2021-06-27T20:15:12.013200Z

sorry if that’s an abrupt answer. I’m a bit tired. I hope it helped though