mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-10-09 17:29:39 +00:00
13 lines
355 B
Kotlin
13 lines
355 B
Kotlin
package cloud.kubelet.foundation.gjallarhorn.util
|
|
|
|
import org.jetbrains.exposed.sql.Op
|
|
|
|
fun compose(
|
|
combine: (Op<Boolean>, Op<Boolean>) -> Op<Boolean>,
|
|
vararg filters: Pair<() -> Boolean, () -> Op<Boolean>>
|
|
): Op<Boolean> = filters.toMap().entries
|
|
.asSequence()
|
|
.filter { it.key() }
|
|
.map { it.value() }
|
|
.fold(Op.TRUE as Op<Boolean>, combine)
|