Skip to content

Commit

Permalink
Add ZSCORE command (jgaskins#24)
Browse files Browse the repository at this point in the history
* Adding ZSCORE command support

* oops...
  • Loading branch information
jwoertink authored Sep 19, 2022
1 parent 63a09a8 commit 8502cf7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/redis_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ describe Redis::Client do
redis.zcount(key, "0", "+inf").should eq(3)
redis.zcount(key, "(1", "3").should eq(2)
end

test "returns the score of a member in a sorted set at key" do
redis.zadd(key, "1", "one")
redis.zscore(key, "one").should eq("1")
end
end

describe "hash" do
Expand Down
4 changes: 4 additions & 0 deletions src/commands/sorted_set.cr
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ module Redis::Commands::SortedSet
def zcount(key : String, min : String, max : String)
run({"zcount", key, min, max})
end

def zscore(key : String, value : String)
run({"zscore", key, value})
end
end

0 comments on commit 8502cf7

Please sign in to comment.