This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-24
Channels
- # announcements (13)
- # asami (9)
- # aws (3)
- # babashka (13)
- # babashka-sci-dev (7)
- # beginners (32)
- # calva (59)
- # cider (9)
- # clj-kondo (5)
- # cljsrn (14)
- # clojure (98)
- # clojure-brasil (5)
- # clojure-dev (1)
- # clojure-europe (30)
- # clojure-france (12)
- # clojure-nl (1)
- # clojure-norway (7)
- # clojure-uk (7)
- # clojurescript (20)
- # conjure (2)
- # datahike (7)
- # datalog (38)
- # datomic (29)
- # events (1)
- # fulcro (72)
- # graalvm (1)
- # gratitude (3)
- # helix (7)
- # honeysql (3)
- # improve-getting-started (2)
- # introduce-yourself (1)
- # leiningen (13)
- # lsp (17)
- # malli (11)
- # meander (8)
- # nextjournal (3)
- # off-topic (5)
- # pathom (2)
- # portal (43)
- # rdf (2)
- # re-frame (8)
- # reagent (7)
- # reitit (1)
- # shadow-cljs (27)
- # spacemacs (31)
- # sql (2)
- # tools-deps (3)
- # vim (1)
- # xtdb (12)
It isn't clear to me from https://github.com/quoll/asami/wiki/4.-Transactions#temporary-ids whether temporary IDs must be negative longs or what are the requirements. Anyone knows? 🙏
thx! Have mentioned that in the wiki
When the transaction process sees a negative integer as an ID, it allocates a new node, and maps that number to the node. Thereafter, if it sees that number again, it knows that you're looking for that node. At the end of the transaction, one of the things returned is a map of those negative numbers to the nodes that were allocated for them
Perhaps this is a dumb question but if a transaction creates a new entity and also wants to add a reference to it to another entity, how does Asami know - in the face of having not schema - that the reference attribute value is actually a reference and not just a value? Does it automatically interet something like {:db/ident -1}
as a reference and replaces it with the actual entity id? Example:
{:tx-data [[-1 :child/name "Joe"]
[-1 :child/age 0]
[#a/n 12 :parent/children {:db/ident -1}]]} ; <-- how to refer to the new child?
🙏
I guess I cannot just [#a/n 12 :parent/children -1]]
because Asami cannot know that I mean a reference to an entity and not just a negative integer value.This is true, but I decided to leave the ambiguity because it's:
• often useful to refer to things this way
• There is an alternative that can be used when values don't work for you.
• It continues to look like Datomic by allowing negative numbers to make references like this.
Note in your example, it should be {:db/id -1}
and not :db/ident
Also, while I think that {:db/id -1}
works (I haven't looked for a while), you should also be able to use node refs, which is [:db/id -1]