File tree Expand file tree Collapse file tree
app/src/main/kotlin/org/btcmap/db Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,9 +34,14 @@ fun SQLiteStatement.getTextOrNull(index: Int): String? =
3434fun SQLiteStatement.getLongOrNull (index : Int ): Long? =
3535 if (isNull(index)) null else getLong(index)
3636
37+ fun SQLiteStatement.getZonedDateTime (index : Int ): ZonedDateTime =
38+ ZonedDateTime .parse(getText(index))
39+
3740fun SQLiteStatement.getZonedDateTimeOrNull (index : Int ): ZonedDateTime ? =
3841 if (isNull(index)) null else ZonedDateTime .parse(getText(index))
3942
43+ fun SQLiteStatement.getHttpUrl (index : Int ): HttpUrl = getText(index).toHttpUrl()
44+
4045fun SQLiteStatement.getHttpUrlOrNull (index : Int ): HttpUrl ? =
4146 if (isNull(index)) null else getText(index).toHttpUrl()
4247
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ package org.btcmap.db.table.event
22
33import androidx.sqlite.SQLiteStatement
44import okhttp3.HttpUrl
5- import okhttp3.HttpUrl.Companion.toHttpUrl
5+ import org.btcmap.db.getHttpUrl
66import org.btcmap.db.getLongOrNull
77import org.btcmap.db.getTextOrNull
8+ import org.btcmap.db.getZonedDateTime
89import org.btcmap.db.getZonedDateTimeOrNull
910import java.time.ZonedDateTime
1011
@@ -31,8 +32,8 @@ data class FullProjection(
3132 lat = stmt.getDouble(2 ),
3233 lon = stmt.getDouble(3 ),
3334 name = stmt.getText(4 ),
34- website = stmt.getText( 5 ).toHttpUrl( ),
35- startsAt = ZonedDateTime .parse( stmt.getText( 6 ) ),
35+ website = stmt.getHttpUrl( 5 ),
36+ startsAt = stmt.getZonedDateTime( 6 ),
3637 endsAt = stmt.getZonedDateTimeOrNull(7 ),
3738 cronSchedule = stmt.getTextOrNull(8 ),
3839 )
You can’t perform that action at this time.
0 commit comments