Skip to content

Conversation

@iamamirsalehi
Copy link
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
Copy link

jit-ci bot commented Dec 4, 2025

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
Copy link
Member

ndyakov commented Dec 4, 2025

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

@iamamirsalehi
Copy link
Contributor Author

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

@ndyakov
Copy link
Member

ndyakov commented Dec 9, 2025

@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
Contributor Author

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

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.

2 participants