[alekcz/konserve-jdbc "0.2.0-SNAPSHOT"]
(require '[konserve-jdbc.core :refer [new-jdbc-store]]
'[clojure.core.async :refer [<!!] :as async]
'[konserve.core :as k])
(def h2 { :dbtype "h2"
:dbname "./temp/konserve;DB_CLOSE_ON_EXIT=FALSE"
:user "sa"
:password ""})
(def mysql { :dbtype "mysql"
:dbname "konserve"
:host "localhost"
:user "konserve"
:password "password"})
(def pg { :dbtype "postgresql"
:dbname "konserve"
:host "localhost"
:user "konserve"
:password "password"})
(def h2-store (<!! (new-jdbc-store h2 :table "konserve")))
(def mysql-store (<!! (new-jdbc-store mysql :table "konserve")))
(def pg-store (<!! (new-jdbc-store pg :table "konserve")))
(<!! (k/exists? pg-store :cecilia)) ; => false
(<!! (k/get-in pg-store [:cecilia])) ; => nil
(<!! (k/assoc pg-store :cecilia {:name "cecilia"}))
(<!! (k/assoc-in pg-store [:cecilia :age] 28))
(<!! (k/get-in pg-store [:cecilia :age])) ; => 28
(<!! (k/update-in pg-store [:cecilia :age] inc))
(<!! (k/get pg-store :cecilia)) ; => {:name "cecilia", :age 29}
(defrecord Test [a])
(<!! (k/assoc pg-store :agatha (Test. 35)))
(<!! (k/get pg-store :agatha))
Copyright © 2020 Alexander Oloo
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.