-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
bugSomething isn't workingSomething isn't working
Description
The problem @isaksky (🙏 ) raised on slack involves duplication in the tracked :added
/ :deleted
vectors.
I think :added
& :deleted
might want to be sets as duplicates during flow are permitted, unless there is some otherway to distinct the adds during tracking.
(let [num-schema [[:from :nums]
[:constrain
[:check [number? :n]]
[:unique :id]]]
watched-query (into num-schema
[[:where [= :id 1]
;; Try removing this form, the second entry in the result vector does not appear without it
[< 1 [rel/env :now]]]
[:extend
[:hm [- :n [rel/env :now]]]]])
db (-> (rel/transact {}
(for [i (range 1 1e2)]
[:insert :nums {:id i, :n i}]))
(rel/with-env {:now (inst-ms (java.time.Instant/now))})
(rel/mat num-schema)
(rel/watch watched-query))]
(->> (get-in
(rel/track-transact
db
(rel/set-env-tx {:now (+ (inst-ms (java.time.Instant/now)) 5)}))
[:changes watched-query :added])))
;; =>
[{:id 1, :n 1, :hm -1701901820800} {:id 1, :n 1, :hm -1701901820800}]
isaksky
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Projects
Milestone
Relationships
Development
Select code repository
Activity