mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-18 14:47:15 +00:00
add default unoptimized realization of selectByIds
This commit is contained in:
parent
7c5fc9bf7c
commit
2c2b364167
@ -6,4 +6,15 @@ interface CommonExposedRepo<IdType, ObjectType> : ExposedRepo {
|
|||||||
val ResultRow.asObject: ObjectType
|
val ResultRow.asObject: ObjectType
|
||||||
val selectById: SqlExpressionBuilder.(IdType) -> Op<Boolean>
|
val selectById: SqlExpressionBuilder.(IdType) -> Op<Boolean>
|
||||||
val selectByIds: SqlExpressionBuilder.(List<IdType>) -> Op<Boolean>
|
val selectByIds: SqlExpressionBuilder.(List<IdType>) -> Op<Boolean>
|
||||||
|
get() = { list ->
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
Op.FALSE
|
||||||
|
} else {
|
||||||
|
var op = selectById(list.first())
|
||||||
|
(1 until list.size).forEach {
|
||||||
|
op = op.and(selectById(list[it]))
|
||||||
|
}
|
||||||
|
op
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user