提交 4cf3c68d 编写于 作者: G guolindev

Add return value for LitePal.runInTransaction function.

上级 c0fa0942
......@@ -625,7 +625,7 @@ fun <T : LitePalSupport> Collection<T>.saveAll() = LitePal.saveAll(this)
* If lambda return true, all db operations in lambda will be committed.
* Otherwise all db operations will be rolled back.
*/
@Synchronized inline fun LitePal.runInTransaction(block: () -> Boolean) {
@Synchronized fun LitePal.runInTransaction(block: () -> Boolean): Boolean {
beginTransaction()
val succeeded = try {
block()
......@@ -636,4 +636,5 @@ fun <T : LitePalSupport> Collection<T>.saveAll() = LitePal.saveAll(this)
setTransactionSuccessful()
}
endTransaction()
return succeeded
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册