Skip to content

Commit

Permalink
Merge pull request #21 from replikativ/20-add-store-identity-protocol
Browse files Browse the repository at this point in the history
chore: add store-identity protocol, bump deps.
  • Loading branch information
whilo authored Mar 20, 2023
2 parents 05c1b05 + b6260e7 commit d7609c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{:deps {org.clojure/clojure {:mvn/version "1.10.3" :scope "provided"}
io.replikativ/superv.async {:mvn/version "0.2.11"}
{:deps {org.clojure/clojure {:mvn/version "1.11.1" :scope "provided"}
io.replikativ/konserve-jdbc {:mvn/version "0.1.1"}}
:paths ["src"]
:aliases {:test {:extra-paths ["test"]
Expand Down
8 changes: 7 additions & 1 deletion src/datahike_jdbc/core.clj
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
(ns datahike-jdbc.core
(:require [datahike.store :refer [empty-store delete-store connect-store default-config config-spec release-store]]
(:require [datahike.store :refer [empty-store delete-store connect-store default-config config-spec release-store store-identity]]
[datahike.config :refer [map-from-env]]
[konserve-jdbc.core :as k]
[clojure.spec.alpha :as s]))

(defmethod store-identity :jdbc [store-config]
(let [{:keys [jdbcUrl dbtype host port dbname]} store-config]
(if jdbcUrl
[:jdbc jdbcUrl]
[:jdbc dbtype host port dbname])))

(defmethod empty-store :jdbc [store-config]
(k/connect-store store-config))

Expand Down

0 comments on commit d7609c8

Please sign in to comment.