-
Notifications
You must be signed in to change notification settings - Fork 53
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
Node: added sismember command. #1083
Conversation
ce46ae5
to
b26e5e0
Compare
CHANGELOG.md
Outdated
@@ -2,7 +2,7 @@ | |||
|
|||
* Node: Allow routing Cluster requests by address. ([#1021](https://github.com/aws/glide-for-redis/pull/1021)) | |||
* Python: Added HSETNX command. ([#954](https://github.com/aws/glide-for-redis/pull/954)) | |||
* Python: Added SISMEMBER command ([#971](https://github.com/aws/glide-for-redis/pull/971)) | |||
* Python, Node: Added SISMEMBER command ([#971](https://github.com/aws/glide-for-redis/pull/971), [#1083](https://github.com/aws/glide-for-redis/pull/1083)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python- it's actually 972
node/src/BaseClient.ts
Outdated
/** Returns if `member` is a member of the set stored at `key`. | ||
* See https://redis.io/commands/sismember/ for more details. | ||
* | ||
* @param key - The key to return the number of its members. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key - The key of the set.
node/src/BaseClient.ts
Outdated
* | ||
* @param key - The key to return the number of its members. | ||
* @param member - The member to check for existence in the set. | ||
* @returns true if the member exists in the set, false otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
... false
node/src/BaseClient.ts
Outdated
* @param key - The key to return the number of its members. | ||
* @param member - The member to check for existence in the set. | ||
* @returns true if the member exists in the set, false otherwise. | ||
* If `key` doesn't exist, it is treated as an empty set and the command returns false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false
@@ -633,6 +634,19 @@ export class BaseTransaction<T extends BaseTransaction<T>> { | |||
return this.addAndReturn(createSCard(key)); | |||
} | |||
|
|||
/** Returns if `member` is a member of the set stored at `key`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -824,6 +825,18 @@ export class BaseClient { | |||
return this.createWritePromise(createSCard(key)); | |||
} | |||
|
|||
/** Returns if `member` is a member of the set stored at `key`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** Returns if `member` is a member of the set stored at `key`. | |
/** Returns whether `member` is a member of the set stored at `key`. |
* @param member - The member to check for existence in the set. | ||
* @returns true if the member exists in the set, false otherwise. | ||
* If `key` doesn't exist, it is treated as an empty set and the command returns false. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if key exists, but it is not a set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will throw an error, but we decided not to document this error (see other set commands).
node/tests/SharedTests.ts
Outdated
await client.sismember(key, "nonExistingMember") | ||
).toEqual(false); | ||
expect( | ||
await client.sismember("nonExistingKey", "member1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test when key exists, but it is not a set
b26e5e0
to
477db9a
Compare
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.