I program mostly in Node, and like document stores, but I'd like to prototype the data calls between the client and the server first. I've used lowdb and da-base in the past to setup a quick Json data store. Is there something similar for Clojure?
Given that you are just prototype, if you don't need durability, a simple atom will do. If you want durability using simple files have a look at https://github.com/alandipert/enduro
You can have one atom per table or you can have an atom with a map of table->docs, whatever you find simpler. Any query will just be a filter.
For example, to add a document:
(def my-db (atom {}))
(defn add [table doc] (swap! my-db update-in [table] conj doc))
(defn search-by-name [table name]
(filter #(= name (:name %)) (get @my-db table)))
Datascript seems like a perfect (though poorly named) fit for your needs. Basically, it's a lightweight in-memory store designed after Datomic. With a map-in-an-atom approach you very quickly would find yourself writing quirky code for selection, id management, etc. Datascript takes care of such stuff and allows you to write complex queries easily, still being almost as lightweight as a map in an atom.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With