samedhi / firemore

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

How do we support batch writes? #36

Closed samedhi closed 4 years ago

samedhi commented 4 years ago

Firestore has the ability to do batch writes, what would the syntax for doing this be in firemore?

Maybe works like assoc allows an arbitrary number of reference doc pairs to the writing function? If only one is specified then it just does a normal write, if multiple are specified then it does a batch write of all of them

samedhi commented 4 years ago

With a macro that looks like

(batch 
   (write! ...)
   (merge! ...)
   (delete! ...))

Also returns a channel just like other write functions. Difference is that it puts a vector of errors (or docs, if we are doing that) rather than a single map. Then the channel is closed.

samedhi commented 4 years ago

Just pointing out that right now you can do batch writes by just doing transactions...

samedhi commented 4 years ago

Implemented batch support with the "add-batch" branch