datascript

Jack Park 2021-10-21T22:01:25.003200Z

I am looking at some datoms made by Datascript inside Athens. I'd like some help decoding them: [1,"^:",2,536870913]], ["^@",[1,"^:",3,536870913]], ["^@",[1,"^:",5,536870913]], ["^@",[1,"^:",44,536870913]], ["^@",[1,"^3","0",536870913]], ["^@",[1,"^6","Welcome",536870913]], ["^@",[1,"~:page/sidebar",999,536870913]], ["^@",[2,"~:block/open",true,536870913]], ["^@",[2,"~:block/order",0,536870913]], ["^@",[2,"~:block/string","Welcome to Athens, Open-Source Networked Thought!",536870913]], ["^@",[2,"^3","ee770c334",536870913]], I gather that the last number is the transaction timestamp. What is curious is the emergence of the list element "^@"; the rest seem to be E, A, and V, though the "^3" and others like that don't make sense on the A value. I'm guessing that the ^@ is the added? marker?

pithyless 2021-10-23T10:32:31.004100Z

@jackpark996 you can use datascript.transit/read-transit-str to get back an EDN structure; alternatively sometimes https://github.com/borkdude/jet is useful to jump between edn/json/transit

pithyless 2021-10-23T10:33:28.004500Z

Athens stores its Datascript DB in storage as transit: https://github.com/athensresearch/athens/blob/e2c953b5c2bc9257939784499b0755c81b89c89b/src/cljs/athens/electron.cljs#L80-L81

pithyless 2021-10-23T10:37:00.004900Z

and you may also be interested in this: https://github.com/tonsky/datascript-transit/blob/master/src/datascript/transit.cljs#L23-L25 - the library stores data as [e a v tx (optional added?)]

Jack Park 2021-10-24T00:43:27.005300Z

Ok. It's transit. Studying the docs to figure out the added symbol. Thanks!

zane 2021-10-21T22:06:43.003300Z

I don’t have an answer for you here, but I bet the folks in the Athens Discord would gladly help you out with this.

2021-10-21T22:38:25.003500Z

Looks like it might be transit, but I'm not 100% sure https://github.com/cognitect/transit-clj

Jack Park 2021-10-21T23:18:41.003900Z

could well be transit - Athens uses datsync which uses transit. Thanks!