From 3580472cbd774eea94a887d4e357886ca224ebdb Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Thu, 14 Dec 2023 12:41:05 -0800 Subject: [PATCH] refactor(filters): optimize assignment to allocation (#1293) nit(filters): move explicit assignment to allocation --- internal/database/filter.go | 76 ++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/internal/database/filter.go b/internal/database/filter.go index 94bb143..058a12c 100644 --- a/internal/database/filter.go +++ b/internal/database/filter.go @@ -633,46 +633,46 @@ func (r *FilterRepo) findByIndexerIdentifier(ctx context.Context, indexer string return nil, errors.Wrap(err, "error scanning row") } - f.MinSize = minSize.String - f.MaxSize = maxSize.String - f.Delay = int(delay.Int32) - f.MaxDownloads = int(maxDownloads.Int32) - f.MaxDownloadsUnit = domain.FilterMaxDownloadsUnit(maxDownloadsUnit.String) - f.MatchReleases = matchReleases.String - f.ExceptReleases = exceptReleases.String - f.MatchReleaseGroups = matchReleaseGroups.String - f.ExceptReleaseGroups = exceptReleaseGroups.String - f.MatchReleaseTags = matchReleaseTags.String - f.ExceptReleaseTags = exceptReleaseTags.String - f.MatchDescription = matchDescription.String - f.ExceptDescription = exceptDescription.String - f.FreeleechPercent = freeleechPercent.String - f.Shows = shows.String - f.Seasons = seasons.String - f.Episodes = episodes.String - f.Years = years.String - f.Artists = artists.String - f.Albums = albums.String - f.LogScore = int(logScore.Int32) - f.Log = hasLog.Bool - f.Cue = hasCue.Bool - f.PerfectFlac = perfectFlac.Bool - f.MatchCategories = matchCategories.String - f.ExceptCategories = exceptCategories.String - f.MatchUploaders = matchUploaders.String - f.ExceptUploaders = exceptUploaders.String - f.Tags = tags.String - f.ExceptTags = exceptTags.String - f.TagsMatchLogic = tagsMatchLogic.String - f.ExceptTagsMatchLogic = exceptTagsMatchLogic.String - f.UseRegex = useRegex.Bool - f.Scene = scene.Bool - f.Freeleech = freeleech.Bool - - f.Rejections = []string{} - filter, ok := filtersMap[f.ID] if !ok { + f.MinSize = minSize.String + f.MaxSize = maxSize.String + f.Delay = int(delay.Int32) + f.MaxDownloads = int(maxDownloads.Int32) + f.MaxDownloadsUnit = domain.FilterMaxDownloadsUnit(maxDownloadsUnit.String) + f.MatchReleases = matchReleases.String + f.ExceptReleases = exceptReleases.String + f.MatchReleaseGroups = matchReleaseGroups.String + f.ExceptReleaseGroups = exceptReleaseGroups.String + f.MatchReleaseTags = matchReleaseTags.String + f.ExceptReleaseTags = exceptReleaseTags.String + f.MatchDescription = matchDescription.String + f.ExceptDescription = exceptDescription.String + f.FreeleechPercent = freeleechPercent.String + f.Shows = shows.String + f.Seasons = seasons.String + f.Episodes = episodes.String + f.Years = years.String + f.Artists = artists.String + f.Albums = albums.String + f.LogScore = int(logScore.Int32) + f.Log = hasLog.Bool + f.Cue = hasCue.Bool + f.PerfectFlac = perfectFlac.Bool + f.MatchCategories = matchCategories.String + f.ExceptCategories = exceptCategories.String + f.MatchUploaders = matchUploaders.String + f.ExceptUploaders = exceptUploaders.String + f.Tags = tags.String + f.ExceptTags = exceptTags.String + f.TagsMatchLogic = tagsMatchLogic.String + f.ExceptTagsMatchLogic = exceptTagsMatchLogic.String + f.UseRegex = useRegex.Bool + f.Scene = scene.Bool + f.Freeleech = freeleech.Bool + + f.Rejections = []string{} + filter = &f filtersMap[f.ID] = filter }