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

@@ -6,12 +6,12 @@ import (
"errors"
"fmt"
"path/filepath"
"slices"
"github.com/doug-martin/goqu/v9"
"github.com/doug-martin/goqu/v9/exp"
"github.com/jmoiron/sqlx"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/sliceutil"
"gopkg.in/guregu/null.v4"
"gopkg.in/guregu/null.v4/zero"
)
@@ -412,7 +412,7 @@ func (qb *GalleryStore) FindMany(ctx context.Context, ids []int) ([]*models.Gall
}
for _, s := range unsorted {
i := sliceutil.Index(ids, s.ID)
i := slices.Index(ids, s.ID)
galleries[i] = s
}