Symmetry with StatementColumnConvertible

This commit is contained in:
Gwendal Roué committed 2021-02-26 19:31:41 +01:00
1 parent b834b9876d
commit 37dfd95ae1
1 file changed
+14 -2
+14 -2
View File
@@ -56,7 +56,13 @@ extension DatabaseValueConvertible {
@usableFromInline
static func decode(fromRow row: Row, atUncheckedIndex index: Int) throws -> Self {
try decode(
if let sqliteStatement = row.sqliteStatement {
return try decode(
fromStatement: sqliteStatement,
atUncheckedIndex: Int32(index),
context: RowDecodingContext(row: row, key: .columnIndex(index)))
}
return try decode(
fromDatabaseValue: row.impl.databaseValue(atUncheckedIndex: index),
context: RowDecodingContext(row: row, key: .columnIndex(index)))
}
@@ -95,7 +101,13 @@ extension DatabaseValueConvertible {
@usableFromInline
static func decodeIfPresent(fromRow row: Row, atUncheckedIndex index: Int) throws -> Self? {
try decodeIfPresent(
if let sqliteStatement = row.sqliteStatement {
return try decodeIfPresent(
fromStatement: sqliteStatement,
atUncheckedIndex: Int32(index),
context: RowDecodingContext(row: row, key: .columnIndex(index)))
}
return try decodeIfPresent(
fromDatabaseValue: row.impl.databaseValue(atUncheckedIndex: index),
context: RowDecodingContext(row: row, key: .columnIndex(index)))
}