mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
String regex filter criteria and selective autotag (#1082)
* Add regex string filter criterion * Use query interface for auto tagging * Use Query interface for filename parser * Remove query regex interfaces * Add selective auto tag * Use page size 0 as no limit
This commit is contained in:
@@ -32,26 +32,14 @@ func getPagination(findFilter *models.FindFilterType) string {
|
||||
panic("nil find filter for pagination")
|
||||
}
|
||||
|
||||
var page int
|
||||
if findFilter.Page == nil || *findFilter.Page < 1 {
|
||||
page = 1
|
||||
} else {
|
||||
page = *findFilter.Page
|
||||
if findFilter.IsGetAll() {
|
||||
return " "
|
||||
}
|
||||
|
||||
var perPage int
|
||||
if findFilter.PerPage == nil {
|
||||
perPage = 25
|
||||
} else {
|
||||
perPage = *findFilter.PerPage
|
||||
}
|
||||
|
||||
if perPage > 1000 {
|
||||
perPage = 1000
|
||||
} else if perPage < 1 {
|
||||
perPage = 1
|
||||
}
|
||||
return getPaginationSQL(findFilter.GetPage(), findFilter.GetPageSize())
|
||||
}
|
||||
|
||||
func getPaginationSQL(page int, perPage int) string {
|
||||
page = (page - 1) * perPage
|
||||
return " LIMIT " + strconv.Itoa(perPage) + " OFFSET " + strconv.Itoa(page) + " "
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user