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.

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