Latin word for
warehouse
,room
,cellar
,granary
orloft
.
Wrapper for WatermelonDB in React Native.
Using the API directly with promises.
(:require [cella.connection :as cella])
(def database (cella/connect {:db-name "my-db-name"
:tables [{:name "users"}]}))
(-> database
(cella/run [[:table :users]
[:insert {:id "user/abc"}]])
(j/call :then #(js/console.log "added user/abc"))
(j/call :catch #(js/console.error "an error occurred" %)))
(-> database
(cella/run [[:table :users]])
(j/call :then #(cljs.pprint/pprint {:users %})))
re-frame integration
(:require [re-frame.core :as rf])
@(rf/subscribe [:cella/subscribe
[[:table :users]]])
@(rf/subscribe [:cella/subscribe
[[:table :users]
[:get "user/abc"]]])
(rf/dispatch
[:cella/run
[[:table :users]
[:insert {:id "user/abc"}]]])
(rf/dispatch
[:cella/run
[[:table :users]
[:get "user/abc"]
[:update {:name "ABC"}]]])
(rf/dispatch
[:cella/run
[[:table :users]
[:upsert {:id "user/abc"
:name "ABC_DEF"}]]])
(rf/dispatch
[:cella/run
[[:table :users]
[:get "user/abc"]
[:delete]]])
Copyright © 2021 7theta
Can you improve this documentation? These fine people already did:
Tom Goldsmith, Tom & Achint SandhuEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close