samedhi / firemore

Firebase + Clojure -> Firemore
https://firemore.org/
MIT License
19 stars 3 forks source link

Add watch and unwatch methods #63

Closed samedhi closed 4 years ago

samedhi commented 4 years ago

Currently there is hydrator add! and subtract!. I am changing their name to watch and unwatch respectively. One of the big goals here is to align the reference (the location in firestore) with the path (the location in your clients application). Currently the code to add and subtract has a kind of complex notion of a prefix for both :firemore & :firestore that is a bit complicated.

;; THE BIG IDEA

;; [:cities "SF"] ;; [:cities {}] ;; [:cities {:where [[:population "<=" (* 1000 1000)]]}]

;; (add app-db [:cities {:where [[:favorite? "=" true]]}]) ;; => app-db looks like ;; {:cities ;; {{:where [[:favorite? "=" true]]} [ ]}}

;; (add app-db [:cities {:where [[:favorite? "=" true]]}] [:favorite-cities]) ;; => app-db looks like ;; {:favorite-cities [ ]}

;; Dealing with a atom (Reagent): ;; (watch! ratom ) OR (add! ratom )