1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add integration tests for entries

This commit is contained in:
Frédéric Guillot 2017-11-26 15:07:59 -08:00
parent 51f7775466
commit 8781648af9
9 changed files with 356 additions and 43 deletions

View file

@ -68,6 +68,19 @@ func ValidateDirection(direction string) error {
return fmt.Errorf(`Invalid direction, valid direction values are: "asc" or "desc"`)
}
// ValidateRange makes sure the offset/limit values are valid.
func ValidateRange(offset, limit int) error {
if offset < 0 {
return fmt.Errorf(`Offset value should be >= 0`)
}
if limit < 0 {
return fmt.Errorf(`Limit value should be >= 0`)
}
return nil
}
// GetOppositeDirection returns the opposite sorting direction.
func GetOppositeDirection(direction string) string {
if direction == "asc" {