This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-10
Channels
- # announcements (3)
- # architecture (54)
- # babashka (11)
- # beginners (12)
- # calva (5)
- # clj-on-windows (1)
- # cljdoc (2)
- # cljs-dev (1)
- # cljsrn (6)
- # clojure (130)
- # clojure-europe (8)
- # clojurescript (21)
- # conjure (23)
- # core-async (4)
- # datomic (7)
- # depstar (77)
- # events (1)
- # fulcro (27)
- # lsp (88)
- # malli (5)
- # meander (1)
- # off-topic (4)
- # pathom (43)
- # polylith (39)
- # re-frame (9)
- # shadow-cljs (14)
- # timbre (3)
- # tools-deps (53)
Does Datomic Ions have lifecycle hooks? I want to manage a DB connection pool and external services with system start or halt events. I canโt see anything in the documentation. How do I do this?
Is it possible to pass a pull pattern as an input to a query? For example this works:
(def p '*)
(d/pull (d/db conn) [p] 1)
And I'm trying to achieve something similar here:
(d/q '[:find (pull ?e [?p])
:in $ ?e ?p
:where
[?e :db/ident _]]
(d/db conn) 1 '*)
But getting:
Execution error (Exceptions$IllegalArgumentExceptionInfo) at datomic.error/arg (error.clj:79). :db.error/invalid-attr-spec Attribute identifier ?p of class: class java.lang.String does not start with a colon
It's the same error when I try passing a keyword attribute or a the wildcard as a string "*".Can you try this:
(d/q '[:find (pull ?e p)
:in $ ?e p
:where
[?e :db/ident _]]
(d/db conn) 1 '[*])
Actually I tried this version too, but with ?p. I didn't realize that question mark is not only a convention but it's interpreted in a different way in the queries.
Yup this was confusing and I'm not a 100% sure why that is.
I think this is because ?
symbol is for variables which the query engine must substitute for running the queries. But a pull-pattern is fixed and it doesn't make sense that the query engine should go and replace it.
But that's just a guess, if someone can chime in and clear this up it would be super helpful!