Skip to content

Commit 070d928

Browse files
committed
add datomic without transactor
1 parent 7762f1f commit 070d928

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

datomic/assets/src/datomic.clj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(ns <<ns-name>>.datomic
2+
(:require [clojure.tools.logging :as log]
3+
[datomic.api :as d]
4+
[integrant.core :as ig]))
5+
6+
(defmethod ig/init-key :db.datomic/conn
7+
[_ {:keys [db-uri]}]
8+
(when (d/create-database db-uri)
9+
(log/info (str "Database " db-uri " created (didn't exist)")))
10+
(d/connect db-uri))
11+
12+
(defmethod ig/halt-key! :db.datomic/conn
13+
[_ conn]
14+
(d/release conn))

datomic/config.edn

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{:default
2+
{:require-restart? true
3+
:actions
4+
{:assets [["assets/src/datomic.clj" "src/clj/<<sanitized>>/datomic.clj"]]
5+
:injections
6+
[{:action :merge
7+
:path "resources/system.edn"
8+
:target []
9+
:type :edn
10+
:value
11+
{:db.datomic/conn
12+
#profile
13+
{:dev {:db-uri #or [#env DATOMIC_DB_URI "datomic:dev://localhost:4334/<<name>>"]}
14+
:test {:db-uri #or [#env DATOMIC_DB_URI_TEST "datomic:dev://localhost:4334/<<name>>_test"]}
15+
:prod {:db-uri #env DATOMIC_DB_URI}}}}
16+
17+
{:action :merge
18+
:path "deps.edn"
19+
:target [:deps]
20+
:type :edn
21+
:value {com.datomic/peer {:mvn/version "1.0.7075"}}}
22+
23+
{:action :append-requires
24+
:path "src/clj/<<sanitized>>/core.clj"
25+
:type :clj
26+
:value ["[<<ns-name>>.datomic]"]}]}}}

modules.edn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,7 @@
4444
:doc "adds support for kit-Hato HTTP client"}
4545
:kit/codox
4646
{:path "codox"
47-
:doc "adds support for codox"}}}
47+
:doc "adds support for codox"}
48+
:kit/datomic
49+
{:path "datomic"
50+
:doc "adds support for Datomic"}}}

0 commit comments

Comments
 (0)