mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-15 21:39:24 +00:00
improve selectByIds and fill changelog
This commit is contained in:
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
## 0.24.4
|
## 0.24.4
|
||||||
|
|
||||||
|
* `Repos`:
|
||||||
|
* `Exposed`:
|
||||||
|
* Improve `CommonExposedRepo.selectByIds`
|
||||||
|
* `FSM`:
|
||||||
|
* Fixes and improvements
|
||||||
|
|
||||||
## 0.24.3
|
## 0.24.3
|
||||||
|
|
||||||
* `Ksp`:
|
* `Ksp`:
|
||||||
|
@@ -8,8 +8,16 @@ interface CommonExposedRepo<IdType, ObjectType> : ExposedRepo {
|
|||||||
val selectById: ISqlExpressionBuilder.(IdType) -> Op<Boolean>
|
val selectById: ISqlExpressionBuilder.(IdType) -> Op<Boolean>
|
||||||
val selectByIds: ISqlExpressionBuilder.(List<IdType>) -> Op<Boolean>
|
val selectByIds: ISqlExpressionBuilder.(List<IdType>) -> Op<Boolean>
|
||||||
get() = {
|
get() = {
|
||||||
it.foldRight<IdType, Op<Boolean>?>(null) { id, acc ->
|
if (it.isEmpty()) {
|
||||||
acc ?.or(selectById(id)) ?: selectById(id)
|
Op.FALSE
|
||||||
} ?: Op.FALSE
|
} else {
|
||||||
|
var op = it.firstOrNull() ?.let { selectById(it) } ?: Op.FALSE
|
||||||
|
var i = 1
|
||||||
|
while (i < it.size) {
|
||||||
|
op = op.or(selectById(it[i]))
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
op
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user