Re:Show HN: Biff – Self-hosted Firebase alternative for Clojure
by jacobobryant on Wednesday July 22, 2020 @07:22PM
(#23922646)
Are you concerned about that for performance reasons or for ease-of-use reasons? To address the latter, I made a separate transaction format for Biff that allows merging (it's similar to Firebase's transaction format). So e.g.
gets converted to
There is a race condition though; if another tx updated that document after the crux/entity call but before `:username "foo"` was written, then that tx would get clobbered. I'm planning to add `:crux.tx/match` operations automatically to prevent that from happening. There was talk on #crux in Clojurians slack today of using the newly-added transaction function feature to do merges. Haven't looked into that myself.
[ Parent
| on HN ]
Re:Show HN: Biff – Self-hosted Firebase alternative for Clojure
by dorian-graph on Wednesday July 22, 2020 @07:45PM
(#23922768)
Just for ease-of-use. In Datomic/Datahike you can update a single datom/fact. I'll have to look into making some similar sort of helpers for what you've done.
Re:Show HN: Biff – Self-hosted Firebase alternative for Clojure
by ribelo on Thursday July 23, 2020 @02:10AM
(#23924622)
https://opencrux.com/docs#_transaction_functions
```
(crux/submit-tx node
[[:crux.tx/put
{:crux.db/id :crux.fn/assoc
:crux.db/fn
'(fn [ctx eid k v]
(let [db (crux.api/db ctx)
entity (crux.api/entity db eid)]
[[:crux.tx/put (assoc entity k v)]]))}]])
(crux/submit-tx [[:crux.tx/fn :crux.fn/assoc doc-id k v]]) ```