Skip to content

Commit a3e8dc3

Browse files
committed
Rename RangeBoundary to ScoreBoundary
1 parent ed5555e commit a3e8dc3

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/RedisSortedSet.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getRangeWithScores(int $start, int $end, ?RangeOptions $options
6565
/**
6666
* @return Promise<list<string>>
6767
*/
68-
public function getRangeByScore(RangeBoundary $start, RangeBoundary $end, ?RangeOptions $options = null): Promise
68+
public function getRangeByScore(ScoreBoundary $start, ScoreBoundary $end, ?RangeOptions $options = null): Promise
6969
{
7070
$query = ['zrange', $this->key, $start->toQuery(), $end->toQuery(), 'BYSCORE'];
7171
if ($options !== null) {
@@ -78,7 +78,7 @@ public function getRangeByScore(RangeBoundary $start, RangeBoundary $end, ?Range
7878
/**
7979
* @return Promise<array<string, float>>
8080
*/
81-
public function getRangeByScoreWithScores(RangeBoundary $start, RangeBoundary $end, ?RangeOptions $options = null): Promise
81+
public function getRangeByScoreWithScores(ScoreBoundary $start, ScoreBoundary $end, ?RangeOptions $options = null): Promise
8282
{
8383
$query = ['zrange', $this->key, $start->toQuery(), $end->toQuery(), 'BYSCORE', 'WITHSCORES'];
8484
if ($options !== null) {
@@ -226,7 +226,7 @@ public function removeRankRange(int $start, int $stop): Promise
226226
/**
227227
* @return Promise<int>
228228
*/
229-
public function removeRangeByScore(RangeBoundary $min, RangeBoundary $max): Promise
229+
public function removeRangeByScore(ScoreBoundary $min, ScoreBoundary $max): Promise
230230
{
231231
return $this->queryExecutor->execute(['zremrangebyscore', $this->key, $min->toQuery(), $max->toQuery()]);
232232
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Amp\Redis;
44

5-
final class RangeBoundary
5+
final class ScoreBoundary
66
{
77
public static function exclusive(float $value): self
88
{

test/RedisSortedSetTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ public function testScoredSet(): \Generator
3232
$this->assertSame(['foo', 'bar'], yield $set->getRange(0, 1));
3333
$this->assertSame(['bar'], yield $set->getRange(1, 2));
3434

35-
$this->assertSame(['foo'], yield $set->getRangeByScore(RangeBoundary::inclusive(1), RangeBoundary::inclusive(2)));
36-
$this->assertSame(['foo' => 1.0], yield $set->getRangeByScoreWithScores(RangeBoundary::inclusive(1), RangeBoundary::exclusive(3)));
37-
$this->assertSame(['foo', 'bar'], yield $set->getRangeByScore(RangeBoundary::negativeInfinity(), RangeBoundary::inclusive(3)));
38-
$this->assertSame(['foo'], yield $set->getRangeByScore(RangeBoundary::inclusive(1), RangeBoundary::exclusive(3)));
35+
$this->assertSame(['foo'], yield $set->getRangeByScore(ScoreBoundary::inclusive(1), ScoreBoundary::inclusive(2)));
36+
$this->assertSame(['foo' => 1.0], yield $set->getRangeByScoreWithScores(ScoreBoundary::inclusive(1), ScoreBoundary::exclusive(3)));
37+
$this->assertSame(['foo', 'bar'], yield $set->getRangeByScore(ScoreBoundary::negativeInfinity(), ScoreBoundary::inclusive(3)));
38+
$this->assertSame(['foo'], yield $set->getRangeByScore(ScoreBoundary::inclusive(1), ScoreBoundary::exclusive(3)));
3939

4040

4141
$this->assertSame(['bar', 'foo'], yield $set->getRange(0, 1, (new RangeOptions())->withReverseOrder()));
4242
$this->assertSame(['bar' => 3.0], yield $set->getRangeWithScores(0, 0, (new RangeOptions())->withReverseOrder()));
4343
$this->assertSame(['foo'], yield $set->getRange(1, 2, (new RangeOptions())->withReverseOrder()));
4444

45-
$this->assertSame(['foo'], yield $set->getRangeByScore(RangeBoundary::inclusive(2), RangeBoundary::inclusive(1), (new RangeOptions())->withReverseOrder()));
46-
$this->assertSame(['bar' => 3.0, 'foo' => 1.0], yield $set->getRangeByScoreWithScores(RangeBoundary::positiveInfinity(), RangeBoundary::inclusive(1), (new RangeOptions())->withReverseOrder()));
47-
$this->assertSame(['bar', 'foo'], yield $set->getRangeByScore(RangeBoundary::inclusive(3), RangeBoundary::inclusive(1), (new RangeOptions())->withReverseOrder()));
45+
$this->assertSame(['foo'], yield $set->getRangeByScore(ScoreBoundary::inclusive(2), ScoreBoundary::inclusive(1), (new RangeOptions())->withReverseOrder()));
46+
$this->assertSame(['bar' => 3.0, 'foo' => 1.0], yield $set->getRangeByScoreWithScores(ScoreBoundary::positiveInfinity(), ScoreBoundary::inclusive(1), (new RangeOptions())->withReverseOrder()));
47+
$this->assertSame(['bar', 'foo'], yield $set->getRangeByScore(ScoreBoundary::inclusive(3), ScoreBoundary::inclusive(1), (new RangeOptions())->withReverseOrder()));
4848

4949
$this->assertSame(0, yield $set->getRank('foo'));
5050
$this->assertSame(1, yield $set->getRank('bar'));
@@ -67,8 +67,8 @@ public function testRemove(): \Generator
6767
'baz' => 3.3,
6868
]));
6969

70-
yield $set->removeRangeByScore(RangeBoundary::exclusive(2.2), RangeBoundary::positiveInfinity());
71-
$this->assertSame(['foo', 'bar'], yield $set->getRangeByScore(RangeBoundary::negativeInfinity(), RangeBoundary::positiveInfinity()));
70+
yield $set->removeRangeByScore(ScoreBoundary::exclusive(2.2), ScoreBoundary::positiveInfinity());
71+
$this->assertSame(['foo', 'bar'], yield $set->getRangeByScore(ScoreBoundary::negativeInfinity(), ScoreBoundary::positiveInfinity()));
7272
}
7373

7474
public function testLexSet(): \Generator

0 commit comments

Comments
 (0)