Implement user/scores/best

This commit is contained in:
Howl
2016-05-19 17:15:17 +02:00
parent 45c67cf9b7
commit da2a36537e
5 changed files with 163 additions and 8 deletions

View File

@@ -6,7 +6,7 @@ import (
)
// Paginate creates an additional SQL LIMIT clause for paginating.
func Paginate(page, limit string) string {
func Paginate(page, limit string, maxLimit int) string {
var (
pInt int
lInt int
@@ -34,6 +34,9 @@ func Paginate(page, limit string) string {
if lInt < 1 {
lInt = 50
}
if lInt > maxLimit {
lInt = maxLimit
}
start := (pInt - 1) * lInt
return fmt.Sprintf(" LIMIT %d,%d ", start, lInt)
}