From b6260e7740e4c25bfece16c997da30c18f75c054 Mon Sep 17 00:00:00 2001 From: Christian Weilbach Date: Wed, 15 Mar 2023 13:25:19 -0700 Subject: [PATCH] Add store-identity protocol, bump deps. --- deps.edn | 3 +-- src/datahike_jdbc/core.clj | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/deps.edn b/deps.edn index 65feab4..e9a9c3c 100644 --- a/deps.edn +++ b/deps.edn @@ -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"] diff --git a/src/datahike_jdbc/core.clj b/src/datahike_jdbc/core.clj index 825462f..c716db7 100644 --- a/src/datahike_jdbc/core.clj +++ b/src/datahike_jdbc/core.clj @@ -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))