Fork me on GitHub
#datascript
<
2020-06-18
>
jeff tang16:06:09

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?

lilactown16:06:16

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

lilactown16:06:43

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

lilactown16:06:26

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

lilactown16:06:44

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

jeff tang16:06:23

wow, thanks so much @lilactown x2