refactoring: Moves class into separated files

This commit is contained in:
2019-07-18 18:34:03 +02:00
parent 1a70f3f03b
commit 5949bc5d7b
7 changed files with 230 additions and 209 deletions

View File

@@ -0,0 +1,20 @@
package fr.postgresjson.connexion
import com.github.jasync.sql.db.util.length
import fr.postgresjson.entity.EntityI
data class Paginated<T: EntityI<*>>(
val result: List<T>,
val offset: Int,
val limit: Int,
val total: Int
) {
val currentPage: Int = (offset / limit) + 1
val count: Int = result.length
init {
if (offset < 0) error("offset must be greather or equal than 0")
if (limit < 1) error("limit must be greather than 1")
if (total < 1) error("total must be greather or equal than 0")
}
}