tonsky/datascript

`get-else` fails when passed a lookup.

jjttjj opened this issue · 0 comments

The datomic docs suggest any entity identifier is allowed for the entity argument passed to get-else. However in datascript an exception is thrown when a lookup vector is used.

(d/q
    '[:find ?maybe
      :in $ ?lookup
      :where [(get-else $ ?lookup ::number 0) ?maybe]]
    (d/db-with (d/empty-db {::id {:db/unique :db.unique/identity}})
      [{::id 123}])
    [::id 123])

Results in:

 ClassCastException class clojure.lang.PersistentVector cannot be cast to class java.lang.Number