mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-10-28 15:43:48 +00:00
add default unoptimized realization of selectByIds
This commit is contained in:
1 parent
7c5fc9bf7c
commit
2c2b364167
1 file changed
+11
+11
@@ -6,4 +6,15 @@ interface CommonExposedRepo<IdType, ObjectType> : ExposedRepo {
|
||||
val ResultRow.asObject: ObjectType
|
||||
val selectById: SqlExpressionBuilder.(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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user