tonsky / datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
Eclipse Public License 1.0
5.49k stars 309 forks source link

Handling of BigDecimal #466

Closed aiba closed 6 months ago

aiba commented 6 months ago

I wanted to add further clarification to the importance of #465, because I realized there was not already an open issue about it.

We have an application where the server (clj) wants to send a serialized datascript database to the client (cljs). The database contains values that are BigDecimals.

Currently, datascript treats number? the same way in clj and cljs, but clojurescript has no concept of a BigDecimal.

465 allows the freeze-fn and thaw-fn to handle BigDecimals. In our case, we have a cljs thaw-fn that decodes BigDecimal into decimal.js types, and this is working for us in our app.