This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-22
Channels
- # announcements (13)
- # babashka (22)
- # beginners (22)
- # biff (17)
- # calva (6)
- # clerk (20)
- # clj-kondo (25)
- # clj-together (5)
- # clj-yaml (20)
- # cljdoc (16)
- # cljs-dev (1)
- # clojure (42)
- # clojure-brasil (1)
- # clojure-europe (26)
- # clojure-nl (6)
- # clojure-norway (24)
- # clojure-turkiye (3)
- # clojure-uk (5)
- # clojurescript (37)
- # core-async (7)
- # core-logic (2)
- # datalevin (7)
- # datomic (43)
- # events (2)
- # fulcro (7)
- # gratitude (1)
- # hyperfiddle (7)
- # java (7)
- # jobs (3)
- # lsp (4)
- # off-topic (16)
- # pathom (18)
- # polylith (1)
- # portal (27)
- # reitit (4)
- # releases (3)
- # shadow-cljs (47)
- # tools-build (14)
- # tools-deps (16)
- # yamlscript (11)
From https://github.com/juji-io/datalevin/blob/c55574a8749eb5e4f787840301cede7b7f3f58dd/test/datalevin/test/pull_api.cljc#L547-L557, it seems like it should be, but I am not seeing it apply.
(defn effect
[x]
(prn x)
(:effect x))
=> user/effect
;; Actual
(d/pull db
'[{[:statement/effect :xform user/effect] [:effect]}]
31)
=> #:statement{:effect {:effect :allow}}
;; Expected
(d/pull db
'[{[:statement/effect :xform user/effect] [:effect]}]
31)
{:effect :allow}
=> #:statement{:effect :allow}
Interestingly, it actually will resolve the user/effect
function. If I pass an unresolvable symbol, I get the expected “Cannot resolve symbol” error.
looks like it doesn't work if cardinality is one,
(d/pull
(d/db-with (d/empty-db (str (java.nio.file.Files/createTempDirectory nil (into-array java.nio.file.attribute.FileAttribute [])))
{:statement/effect
{:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many}})
[{:statement/effect {:effect :allow}}])
[{[:statement/effect :xform (fn [x] (prn x) x)] [:effect]}]
1)
;; [{:effect :allow}]
=> #:statement{:effect [{:effect :allow}]}
vs:
(d/pull
(d/db-with (d/empty-db (str (java.nio.file.Files/createTempDirectory nil (into-array java.nio.file.attribute.FileAttribute [])))
{:statement/effect
{:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one}})
[{:statement/effect {:effect :allow}}])
[{[:statement/effect :xform (fn [x] (prn x) x)] [:effect]}]
1)
=> #:statement{:effect {:effect :allow}}
maybe this cond is exiting in an earlier branch for cardinality/one vs many?
https://github.com/juji-io/datalevin/blob/c55574a8749eb5e4f787840301cede7b7f3f58dd/src/datalevin/pull_api.cljc#L121