Skip to content

Commit f91be0e

Browse files
committed
rename freeze to freeze!
1 parent 3b76580 commit f91be0e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ One important distinction from the Clojure atom is that inside a transaction (eg
152152
;; the fruits vector was mutated!
153153
```
154154

155-
If you want to prevent data from being mutated within a transaction, you must `freeze` it:
155+
If you want to prevent data from being mutated within a transaction, you must `freeze!` it:
156156

157157
```clojure
158158
(swap! db (fn [moment]
159159
(let [moment (assoc moment :fruits ["apple" "pear" "grape"])
160-
moment (assoc moment :food (xdb/freeze (:fruits moment)))
160+
moment (assoc moment :food (xdb/freeze! (:fruits moment)))
161161
moment (update moment :food conj "eggs" "rice" "fish")]
162162
moment)))
163163

src/xitdb/db.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
:else
232232
(throw (IllegalArgumentException. (str "xdb must be an instance of XITDBCursor or XITDBDatabase, got: " (type xdb))))))
233233

234-
(defn freeze
234+
(defn freeze!
235235
"Prevents all data written in the current transaction from
236236
being mutated by any remaining changes. Throws if called
237237
outside of a transaction. Returns a read-only version of the

test/xitdb/freeze_test.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(ns xitdb.freeze-test
2-
"Tests for the `freeze` function"
2+
"Tests for the `freeze!` function"
33
(:require
44
[clojure.test :refer :all]
55
[xitdb.db :as xdb]
@@ -26,7 +26,7 @@
2626

2727
(swap! db (fn [moment]
2828
(let [moment (assoc moment :fruits ["apple" "pear" "grape"])
29-
moment (assoc moment :food (xdb/freeze (:fruits moment)))
29+
moment (assoc moment :food (xdb/freeze! (:fruits moment)))
3030
moment (update moment :food conj "eggs" "rice" "fish")]
3131
moment)))
3232

@@ -55,7 +55,7 @@
5555

5656
(swap! db (fn [moment]
5757
(let [moment (assoc moment :fruits '("apple" "pear" "grape"))
58-
moment (assoc moment :food (xdb/freeze (:fruits moment)))
58+
moment (assoc moment :food (xdb/freeze! (:fruits moment)))
5959
moment (update moment :food conj "eggs" "rice" "fish")]
6060
moment)))
6161

@@ -84,7 +84,7 @@
8484

8585
(swap! db (fn [moment]
8686
(let [moment (assoc moment :fruits {:names ["apple" "pear" "grape"]})
87-
moment (assoc moment :food (xdb/freeze (:fruits moment)))
87+
moment (assoc moment :food (xdb/freeze! (:fruits moment)))
8888
moment (update-in moment [:food :names] conj "eggs" "rice" "fish")]
8989
moment)))
9090

@@ -113,7 +113,7 @@
113113

114114
(swap! db (fn [moment]
115115
(let [moment (assoc moment :fruits #{"apple" "pear" "grape"})
116-
moment (assoc moment :food (xdb/freeze (:fruits moment)))
116+
moment (assoc moment :food (xdb/freeze! (:fruits moment)))
117117
moment (update moment :food conj "eggs" "rice" "fish")]
118118
moment)))
119119

0 commit comments

Comments
 (0)