I would like to use datom literals in testing. But the reader throws. Here what I experience at the repl:
(let [conn (ds/create-conn {})
result (ds/transact! conn [{:name "Maksim"}])]
(:tx-data result))
=> [#datascript/Datom [1 :name "Maksim" 536870913 true]]
Eval this in repl or test right hand side.
=> Syntax error (IllegalArgumentException) compiling fn* at (src/core.clj:0:0).
No matching field found: idx for class datascript.db.Datom
Funnily this works:
(read-string "[#datascript/Datom [1 :name \"Maksim\" 536870913 true]]")
=> [#datascript/Datom [1 :name "Maksim" 536870913 true]]
Why can I read it with read-string but not with the repl reader?
*data-readers*
=> {datascript/Datom #'datascript.db/datom-from-reader,
datascript/DB #'datascript.db/db-from-reader
...}Looks like you found a bug! https://clojure.atlassian.net/jira/software/c/projects/CLJ/issues/CLJ-2904
Wow! I didn't see that one coming! Thanx!!!!
I just ran into this as well