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:
WithoutPants
2021-02-02 07:57:56 +11:00
committed by GitHub
parent 4fd022a93b
commit e4d91a0226
24 changed files with 354 additions and 204 deletions

View File

@@ -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) + " "
}