Improve performance of finding message positions in chats.

This commit is contained in:
Greyson Parrelli
2023-04-18 09:35:37 -04:00
committed by Cody Henthorne
parent d628921e48
commit 6db71f4a39
2 changed files with 43 additions and 36 deletions

View File

@@ -1,6 +1,7 @@
package org.signal.core.util
import android.database.Cursor
import androidx.core.database.getLongOrNull
import java.util.Optional
fun Cursor.requireString(column: String): String? {
@@ -31,6 +32,10 @@ fun Cursor.requireLong(column: String): Long {
return CursorUtil.requireLong(this, column)
}
fun Cursor.requireLongOrNull(column: String): Long? {
return this.getLongOrNull(this.getColumnIndexOrThrow(column))
}
fun Cursor.optionalLong(column: String): Optional<Long> {
return CursorUtil.getLong(this, column)
}