Skip to content

Instantly share code, notes, and snippets.



Created Dec 29, 2016
What would you like to do?
realm example in clojurescript
(def Realm (js/require "realm"))
;; define dog schema
(def dog {:name "Dog"
:properties {:name "string"
:age "int"}})
;; instantiate Realm with the dog schema
(def r (Realm. (clj->js {:schema [dog]})))
;; create a new puppy
(.write r (fn []
(.create r "Dog" (clj->js {:name "Rex" :age 3}))))
;; get all dogs
(let [all-dogs (.objects r "Dog")]
(println all-dogs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment