【问题标题】:Getting the number of deleted rows in Kotlin's Exposed?获取 Kotlin 的 Exposed 中删除的行数?
【发布时间】:2020-11-08 02:55:28
【问题描述】:

我目前有一些类似的东西

transaction {
    FooTable.deleteWhere { FooTable.BarId eq 1 }
}

我想看看它成功删除了多少行(我真的只是想确保之前有一个条目并被删除)。关于如何做到这一点的任何想法?

【问题讨论】:

    标签: kotlin kotlin-exposed


    【解决方案1】:

    试试这个:

    transaction {
       var numberOfDeletedItems = FooTable.deleteWhere { FooTable.BarId eq 1 }
    }
    

    【讨论】:

    • 谢谢!为了清楚起见,可能应该命名为numberOfDeletdItems。但我想这很容易
    猜你喜欢
    • 2021-05-15
    • 1970-01-01
    • 1970-01-01
    • 2019-04-15
    • 2022-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多