datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
jeff tang 2020-06-18T16:23:09.093700Z

Hi, I noticed that datascript connections have additional key-values like

{
:schema {}
:eavt #{ }
:aevt #{ }
:avet #{ }
:max-eid 0
:max-tx 536870912
:rschema { }
:hash #object[cljs.core.Atom {:val 0}]
}
I’m able to access them with the keyword, but when I prn the connection, I only see
#datascript/DB{:schema {}},
               :datoms []}
Does this have something to do with the fact that datascript DBs are records?

lilactown 2020-06-18T16:42:16.094700Z

yeah, the db type has a custom IPrintWithWriter implementation which defines how its printed

lilactown 2020-06-18T16:43:43.096200Z

it doesn’t print what the actual object is - those are internal details - but rather an opaque description of what’s in the DB

lilactown 2020-06-18T16:44:26.097100Z

the nice thing about this is that datascript defines reader literals for #datascript/DB, so you can prn a DB and send it over a remote connection

lilactown 2020-06-18T16:44:44.097400Z

if it printed it’s internal structure, you probably couldn’t do that

jeff tang 2020-06-18T16:49:23.097700Z

wow, thanks so much @lilactown x2