-
Notifications
You must be signed in to change notification settings - Fork 10
/
repl.clj
32 lines (24 loc) · 892 Bytes
/
repl.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(ns bridge.dev.repl
(:require [bridge.config :as config]
[bridge.data.datomic :as datomic]
[integrant.core :as ig]))
(defn set-datomic-mode! [mode]
(alter-var-root (var datomic/*DATOMIC-MODE*) (constantly mode)))
(defn conn []
(when (nil? datomic/*DATOMIC-MODE*)
(throw (ex-info (str "Set `bridge.data.datomic/*DATOMIC-MODE*` first."
"You can use `bridge.dev.repl/set-datomic-mode!` "
"to do so at the repl.")
{})))
(-> (ig/init-key :datomic/connection
(-> (:datomic/connection (config/system))
(assoc :datomic/mode datomic/*DATOMIC-MODE*)))
:datomic/conn))
(defn db []
(datomic/db (conn)))
(comment
(set-datomic-mode! :client)
(set-datomic-mode! :peer)
(conn)
(datomic/pull (db) '[*] [:person/email "test@cb.org"])
)