add default unoptimized realization of selectByIds

This commit is contained in:
InsanusMokrassar 2022-08-22 01:25:07 +06:00
parent 7c5fc9bf7c
commit 2c2b364167

View File

@ -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
}
}
}