Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#256 support redis zset #258

Closed
wants to merge 3 commits into from
Closed

Conversation

Bugsource
Copy link

This PR support basic commands of Redis zset. For now, just only support ZADD, ZREM, ZCARD, ZRANGE, ZREVRANGE.

Copy link
Owner

@KarelCemus KarelCemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution, very nice PR! Awesome work. Would you mind looking at my comments? They are very minor. I'll merge it then.

}

def isEmpty = {
redis.zsetSize(key).map(_ == 0).recoverWithDefault(true)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
redis.zsetSize(key).map(_ == 0).recoverWithDefault(true)
size.map(_ == 0)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried with the compiler, it turned out that can't use map here cause the impact of recoverWithDefault . I checked out the implementation for set and hash, the code style is the same.

  def size = {
    redis.setSize(key).recoverWithDefault(0)
  }

  def isEmpty = {
    redis.setSize(key).map(_ == 0).recoverWithDefault(true)
  }

  def nonEmpty = {
    redis.setSize(key).map(_ > 0).recoverWithDefault(false)
  }

@Bugsource
Copy link
Author

Hi @KarelCemus, your suggestion is reasonable, i have checked it out and optimize the code. Please check it again.

@Bugsource
Copy link
Author

I've added test cases, but the coverage still report errors. It's strange that it didn't report errors when i commit code first time on PR.

@KarelCemus KarelCemus mentioned this pull request Feb 10, 2022
@KarelCemus
Copy link
Owner

Thank you for your contribution, I am closing this PR since I don't have write access to your branch and creating #259 instead. I added multiple tests to fix the coverage and did some minor refactoring and addressed the comments here.

@KarelCemus KarelCemus closed this Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants