Skip to content

docs: Add doc comment to HGetAll describing behavior and complexity#3776

Merged
ofekshenawa merged 3 commits into
redis:masterfrom
0x48core:docs/add-hgetall-comment
Apr 15, 2026
Merged

docs: Add doc comment to HGetAll describing behavior and complexity#3776
ofekshenawa merged 3 commits into
redis:masterfrom
0x48core:docs/add-hgetall-comment

Conversation

@0x48core

@0x48core 0x48core commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add Go doc comment to HGetAll method describing its behavior, return value, time complexity, and linking to official Redis documentation

Motivation

The HGetAll function on cmdable was missing a doc comment, so hovering over it in IDEs (e.g., VS Code, GoLand, Cursor) showed no documentation. This makes it harder for developers to understand the command's behavior without leaving their editor.
image

Changes

Added a doc comment to HGetAll in hash_commands.go covering:

  • What the command returns (all fields and values of a hash)
  • Behavior when the key does not exist (empty map)
  • Time complexity: O(N)
  • Link to the official Redis docs: https://redis.io/commands/hgetall/

Test plan

  • Verify the comment renders correctly on hover in the IDE
  • Confirm go build ./... still passes with no errors

Note

Low Risk
Low risk documentation-only change; no runtime logic or APIs are modified.

Overview
Adds a GoDoc comment to cmdable.HGetAll describing what it returns, behavior for missing keys (empty map), its O(N) complexity, and a link to the official Redis HGETALL command documentation.

Reviewed by Cursor Bugbot for commit 9908e86. Bugbot is set up for automated code reviews on this repo. Configure here.

@jit-ci

jit-ci Bot commented Apr 15, 2026

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.

@ofekshenawa ofekshenawa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@0x48core thanks for filling this gap.

One small wording issue, the sentence about reply length being “twice the size of the hash” describes the raw Redis protocol reply, but in this API HGetAll returns a map[string]string, so callers observe one map entry per hash field.

Could we reword that line to avoid confusion?
maybe “HGetAll returns a map of all fields and values stored at key.”

@0x48core 0x48core closed this Apr 15, 2026
@0x48core 0x48core reopened this Apr 15, 2026
@0x48core

Copy link
Copy Markdown
Contributor Author

@0x48core thanks for filling this gap.

One small wording issue, the sentence about reply length being “twice the size of the hash” describes the raw Redis protocol reply, but in this API HGetAll returns a map[string]string, so callers observe one map entry per hash field.

Could we reword that line to avoid confusion? maybe “HGetAll returns a map of all fields and values stored at key.”

Hey @ofekshenawa, thanks for your reply. I’ve updated it based on your suggestions. Thank you

@ofekshenawa ofekshenawa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@0x48core

0x48core commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

hey @ofekshenawa could you retrigger the failed action or please help me to check

@0x48core

Copy link
Copy Markdown
Contributor Author

Hey @ofekshenawa, all actions passed, but I can’t merge this PR. Should I wait for another owner to approve, or is there another way?

@ofekshenawa ofekshenawa merged commit ca74fb8 into redis:master Apr 15, 2026
56 of 57 checks passed
@ofekshenawa

Copy link
Copy Markdown
Collaborator

Hey @0x48core, All good, merged.

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