/**
* Delete records that satisfy the given [predicate].
*/
open fun deleteIf(predicate: (T) -> ColumnDeclaring<Boolean>, limit: Int? = null): Int {
var seq = database.sequenceOf(tableObject)
limit?.let { seq = seq.take(limit) }
return seq.removeIf(predicate)
}
使用时会报错
java.lang.UnsupportedOperationException: Entity manipulation functions are not supported by this sequence object. Please call on the origin sequence returned from database.sequenceOf(table)
at org.ktorm.entity.EntityDmlKt.checkForDml(EntityDml.kt:217) ~[ktorm-core-3.5.0.jar:na]
at org.ktorm.entity.EntityDmlKt.removeIf(EntityDml.kt:135) ~[ktorm-core-3.5.0.jar:na]
at com.kuaishou.videoqa.kperf.db.mysql.BaseDao.deleteIf(BaseDao.kt:51) ~[classes/:na]
使用时会报错