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

Added hash and json support for Redis. #206

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

foogaro
Copy link
Contributor

@foogaro foogaro commented Dec 2, 2024

No description provided.

@hifly81 hifly81 requested review from Copilot and ugol March 20, 2025 07:59
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Redis hash and JSON producers to handle two different data formats, along with updates in the emitter and CLI commands to allow users to select the desired Redis data type.

  • Introduces a new JSONProducer (and corresponding tests) alongside the existing HashProducer.
  • Updates the emitter to create the proper Redis producer based on the output mode.
  • Adjusts CLI flags and the producer list to include "redishash" and "redisjson" options.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/producers/redis/jsonProducer.go New JSON producer implementation for storing JSON data
pkg/producers/redis/hashProducer_test.go Added tests for HashProducer
pkg/producers/redis/hashProducer.go Hash producer implementation
pkg/producers/redis/jsonProducer_test.go Added tests for JSONProducer
pkg/emitter/emitter.go Updated emitter to support both Redis hash and JSON producers
pkg/cmd/templateRun.go Updated CLI output flag descriptions to include redis options
pkg/cmd/producerList.go Updated producer list to display redisjson and redishash options
Comments suppressed due to low confidence (1)

pkg/producers/redis/hashProducer.go:14

  • Consider changing the Redis client field to a pointer (*redis.Client) to align with the go-redis library's intended usage and avoid potential issues with internal state management.
client redis.Client

)

type JSONProducer struct {
client redis.Client
Copy link
Preview

Copilot AI Mar 20, 2025

Choose a reason for hiding this comment

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

Consider storing the Redis client as a pointer (*redis.Client) rather than a value to ensure proper client state management as intended by the go-redis library.

Suggested change
client redis.Client
client *redis.Client

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@hifly81
Copy link
Collaborator

hifly81 commented Mar 20, 2025

LGTM!

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