-
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
Python: adds TYPE command #945
Conversation
key (str): The key to check its data type. | ||
|
||
Returns: | ||
Optional[str]: The type of value stored at `key`, or "none" when key doesn't exist. |
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.
nit: "none" => None
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.
ohh, I see, it doesn't response with None, but with a "none" string? if so, please change the return type documented here from Optional[str] to str
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.
Lets write it a bit clearer:
If the key exists, the type of the stored value is returned; otherwise, a "none" string is returned.
|
||
Returns: | ||
Optional[str]: The type of value stored at `key`, or "none" when key doesn't exist. | ||
The different types that can be returned are: string, list, set, zset, hash and stream. |
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.
Lets remove this line as it would require us to maintain it with new types will be added to redis, and, also - when modules are being loaded we might have more types
The different types that can be returned are: string, list, set, zset, hash and stream. | ||
|
||
Examples: | ||
>>> await client.type("my_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.
Lets expand the example a bit-
>>> await client.set("key", "value")
>>> await client.type("key")
'string'
key (str): The key to check its data type. | ||
|
||
Commands response: | ||
Optional[str]: The type of value stored at `key`, or "none" when key doesn't exist. |
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 comments
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.
done
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.
Fix & merge
e4f59df
to
d49a8a1
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.