Skip to content

Add comprehensive documentation to set commands#3642

Merged
ndyakov merged 18 commits into
redis:masterfrom
iamamirsalehi:doc/set-commands
Jan 19, 2026
Merged

Add comprehensive documentation to set commands#3642
ndyakov merged 18 commits into
redis:masterfrom
iamamirsalehi:doc/set-commands

Conversation

@iamamirsalehi

Copy link
Copy Markdown
Contributor

Add comprehensive documentation to set commands

Summary

This PR adds detailed documentation to all set command methods in set_commands.go to improve developer experience and code discoverability.

Changes

  • Added interface documentation for SetCmdable explaining its purpose
  • Added comprehensive documentation to all 20 set command methods:
    • SAdd - Add members to a set
    • SCard - Get set cardinality
    • SDiff - Set difference operation
    • SDiffStore - Store set difference result
    • SInter - Set intersection operation
    • SInterCard - Get intersection cardinality
    • SInterStore - Store set intersection result
    • SIsMember - Check membership
    • SMIsMember - Check multiple memberships
    • SMembers - Get all members (slice)
    • SMembersMap - Get all members (map)
    • SMove - Move member between sets
    • SPop - Pop random member
    • SPopN - Pop multiple random members
    • SRandMember - Get random member
    • SRandMemberN - Get multiple random members
    • SRem - Remove members
    • SScan - Incrementally scan set
    • SUnion - Set union operation
    • SUnionStore - Store set union result

Documentation Details

Each method now includes:

  • The corresponding Redis command syntax
  • Clear description of what the command does
  • Parameter explanations (especially for SScan)
  • Return value descriptions
  • Edge case behavior (e.g., handling of non-existent keys)

Benefits

  • Improved IDE autocomplete experience with inline documentation
  • Better understanding of method behavior without consulting external docs
  • Clearer parameter usage, especially for complex operations like SScan
  • Consistent documentation style matching other command files in the codebase

Testing

  • No functional changes - documentation only

@jit-ci

jit-ci Bot commented Dec 4, 2025

Copy link
Copy Markdown

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@iamamirsalehi iamamirsalehi changed the title Added documentation for explaining the methods responsibility Add comprehensive documentation to set commands Dec 4, 2025
@ndyakov

ndyakov commented Dec 4, 2025

Copy link
Copy Markdown
Member

Hello @iamamirsalehi, thank you for this contribution. I will review it as soon as possible.

@iamamirsalehi

Copy link
Copy Markdown
Contributor Author

Hello @ndyakov, Thank you for reviewing. I’ll add more documentation for the other methods if you find it useful.

@ndyakov

ndyakov commented Dec 9, 2025

Copy link
Copy Markdown
Member

@iamamirsalehi thank you for this initiative once again!
One comment that should be addressed:

In the comments for a given command, it will be useful if we provide link to the official documentation on redis.io. You can take a look at:

// [FT._LIST]: (https://redis.io/commands/ft._list/)

and read about links in godoc:
https://go.dev/doc/comment#links

Consider this a pr wide comment, we can add such links to all comments.

@iamamirsalehi

Copy link
Copy Markdown
Contributor Author

@ndyakov Thank you for reviewing. Sure, I'll apply it to all comments

@iamamirsalehi

Copy link
Copy Markdown
Contributor Author

Hi @ndyakov, thanks for your feedback, I applied the changes, could you please review it again. After your confirm, I'll write doc for other command files too, and make a PR for each of them.

Comment thread set_commands.go Outdated

@ndyakov ndyakov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hello @iamamirsalehi and thank you for adding all the link. I did add one example on how a comment with a link should look like. Could you address all of them (or if you don't have the time, I can) and we can merge this.

@jit-ci

jit-ci Bot commented Jan 15, 2026

Copy link
Copy Markdown

❌ Security scan failed

Security scan failed: Branch doc/set-commands does not exist in the remote repository


💡 Need to bypass this check? Comment @sera bypass to override.

@iamamirsalehi

Copy link
Copy Markdown
Contributor Author

Hello @ndyakov, and thank you for the review. I've applied the changes.

@jit-ci

jit-ci Bot commented Jan 15, 2026

Copy link
Copy Markdown

❌ Security scan failed

Security scan failed: Branch doc/set-commands does not exist in the remote repository


💡 Need to bypass this check? Comment @sera bypass to override.

@ndyakov

ndyakov commented Jan 15, 2026

Copy link
Copy Markdown
Member

@iamamirsalehi would you mind running golangci-lint fmt

ndyakov
ndyakov previously approved these changes Jan 15, 2026

@ndyakov ndyakov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The doc comments look good, thank you @iamamirsalehi! Let's just fix the build.

@jit-ci

jit-ci Bot commented Jan 17, 2026

Copy link
Copy Markdown

❌ Security scan failed

Security scan failed: Branch doc/set-commands does not exist in the remote repository


💡 Need to bypass this check? Comment @sera bypass to override.

@jit-ci

jit-ci Bot commented Jan 17, 2026

Copy link
Copy Markdown

❌ Security scan failed

Security scan failed: Branch doc/set-commands does not exist in the remote repository


💡 Need to bypass this check? Comment @sera bypass to override.

@iamamirsalehi

Copy link
Copy Markdown
Contributor Author

@ndyakov, thanks for your attention and for being patient with this PR. I ran the command you mentioned, and I think it looks good now.

@ndyakov ndyakov merged commit 5e807fc into redis:master Jan 19, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants