-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.clj
20 lines (16 loc) · 821 Bytes
/
core.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(ns sqlforcql.core
(:require [sqlforcql.db :as db]
[sqlforcql.atoms :as atoms]))
(defn connect-to-default-db
"Connect to a Cassandra keyspace on a particular ip-address, with the given username and password, and store
this information in atoms/default-db-map map."
([] (connect-to-default-db "keyspace-name"))
([keyspace] (let [db-map (db/connect-to-db "localhost" "cassandra" "cassandra" keyspace)]
(reset! atoms/default-db-map db-map)))
([ip-address username password keyspace]
(let [db-map (db/connect-to-db ip-address username password keyspace)]
(reset! atoms/default-db-map db-map))))
(defn disconnect-from-default-db
"Disconnect from Cassandra using information stored in atoms/default-db-map map."
[]
(db/disconnect-from-db (deref atoms/default-db-map)))