Skip to content

Commit

Permalink
rename struct fields
Browse files Browse the repository at this point in the history
  • Loading branch information
etrpx committed May 29, 2024
1 parent 38b5505 commit 3b5b0a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions seed/redis/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (r *SeedComponent) seed(ctx context.Context) error {
}

func (r *SeedComponent) setEntries(ctx context.Context, err error, client *redis.Client) error {
for _, entry := range r.config.Entries {
for _, entry := range r.config.SetEntries {
err = client.Set(ctx, entry.Key, entry.Value, entry.TTL).Err()

if err != nil {
Expand All @@ -97,7 +97,7 @@ func (r *SeedComponent) setEntries(ctx context.Context, err error, client *redis
}

func (r *SeedComponent) hashSetEntries(ctx context.Context, err error, client *redis.Client) error {
for _, hEntry := range r.config.HEntries {
for _, hEntry := range r.config.HSetEntries {
err = client.HSet(ctx, hEntry.Key, hEntry.Values).Err()

if err != nil {
Expand All @@ -114,8 +114,8 @@ func (r *SeedComponent) hashSetEntries(ctx context.Context, err error, client *r
}

func (r *SeedComponent) logInsertions() {
count := len(r.config.Entries)
hashedCount := len(r.config.HEntries)
count := len(r.config.SetEntries)
hashedCount := len(r.config.HSetEntries)

r.writer.WriteString(fmt.Sprintf(
"inserted %s fields to %s and %s fields to %s",
Expand Down
8 changes: 4 additions & 4 deletions seed/redis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ type SeedConfig struct {
// if both ClientProvider and Address are provided, ClientProvider is used.
ClientProvider func() (*redis.Client, error) `json:"-"`

// Entries - a list of key-value pairs to set in redis
Entries []*Set `json:"entries,omitempty"`
// SetEntries - a list of key-value pairs to set in redis
SetEntries []*Set `json:"entries,omitempty"`

// HEntries - a list of key-value pairs to set in redis hashes
HEntries []*HSet `json:"hentries,omitempty"`
// HSetEntries - a list of key-value pairs to set in redis hashes
HSetEntries []*HSet `json:"hentries,omitempty"`
}

// Set Represents a key-value pair to set in redis.
Expand Down

0 comments on commit 3b5b0a9

Please sign in to comment.