create comment.toOutput()

This commit is contained in:
2021-03-20 01:57:10 +01:00
parent 8aa809c37e
commit 786b0bc949
19 changed files with 94 additions and 316 deletions

View File

@@ -0,0 +1,16 @@
package fr.dcproject.common.response
import fr.dcproject.common.entity.EntityI
import fr.postgresjson.connexion.Paginated
fun <E : EntityI> Paginated<E>.toOutput(setup: (E) -> Any): Any {
return object {
val count = this@toOutput.count
val currentPage = this@toOutput.count
val limit = this@toOutput.limit
val offset = this@toOutput.offset
val total = this@toOutput.total
val totalPages = this@toOutput.totalPages
val result = this@toOutput.result.map { setup(it) }
}
}