Use slices package from the stdlib when possible (#5360)

* Use slices from the stdlib when possible

* Add some unit tests

* More small tweaks + add benchmark func
This commit is contained in:
its-josh4
2024-10-28 17:26:23 -07:00
committed by GitHub
parent 093de3bce2
commit c6bcdd89be
38 changed files with 200 additions and 110 deletions

View File

@@ -2,11 +2,11 @@ package api
import (
"context"
"slices"
"strconv"
"github.com/99designs/gqlgen/graphql"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/sliceutil"
"github.com/stashapp/stash/pkg/sliceutil/stringslice"
)
@@ -95,11 +95,11 @@ func (r *queryResolver) FindImages(
result, err = qb.Query(ctx, models.ImageQueryOptions{
QueryOptions: models.QueryOptions{
FindFilter: filter,
Count: sliceutil.Contains(fields, "count"),
Count: slices.Contains(fields, "count"),
},
ImageFilter: imageFilter,
Megapixels: sliceutil.Contains(fields, "megapixels"),
TotalSize: sliceutil.Contains(fields, "filesize"),
Megapixels: slices.Contains(fields, "megapixels"),
TotalSize: slices.Contains(fields, "filesize"),
})
if err == nil {
images, err = result.Resolve(ctx)