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

Add missing examples for Python and Node #1227

Merged
merged 26 commits into from
Apr 7, 2024

Conversation

shohamazon
Copy link
Collaborator

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.

@shohamazon shohamazon added python Python wrapper node Node.js wrapper labels Apr 3, 2024
@shohamazon shohamazon requested a review from a team as a code owner April 3, 2024 13:12
@shohamazon shohamazon linked an issue Apr 3, 2024 that may be closed by this pull request
@shohamazon shohamazon added the docs Documentation label Apr 3, 2024
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/RedisClusterClient.ts Outdated Show resolved Hide resolved
node/src/RedisClusterClient.ts Outdated Show resolved Hide resolved
python/python/glide/async_commands/core.py Outdated Show resolved Hide resolved
python/python/glide/async_commands/core.py Outdated Show resolved Hide resolved
python/python/glide/async_commands/core.py Outdated Show resolved Hide resolved
node/src/BaseClient.ts Show resolved Hide resolved
node/src/BaseClient.ts Show resolved Hide resolved
node/src/BaseClient.ts Show resolved Hide resolved
*
* @example
* ```typescript
* // Example usage of the hincrby method
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy comment from incrBy - it is more verbose

*
* @example
* ```typescript
* // Example usage of the hincrbyfloat method
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy from incrByFloat

* @example
* ```typescript
* // Example usage of configGet method with multiple configuration parameters
* const result = await client.configGet(["timeout", "maxmemory"]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Show example with wildcard

* connection.customCommand(["CLIENT", "LIST","TYPE", "PUBSUB"], "allPrimaries")
* ```typescript
* // Example usage of customCommand method to retrieve pub/sub clients with routing to all primary nodes
* const result = await client.customCommand(["CLIENT", "LIST", "TYPE", "PUBSUB"], "allPrimaries");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a constant for allPrimaries?

@@ -238,6 +238,10 @@ async def set(
If the value is successfully set, return OK.
If value isn't set because of only_if_exists or only_if_does_not_exist conditions, return None.
If return_old_value is set, return the old value as a string.

Example:
>>> await client.set("key", "value")
Copy link
Collaborator

Choose a reason for hiding this comment

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

show options in example

@@ -275,6 +283,13 @@ async def delete(self, keys: List[str]) -> int:

Returns:
int: The number of keys that were deleted.

Examples:
>>> await client.set("key", "value")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can omit set I think

>>> await client.delete("key")
1
>>> await client.delete("key")
0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy "Indicates ..." comments from node docs - they are pretty good

* ```typescript
* // Example usage of ping method with a message
* const result = await client.ping("Hello");
* console.log(result); // Output: "Hello"
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: please be consistent with one or two quotes, here it's

// Output: "Hello"

and other places it's:

// Output: 'Connection Name'

Copy link
Collaborator

@barshaul barshaul left a comment

Choose a reason for hiding this comment

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

Great job 🔥
Please fix @Yury-Fridlyand and @acarbonetto comments before merging.
Does it also reformat all existing typescript examples?

shohamazon and others added 2 commits April 7, 2024 11:51
Co-authored-by: Andrew Carbonetto <[email protected]>
Co-authored-by: Andrew Carbonetto <[email protected]>
node/src/BaseClient.ts Outdated Show resolved Hide resolved
@shohamazon shohamazon merged commit 397f9f2 into valkey-io:main Apr 7, 2024
12 checks passed
@shohamazon shohamazon deleted the node_add_examples branch April 7, 2024 13:56
shohamazon added a commit to adanWattad/glide-for-redis that referenced this pull request Apr 9, 2024
cyip10 pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation node Node.js wrapper python Python wrapper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standardize Example Format for Node Commands Documentation
4 participants