Liking cljdoc? Tell your friends :D

com.7theta/cella-rn

Latin word for warehouse, room, cellar, granary or loft.

Current Version GitHub license Circle CI Dependencies Status

Wrapper for WatermelonDB in React Native.

Usage

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 and License

Copyright © 2021 7theta

Can you improve this documentation? These fine people already did:
Tom Goldsmith, Tom & Achint Sandhu
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close