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

Added Decr and DecrBy. (String Commands) #80

Conversation

SanHalacogluImproving
Copy link

No description provided.

@@ -48,4 +48,31 @@ public interface StringCommands {
* is set, return the old value as a <code>String</code>.
*/
CompletableFuture<String> set(String key, String value, SetOptions options);

/**
* Increment the string representing a floating point number stored at <code>key</code> by <code>

Choose a reason for hiding this comment

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

I think this is the comment for incr. But decr should say "Decrements".

Also, this command doesn't take an amount. We should follow what's in the node side, since they have overloaded this function like we have.

    /** Decrements the number stored at `key` by one. If `key` does not exist, it is set to 0 before performing the operation.
     * See https://redis.io/commands/decr/ for details.
     *
     * @param key - The key to decrement its value.
     * @returns the value of `key` after the decrement. An error is raised if `key` contains a value
     * of the wrong type or contains a string that can not be represented as integer.
     */
    public decr(key: string): Promise<number> {
        return this.createWritePromise(createDecr(key));
    }

    /** Decrements the number stored at `key` by `amount`. If `key` does not exist, it is set to 0 before performing the operation.
     * See https://redis.io/commands/decrby/ for details.
     *
     * @param key - The key to decrement its value.
     * @param amount - The amount to decrement.
     * @returns the value of `key` after the decrement. An error is raised if `key` contains a value
     * of the wrong type or contains a string that can not be represented as integer.
     */
    public decrBy(key: string, amount: number): Promise<number> {
        return this.createWritePromise(createDecrBy(key, amount));
    }

Choose a reason for hiding this comment

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

I'll fix the documentation. I don't understand the rest of your comment decr just has 1 argument and that's the key what are you referring to? DecrBy has amount.

Choose a reason for hiding this comment

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

The documentation used to mention "amount" for the overloaded method without "amount". All fixed now. You're good.

@SanHalacogluImproving SanHalacogluImproving force-pushed the java/dev_SanH_add_Decr_DecrBy branch from 3511994 to 2d53c0d Compare February 13, 2024 17:44
@SanHalacogluImproving SanHalacogluImproving merged commit 1dedddf into java/integ_SanH_add_Decr_DecrBy Feb 13, 2024
10 checks passed
Yury-Fridlyand pushed a commit that referenced this pull request Feb 20, 2024
…g Commands) (valkey-io#957)

* Added Decr and DecrBy to BaseClient and BaseTransaction.(String Commands) (#80)

* Minor fix for documentation.

* Added Transaction Unit Tests.

* Minor documentation refactor

* Removed the message of error in documentation for Decr commands and Added transaction tests.
@SanHalacogluImproving SanHalacogluImproving deleted the java/dev_SanH_add_Decr_DecrBy branch March 19, 2024 18:02
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.

3 participants