This will produce two different ids, which is great:
#db/id[:db.part/user]
#db/id[:db.part/user]
but anything like the following (I tried a lot of ideas so far) will produce the same id twice, which is not what I want:
(repeatedly 2 (fn [] #db/id[:db.part/user]))
(for [n [1 2]] #db/id[:db.part/user])
All yield something like
(#db/id[:db.part/user -1000774] #db/id[:db.part/user -1000774])
where the number produced is the same for each call.
What I actually want is for the calls to NOT produce a number at all, so that I can just add the produced data via a transaction.
Any ideas?
Just to be clear, the documentation says, "Each call to tempid produces a unique temporary id."
[Edited after comment by @maxthoursie that repeat
would be having this problem in any case.]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…