Genericise sliceutil functions (#4253)

* Genericise sliceutil.SliceSame
* Genericise intslice functions
* Genericise stringutil functions
This commit is contained in:
DingDongSoLong4
2023-11-01 23:58:32 +02:00
committed by GitHub
parent cc6673f276
commit 9621213424
51 changed files with 259 additions and 409 deletions

View File

@@ -18,7 +18,7 @@ import (
"gopkg.in/guregu/null.v4/zero"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/sliceutil/intslice"
"github.com/stashapp/stash/pkg/sliceutil"
"github.com/stashapp/stash/pkg/utils"
)
@@ -456,7 +456,7 @@ func (qb *SceneStore) FindMany(ctx context.Context, ids []int) ([]*models.Scene,
}
for _, s := range unsorted {
i := intslice.IntIndex(ids, s.ID)
i := sliceutil.Index(ids, s.ID)
scenes[i] = s
}
@@ -1819,7 +1819,7 @@ func (qb *SceneStore) FindDuplicates(ctx context.Context, distance int, duration
var sceneIds []int
for _, strId := range strIds {
if intId, err := strconv.Atoi(strId); err == nil {
sceneIds = intslice.IntAppendUnique(sceneIds, intId)
sceneIds = sliceutil.AppendUnique(sceneIds, intId)
}
}
// filter out