Consider exclusive Range for Jedis Stream range/pending commands.

We now consider Bound.exclusive(…) for XRANGE, XREVRANGE and XPENDING commands through Jedis.

Closes: #2044
Original Pull Request: #2108
This commit is contained in:
Mark Paluch
2021-06-30 14:46:21 +02:00
committed by Christoph Strobl
parent bdd6cee61c
commit 085aca9f60
3 changed files with 59 additions and 23 deletions

View File

@@ -63,21 +63,20 @@ class StreamConverters {
}
static String getLowerValue(Range<String> range) {
if (range.getLowerBound().equals(Range.Bound.unbounded())) {
return "-";
}
return range.getLowerBound().getValue().orElse("-");
return getValue(range.getLowerBound(), "-");
}
static String getUpperValue(Range<String> range) {
return getValue(range.getUpperBound(), "+");
}
if (range.getUpperBound().equals(Range.Bound.unbounded())) {
return "+";
private static String getValue(Range.Bound<String> bound, String fallbackValue) {
if (bound.equals(Range.Bound.unbounded())) {
return fallbackValue;
}
return range.getUpperBound().getValue().orElse("+");
return bound.getValue().map(it -> bound.isInclusive() ? it : "(" + it).orElse(fallbackValue);
}
static List<Object> mapToList(Map<String, Object> map) {