From c502c70a21aa35db982904e2d9c92c98c46d68c3 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 2 Mar 2021 00:54:21 +0600 Subject: [PATCH] should fix lint errors --- .../micro_utils/repos/DatabaseOperations.kt | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/DatabaseOperations.kt b/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/DatabaseOperations.kt index b1cfdb28804..35b04fa0c4b 100644 --- a/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/DatabaseOperations.kt +++ b/repos/common/src/main/kotlin/dev/inmo/micro_utils/repos/DatabaseOperations.kt @@ -26,20 +26,39 @@ fun SQLiteDatabase.createTable( } } -fun Cursor.getString(columnName: String) = getString( - getColumnIndex(columnName) +/** + * @throws IllegalArgumentException + */ +fun Cursor.getString(columnName: String): String = getString( + getColumnIndexOrThrow(columnName) ) -fun Cursor.getLong(columnName: String) = getLong( - getColumnIndex(columnName) +/** + * @throws IllegalArgumentException + */ +fun Cursor.getShort(columnName: String): Short = getShort( + getColumnIndexOrThrow(columnName) ) -fun Cursor.getInt(columnName: String) = getInt( - getColumnIndex(columnName) +/** + * @throws IllegalArgumentException + */ +fun Cursor.getLong(columnName: String): Long = getLong( + getColumnIndexOrThrow(columnName) ) -fun Cursor.getDouble(columnName: String) = getDouble( - getColumnIndex(columnName) +/** + * @throws IllegalArgumentException + */ +fun Cursor.getInt(columnName: String): Int = getInt( + getColumnIndexOrThrow(columnName) +) + +/** + * @throws IllegalArgumentException + */ +fun Cursor.getDouble(columnName: String): Double = getDouble( + getColumnIndexOrThrow(columnName) ) fun SQLiteDatabase.select(