This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-15
Channels
- # adventofcode (121)
- # bangalore-clj (5)
- # beginners (46)
- # boot-dev (9)
- # cider (20)
- # cljs-dev (7)
- # cljsrn (1)
- # clojure (341)
- # clojure-austin (7)
- # clojure-greece (144)
- # clojure-india (3)
- # clojure-italy (5)
- # clojure-spain (1)
- # clojure-spec (34)
- # clojure-sweden (3)
- # clojure-uk (90)
- # clojurescript (24)
- # core-async (1)
- # core-logic (7)
- # cursive (108)
- # datascript (2)
- # datomic (39)
- # events (1)
- # fulcro (225)
- # graphql (8)
- # hoplon (86)
- # instaparse (12)
- # jobs-discuss (2)
- # jvm (4)
- # keechma (1)
- # lein-figwheel (2)
- # leiningen (12)
- # off-topic (26)
- # onyx (35)
- # other-languages (1)
- # pedestal (3)
- # planck (11)
- # re-frame (12)
- # reagent (12)
- # reitit (5)
- # spacemacs (48)
- # specter (29)
- # sql (2)
- # test-check (1)
- # unrepl (71)
Hello, I'm looking for a way to query an entity that is tagged as :db.unique/value. This value exists only once in the database and I hope I can query it without knowing the attribute name. In this example I only like to query it by an UUID, but I don't know whether it is a :one/v1 or a :another/v2. I tried to lookup it by [#uuid "59bbb1bb-7827-41e2-b213-db1d58ed9661"], but this doesn't work. Is it possible to lookup by a db.unique/value without an attribute name?
You can do [?attr :db/unique :db.unique/value]
or something like for optimal performance.
Thanks for the response. I will try it.
I changed it a little bit and now it works for me.
(query '[:find ?ident-key ?uuid
:in $ ?uuid
:where
[?attr :db/unique :db.unique/value]
[?e ?attr ?uuid]
[?attr :db/ident ?ident-key]]
[db uuid])
My goal is to prevent the transaction of data which would violate some user-specified constraints.
the body of the transaction should apply the transaction with d/with to the supplied db, then run validation. if validation fails, it should throw; otherwise it should return the transaction unchanged
and adds extra precondition checks to the submitted transaction to make sure nothing important changed by the time the transaction reached the transactor
So the original TX becomes something like, [:db.fn/doAndCheck [[:db/add ...] [:db.fn/retractEntity ...]]]]
the transactor is the only writer, so you are essentially locking the db while doAndCheck runs