This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-18
Channels
- # adventofcode (12)
- # asami (2)
- # babashka (95)
- # beginners (17)
- # biff (5)
- # calva (1)
- # clojure (90)
- # clojure-europe (15)
- # clojure-nl (1)
- # clojure-norway (8)
- # clojure-uk (6)
- # clojuredesign-podcast (2)
- # clojurescript (34)
- # clr (1)
- # community-development (42)
- # cursive (11)
- # data-science (1)
- # datomic (13)
- # graalvm (5)
- # hoplon (2)
- # hyperfiddle (32)
- # off-topic (1)
- # pathom (6)
- # releases (1)
- # shadow-cljs (25)
- # squint (4)
- # xtdb (10)
Hi, maybe someone can give me a hint. Need to load a list of conversations and the text and the time of the last message in that conversation:
(d/q '[:find ?c (max ?message-time)
:in $
:where
[?m :message/parent-id ?c]
[?m :message/sent-at ?message-time]
]
db)
This works, but I cannot load also the :message/text for that last message.(d/q '[:find ?c (max ?message-time+m+text)
:in $
:where
[?m :message/parent-id ?c]
[?m :message/sent-at ?message-time]
[?m :message/text ?text]
[(tuple ?message-time ?m ?text) ?message-time+m+text]
db)
Consider getting the text in a second query, it might be faster if there is IO or memory pressure to get that text
(d/q '[:find ?c (max ?message-time+m)
:in $
:where
[?m :message/parent-id ?c]
[?m :message/sent-at ?message-time]
[(tuple ?message-time ?m) ?message-time+m]
db)
(d/q '[:find ?c ?m ?message-time ?message-text)
:in $ [[?c ?message-time+m]] ; result of previous query
:where
[(untuple ?message-time+m) [?message-time ?m]]
[?m :message/text ?text]]
db)