fixed, get would fail when key doesn't exist
Former-commit-id: 83ab6ad3ef
This commit is contained in:
parent
85f7a08380
commit
b27e47a91f
|
@ -55,8 +55,8 @@
|
|||
(-> (aget result 0)))
|
||||
|
||||
(defn single-cljs [result]
|
||||
(-> (aget result 0)
|
||||
(js->clj :keywordize-keys true)))
|
||||
(some-> (aget result 0)
|
||||
(js->clj :keywordize-keys true)))
|
||||
|
||||
(defn decode-value [{:keys [key value]}]
|
||||
(read-string value))
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
(r/create :kv-store {:key key
|
||||
:value (str value)} true))))
|
||||
(get [_ key]
|
||||
(-> (r/get-by-field :kv-store :key key)
|
||||
(r/single-cljs)
|
||||
(r/decode-value)))
|
||||
(some-> (r/get-by-field :kv-store :key key)
|
||||
(r/single-cljs)
|
||||
(r/decode-value)))
|
||||
(contains-key? [_ key]
|
||||
(= 0
|
||||
(.-length (r/get-by-field :kv-store :key key))))
|
||||
|
@ -23,4 +23,4 @@
|
|||
|
||||
(comment
|
||||
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue