mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Convert GroupTable to kotlin.
Also required converting some tests to mockk.
This commit is contained in:
@@ -92,6 +92,16 @@ fun <T> Cursor.readToSingleObject(serializer: Serializer<T, Cursor>): T? {
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> Cursor.readToSingleObject(mapper: (Cursor) -> T): T? {
|
||||
return use {
|
||||
if (it.moveToFirst()) {
|
||||
mapper(it)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun Cursor.readToSingleInt(defaultValue: Int = 0): Int {
|
||||
return use {
|
||||
|
||||
Reference in New Issue
Block a user