mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-22 08:13:49 +00:00
doWithAll for readstandardcrudrepo
This commit is contained in:
parent
98276135d0
commit
083287a77b
@ -5,3 +5,7 @@
|
||||
Inited :)
|
||||
|
||||
### 0.1.1
|
||||
|
||||
* `Repos`
|
||||
* `Common`
|
||||
* Extension `ReadStandardCRUDRepo#doWithAll` has been added
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user