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

Update message.go #570

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

neelpatel04466
Copy link

This pull request addresses the duplication issue in the AsIntSlice method and ensures proper error handling. The AsIntSlice method has been consolidated into a single function within the RedisResult struct to streamline the code and remove redundancy.

Changes Made

  • Unified the AsIntSlice method from both RedisResult and RedisMessage into a single function in RedisResult.
  • Ensured proper error handling by checking for errors at the beginning of the method.
  • Simplified the conversion logic for converting Redis messages to a slice of int64.

return s, nil
// AsIntSlice checks if the message is a Redis array/set response and converts it to []int64.
// Redis nil elements and other non-integer elements will be present as zero.
func (r RedisResult) AsIntSlice() ([]int64, error) {
Copy link
Contributor

@SoulPancake SoulPancake Jun 15, 2024

Choose a reason for hiding this comment

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

What is the purpose of this? @neelpatel04466

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