Skip to content

Commit

Permalink
Merge pull request #43 from sol-sh/set
Browse files Browse the repository at this point in the history
add set to the batch-read rec
  • Loading branch information
barkanido authored Sep 2, 2020
2 parents 9bb241e + 22b040d commit 2704149
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject aerospike-clj "1.0.0"
(defproject aerospike-clj "1.0.1-SANPSHOT"
:description "An Aerospike Clojure client."
:url "https://github.com/AppsFlyer/aerospike-clj"
:license {:name "Eclipse Public License"
Expand Down
8 changes: 5 additions & 3 deletions src/main/clojure/aerospike_clj/client.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[com.aerospike.client.async EventLoop NioEventLoops EventLoops]
[com.aerospike.client.policy Policy BatchPolicy ClientPolicy RecordExistsAction WritePolicy ScanPolicy InfoPolicy]
[com.aerospike.client.cluster Node]
[com.aerospike.client Key]
[aerospike_clj.listeners AsyncExistsListener AsyncDeleteListener AsyncWriteListener
AsyncInfoListener AsyncRecordListener AsyncRecordSequenceListener AsyncBatchListListener
AsyncExistsArrayListener]
Expand Down Expand Up @@ -146,9 +147,10 @@
(Bin/asNull bin-name))

(defn- batch-read->map [^BatchRead batch-read]
(assoc (record/record->map (.record batch-read))
:index
(.toString (.userKey (.key batch-read)))))
(let [^Key key (.key batch-read)]
(-> (record/record->map (.record batch-read))
(assoc :index (.toString (.userKey key)))
(assoc :set (.setName key)))))

(def ^:private x-bin-convert
(comp
Expand Down
4 changes: 3 additions & 1 deletion test/aerospike_clj/client_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@
{:index "not there" :set _set}]
res @(client/get-batch *c* brs)]
(is (= [data data2 nil data3 nil] (mapv :payload res)))
(is (= [1 1 nil 1 nil] (mapv :gen res))))))
(is (= [1 1 nil 1 nil] (mapv :gen res)))
(is (= [k k2 k2 k3 "not there"] (mapv :index res)))
(is (= [_set _set2 _set _set _set] (mapv :set res))))))

(deftest exists-batch
(let [k (random-key)
Expand Down

0 comments on commit 2704149

Please sign in to comment.