diff options
author | zeripath <art27@cantab.net> | 2020-08-24 16:48:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-24 11:48:15 -0400 |
commit | 2ae8c7ab1cc1311a493fa4efa205412664f54f96 (patch) | |
tree | f2259efafea334ef4ff3cae6de952a1d0946623f /models | |
parent | ee047312a1a3238a8504200f7ded8536ebc838e3 (diff) | |
download | gitea-2ae8c7ab1cc1311a493fa4efa205412664f54f96.tar.gz gitea-2ae8c7ab1cc1311a493fa4efa205412664f54f96.zip |
Add cron running API (#12421)
* Add cron running API
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Apply suggestions from code review
* placate-swagger
Signed-off-by: Andrew Thornton <art27@cantab.net>
* return not found
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Apply suggestions from code review
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models')
-rw-r--r-- | models/list_options.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/models/list_options.go b/models/list_options.go index 62c0944cc8..0912355352 100644 --- a/models/list_options.go +++ b/models/list_options.go @@ -37,6 +37,14 @@ func (opts ListOptions) setEnginePagination(e Engine) Engine { return e.Limit(opts.PageSize, (opts.Page-1)*opts.PageSize) } +// GetStartEnd returns the start and end of the ListOptions +func (opts ListOptions) GetStartEnd() (start, end int) { + opts.setDefaultValues() + start = (opts.Page - 1) * opts.PageSize + end = start + opts.Page + return +} + func (opts ListOptions) setDefaultValues() { if opts.PageSize <= 0 { opts.PageSize = setting.API.DefaultPagingNum |