Fork me on GitHub
#datomic
<
2020-08-12
>
souenzzo13:08:28

Datomic Team There is a issue/tracker for this issue?

(let [db-uri (doto (str "datomic:mem://" (d/squuid))
               d/create-database)
      conn (d/connect db-uri)
      db (d/db conn)]
  (first (d/index-pull db
                       {:index    :avet
                        :start    [:db/txInstant]
                        :reverse  true
                        :selector '[(:db/id :as :not-id :xform clojure.edn/read-string)]})))
selector :as do not work on :db/id, in any context (pull, query-pull, index-pull)... PS: :db/id do not respect ANY param. xform also not work with it.

kenny00:08:43

I opened a support ticket for this as well. I suggest doing the same so they know there’s interest in getting this fixed.

me126020:08:51

I'm trying to transact a :db/fn via a custom client that works from javascript, but I'm struggling to get the schema right. I keep getting an error:

Value {:lang :clojure, :params [db eids pull-expr], :code "(map eids (fn [eid] (datomic.api/pull db pattern eid)))", :imports [], :requires []} is not a valid :datomic/fn for attribute :db/fn

favila20:08:55

You should show your code, but it sounds like you are transactions a map instead of a d/function object

favila20:08:33

You can make one either with d/function or the #db/fn reader literal

me126020:08:40

Yes, I’m transacting a map, I assumed that’s how transit serialized the d/function object. The issue is that I’m doing this from a javascript library that doesn’t have access to d/function, on the transit level how is this object serialized? (using this from javascript is obviously non-standard, but necessary for my org)

favila20:08:01

I missed that you were using a custom client

favila20:08:27

You control all of this, so whatever you are doing is what you are doing :)

favila20:08:53

But when you call d/transact, you need a function object

favila20:08:54

It’s unclear to me how you made a d/function object from JavaScript?

me126023:08:39

I ended up just shifting to putting the txfns in the datomic install classpath

me126020:08:10

It's not clear what's missing to correctly transact this function, using the on-prem obviously. Any ideas?