doWithAll for readstandardcrudrepo

This commit is contained in:
InsanusMokrassar 2020-09-30 15:56:24 +06:00
parent 98276135d0
commit 083287a77b
2 changed files with 19 additions and 0 deletions

View File

@ -5,3 +5,7 @@
Inited :)
### 0.1.1
* `Repos`
* `Common`
* Extension `ReadStandardCRUDRepo#doWithAll` has been added

View File

@ -0,0 +1,15 @@
package dev.inmo.micro_utils.repos.pagination
import dev.inmo.micro_utils.pagination.doWithPagination
import dev.inmo.micro_utils.pagination.nextPageIfNotEmpty
import dev.inmo.micro_utils.repos.ReadStandardCRUDRepo
suspend inline fun <T, ID, REPO : ReadStandardCRUDRepo<T, ID>> REPO.doWithAll(
block: (List<T>) -> Unit
) {
doWithPagination {
getByPagination(it).also {
block(it.results)
}.nextPageIfNotEmpty()
}
}