This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-10
Channels
- # announcements (1)
- # babashka (44)
- # beginners (188)
- # calva (37)
- # chlorine-clover (28)
- # cider (12)
- # clj-kondo (40)
- # clojars (1)
- # clojure (323)
- # clojure-austin (7)
- # clojure-europe (20)
- # clojure-italy (4)
- # clojure-nl (16)
- # clojure-spec (7)
- # clojure-uk (37)
- # clojuredesign-podcast (1)
- # clojurescript (30)
- # cryogen (2)
- # cursive (30)
- # data-science (1)
- # datomic (26)
- # emacs (1)
- # events (1)
- # figwheel-main (13)
- # fulcro (89)
- # garden (1)
- # graalvm (20)
- # graphql (8)
- # jobs (1)
- # jobs-discuss (1)
- # joker (6)
- # kaocha (125)
- # lambdaisland (1)
- # meander (42)
- # off-topic (18)
- # pathom (3)
- # pedestal (6)
- # shadow-cljs (55)
- # spacemacs (21)
- # sql (18)
- # tools-deps (8)
- # uncomplicate (2)
- # vim (1)
- # yada (3)
Hello I'm trying to use datomic-connect-plugin But my parser just returns the data inserted after it's creation (it kind of snapshot my DB at de creation of the parser)
com.wsscode/pathom-datomic {:git/url ""
:sha "23e23ac8ae96dba5461cd020879d896c355f65d3"}
_
(let [parser-from-conn (fn [conn]
(p/parser {::p/env {::p/placeholder-prefixes #{">"}
::p/reader [p/map-reader
pc/reader2
pc/open-ident-reader
p/env-placeholder-reader]}
::p/mutate pc/mutate
::p/plugins [(pc/connect-plugin {::pc/register pcd/registry})
(pcd/datomic-connect-plugin (assoc on-prem-config ::pcd/conn conn))
p/error-handler-plugin
p/trace-plugin]}))
db-uri (doto (str "datomic:mem://" (UUID/randomUUID))
d/create-database)
tx-schema [{:db/ident :user/id
:db/unique :db.unique/identity
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :user/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}]
conn (d/connect db-uri)
_ @(d/transact conn tx-schema)
p1 (parser-from-conn conn)
tx-data [{:user/id "1"
:user/name "one"}]
{:keys [db-after]} @(d/transact conn tx-data)
p2 (parser-from-conn conn)
parser (juxt p1 p2)
query [{[:user/id "1"] [:user/name]}]]
{:without-db (parser {::pcd/conn conn
::p/entity {::pcd/conn conn}}
query)
:with-db-after (parser {::pcd/conn conn
::pcd/db db-after
::p/entity {::pcd/conn conn
::pcd/db db-after}}
query)})
=>
{:without-db [{[:user/id "1"] {:user/name :com.wsscode.pathom.core/not-found}} {[:user/id "1"] {:user/name "one"}}],
:with-db-after [{[:user/id "1"] {:user/name :com.wsscode.pathom.core/not-found}} {[:user/id "1"] {:user/name "one"}}]}
yeah, the DB is kind static on that sense, I have not got to this point, but I think its an important one to tackle, can you open an issue on pathom-datomic to keep track of it?
👍 8