-
Notifications
You must be signed in to change notification settings - Fork 9
/
key_selector.clj
49 lines (35 loc) · 1.33 KB
/
key_selector.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(ns me.vedang.clj-fdb.key-selector
(:refer-clojure :exclude [key])
(:import
(com.apple.foundationdb
KeySelector)))
(defn last-less-than
"Creates a KeySelector that picks the last key less than the parameter"
[^"[B" key]
(KeySelector/lastLessThan key))
(defn last-less-or-equal
"Returns a KeySelector that picks the last key less than or equal to the parameter."
[^"[B" key]
(KeySelector/lastLessOrEqual key))
(defn first-greater-than
"Creates a KeySelector that picks the first key greater than the parameter"
[^"[B" key]
(KeySelector/firstGreaterThan key))
(defn first-greater-or-equal
"Creates a KeySelector that picks the first key greater than or equal to the parameter"
[^"[B" key]
(KeySelector/firstGreaterOrEqual key))
(defn add
"Returns a new KeySelector offset by a given number of keys from this one.
https://apple.github.io/foundationdb/developer-guide.html#key-selectors."
[^KeySelector key-selector offset]
(.add key-selector offset))
(defn get-key
"Returns a copy of the key that serves as the anchor for this KeySelector.
This is not the key to which this KeySelector would resolve to."
[^KeySelector key-selector]
(.getKey key-selector))
(defn get-offset
"Returns the key offset parameter for this KeySelector."
[^KeySelector key-selector]
(.getOffset key-selector))