datascript icon indicating copy to clipboard operation
datascript copied to clipboard

:db.fn/call behavior

Open souenzzo opened this issue 5 years ago • 2 comments

On datomic, when we call a "transaction function", the db that this function receive is the db before all transaction

In datascript 1.0.1, it receive a "partial db" relative to it's position in transaction

This behavior should be documented ?!

(let [conn (ds/create-conn)]
  (ds/transact! conn [[:db.fn/call println]
                      {:a 42}
                      [:db.fn/call println]
                      {:b 24}
                      [:db.fn/call println]]))
=>
#datascript/DB {:schema nil, :datoms []}
#datascript/DB {:schema nil, :datoms [[1 :a 42 536870913]]}
#datascript/DB {:schema nil, :datoms [[1 :a 42 536870913] [2 :b 24 536870913]]}

souenzzo avatar Sep 30 '20 03:09 souenzzo

Yes. Are you willing to provide a PR for e.g. README.md?

tonsky avatar Sep 30 '20 10:09 tonsky