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

Fix transaction doc to fit RESP3 #881

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions node/src/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class BaseTransaction {
* @param key - The key to increment its value.
* @param amount - The amount to increment.
*
* Command Response - the value of `key` after the increment as string.
* Command Response - the value of `key` after the increment.
* An error is raised if `key` contains a value of the wrong type,
* or the current key content is not parsable as a double precision floating point number.
*
Expand Down Expand Up @@ -269,7 +269,7 @@ export class BaseTransaction {
*
* @param parameters - A list of configuration parameter names to retrieve values for.
*
* Command Response - A list of values corresponding to the configuration parameters.
* Command Response - A map of values corresponding to the configuration parameters.
*
*/
public configGet(parameters: string[]) {
Expand Down Expand Up @@ -351,8 +351,8 @@ export class BaseTransaction {
* @param key - The key of the hash.
* @param field - The field to check in the hash stored at `key`.
*
* Command Response - 1 if the hash contains `field`. If the hash does not contain `field`, or if `key` does not exist,
* the command response will be 0.
* Command Response - `true` if the hash contains `field`. If the hash does not contain `field`, or if `key` does not exist,
* the command response will be `false`.
*/
public hexists(key: string, field: string) {
this.commands.push(createHExists(key, field));
Expand All @@ -363,8 +363,8 @@ export class BaseTransaction {
*
* @param key - The key of the hash.
*
* Command Response - a list of fields and their values stored in the hash. Every field name in the list is followed by its value.
* If `key` does not exist, it returns an empty list.
* Command Response - a map of fields and their values stored in the hash. Every field name in the map is followed by its value.
* If `key` does not exist, it returns an empty map.
* If `key` holds a value that is not a hash, an error is raised.
*/
public hgetall(key: string) {
Expand Down Expand Up @@ -397,7 +397,7 @@ export class BaseTransaction {
* @param amount - The amount to increment.
* @param field - The field in the hash stored at `key` to increment its value.
*
* Command Response - the value of `field` in the hash stored at `key` after the increment as string.
* Command Response - the value of `field` in the hash stored at `key` after the increment.
* An error is raised if `key` contains a value of the wrong type
* or the current field content is not parsable as a double precision floating point number.
*
Expand Down Expand Up @@ -626,7 +626,7 @@ export class BaseTransaction {
* @param seconds - The timeout in seconds.
* @param option - The expire option.
*
* Command Response - 1 if the timeout was set. 0 if the timeout was not set. e.g. key doesn't exist,
* Command Response - `true` if the timeout was set. `false` if the timeout was not set. e.g. key doesn't exist,
* or operation skipped due to the provided arguments.
*/
public expire(key: string, seconds: number, option?: ExpireOptions) {
Expand All @@ -643,7 +643,7 @@ export class BaseTransaction {
* @param unixSeconds - The timeout in an absolute Unix timestamp.
* @param option - The expire option.
*
* Command Response - 1 if the timeout was set. 0 if the timeout was not set. e.g. key doesn't exist,
* Command Response - `true` if the timeout was set. `false` if the timeout was not set. e.g. key doesn't exist,
* or operation skipped due to the provided arguments.
*/
public expireAt(key: string, unixSeconds: number, option?: ExpireOptions) {
Expand All @@ -660,7 +660,7 @@ export class BaseTransaction {
* @param milliseconds - The timeout in milliseconds.
* @param option - The expire option.
*
* Command Response - 1 if the timeout was set. 0 if the timeout was not set. e.g. key doesn't exist,
* Command Response - `true` if the timeout was set. `false` if the timeout was not set. e.g. key doesn't exist,
* or operation skipped due to the provided arguments.
*/
public pexpire(key: string, milliseconds: number, option?: ExpireOptions) {
Expand All @@ -677,7 +677,7 @@ export class BaseTransaction {
* @param unixMilliseconds - The timeout in an absolute Unix timestamp.
* @param option - The expire option.
*
* Command Response - 1 if the timeout was set. 0 if the timeout was not set. e.g. key doesn't exist,
* Command Response - `true` if the timeout was set. `false` if the timeout was not set. e.g. key doesn't exist,
* or operation skipped due to the provided arguments.
*/
public pexpireAt(
Expand Down
28 changes: 14 additions & 14 deletions python/python/glide/async_commands/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def config_get(self, parameters: List[str]):
parameters (List[str]): A list of configuration parameter names to retrieve values for.

Command response:
List[str]: A list of values corresponding to the configuration parameters.
Dict[str, str]: A dictionary of values corresponding to the configuration parameters.
"""
self.append_command(RequestType.ConfigGet, parameters)

Expand Down Expand Up @@ -229,8 +229,8 @@ def incrbyfloat(self, key: str, amount: float):
amount (float) : The amount to increment.

Command response:
str: The value of key after the increment. An error is returned if the key contains a value
of the wrong type.
float: The value of key after the increment. The transaction fails if the key contains a value
of the wrong type.
"""
self.append_command(RequestType.IncrByFloat, [key, str(amount)])

Expand Down Expand Up @@ -341,7 +341,7 @@ def hincrbyfloat(self, key: str, field: str, amount: float):
Use a negative value to decrement.

Returns:
str: The value of the specified field in the hash stored at `key` after the increment as a string.
float: The value of the specified field in the hash stored at `key` after the increment as a string.
The transaction fails if `key` contains a value of the wrong type or the current field content is not
parsable as a double precision floating point number.
"""
Expand All @@ -356,8 +356,8 @@ def hexists(self, key: str, field: str):
field (str): The field to check in the hash stored at `key`.

Command response:
int: Returns 1 if the hash contains the specified field. If the hash does not contain the field,
or if the key does not exist, it returns 0.
bool: Returns 'True' if the hash contains the specified field. If the hash does not contain the field,
or if the key does not exist, it returns 'False'.
If `key` holds a value that is not a hash, the transaction fails with an error.
"""
self.append_command(RequestType.HashExists, [key, field])
Expand All @@ -381,9 +381,9 @@ def hgetall(self, key: str):
key (str): The key of the hash.

Command response:
List[str]: A list of fields and their values stored in the hash. Every field name in the list is followed by
its value. If `key` does not exist, it returns an empty list.
If `key` holds a value that is not a hash , the transaction fails.
Dict[str, str]: A dictionary of fields and their values stored in the hash. Every field name in the list is followed by
its value. If `key` does not exist, it returns an empty dictionary.
If `key` holds a value that is not a hash, the transaction fails with an error.
"""
self.append_command(RequestType.HashGetAll, [key]),

Expand Down Expand Up @@ -552,7 +552,7 @@ def smembers(self, key: str):
key (str): The key from which to retrieve the set members.

Commands response:
List[str]: A list of all members of the set.
Set[str]: A set of all members of the set.
If `key` does not exist an empty list will be returned.
If `key` holds a value that is not a set, the transaction fails.
"""
Expand Down Expand Up @@ -670,7 +670,7 @@ def expire(self, key: str, seconds: int, option: Optional[ExpireOptions] = None)
option (Optional[ExpireOptions]): The expire option.

Commands response:
int: 1 if the timeout was set, 0 if the timeout was not set (e.g., the key doesn't exist or the operation is
bool: 'True' if the timeout was set, 'False' if the timeout was not set (e.g., the key doesn't exist or the operation is
skipped due to the provided arguments).

"""
Expand All @@ -697,7 +697,7 @@ def expireat(
option (Optional[ExpireOptions]): The expire option.

Commands response:
int: 1 if the timeout was set, 0 if the timeout was not set (e.g., the key doesn't exist or the operation is
bool: 'True' if the timeout was set, 'False' if the timeout was not set (e.g., the key doesn't exist or the operation is
skipped due to the provided arguments).
"""
args = (
Expand All @@ -723,7 +723,7 @@ def pexpire(
option (Optional[ExpireOptions]): The expire option.

Commands response:
int: 1 if the timeout was set, 0 if the timeout was not set (e.g., the key doesn't exist or the operation is
bool: 'True' if the timeout was set, 'False' if the timeout was not set (e.g., the key doesn't exist or the operation is
skipped due to the provided arguments).

"""
Expand Down Expand Up @@ -752,7 +752,7 @@ def pexpireat(
option (Optional[ExpireOptions]): The expire option.

Commands response:
int: 1 if the timeout was set, 0 if the timeout was not set (e.g., the key doesn't exist or the operation is
bool: 'True' if the timeout was set, 'False' if the timeout was not set (e.g., the key doesn't exist or the operation is
skipped due to the provided arguments).
"""
args = (
Expand Down
2 changes: 1 addition & 1 deletion python/python/tests/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def transaction_test(
value2,
5,
10.5,
1,
True,
[value, None, value2],
{key: value, key2: value2, key3: "10.5"},
2,
Expand Down
Loading