mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
RowDecodingError is Sendable
Xcode 13.2 RC won't compile unless we make a Sendable copy of the row that could not be decoded.
This commit is contained in:
1 parent
8ed16f4440
commit
3f02724e60
2 files changed
+13
-6
No files matched your search
+9
-3
@@ -2188,11 +2188,13 @@ extension RowImpl {
|
||||
|
||||
// TODO: merge with StatementCopyRowImpl eventually?
|
||||
/// See Row.init(dictionary:)
|
||||
private struct ArrayRowImpl: RowImpl {
|
||||
struct ArrayRowImpl: RowImpl {
|
||||
let columns: [(String, DatabaseValue)]
|
||||
|
||||
init(columns: [(String, DatabaseValue)]) {
|
||||
self.columns = columns
|
||||
init<C>(columns: C)
|
||||
where C: Collection, C.Element == (String, DatabaseValue)
|
||||
{
|
||||
self.columns = Array(columns)
|
||||
}
|
||||
|
||||
var count: Int { columns.count }
|
||||
@@ -2217,6 +2219,10 @@ private struct ArrayRowImpl: RowImpl {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.5.1)
|
||||
extension ArrayRowImpl: Sendable { }
|
||||
#endif
|
||||
|
||||
|
||||
// TODO: merge with ArrayRowImpl eventually?
|
||||
/// See Row.init(copiedFromStatementRef:sqliteStatement:)
|
||||
|
||||
@@ -23,9 +23,10 @@ enum RowDecodingError: Error {
|
||||
@usableFromInline
|
||||
let debugDescription: String
|
||||
|
||||
// TODO: replace with a Sendable copy of row
|
||||
let rowImpl: ArrayRowImpl // Sendable
|
||||
|
||||
/// The row that could not be decoded
|
||||
let row: Row
|
||||
var row: Row { Row(impl: rowImpl) }
|
||||
|
||||
/// Nil for RowDecodingError.keyNotFound, in order to avoid redundancy
|
||||
let key: RowKey?
|
||||
@@ -38,7 +39,7 @@ enum RowDecodingError: Error {
|
||||
|
||||
init(decodingContext: RowDecodingContext, debugDescription: String) {
|
||||
self.debugDescription = debugDescription
|
||||
self.row = decodingContext.row
|
||||
self.rowImpl = ArrayRowImpl(columns: decodingContext.row)
|
||||
self.key = decodingContext.key
|
||||
self.sql = decodingContext.sql
|
||||
self.statementArguments = decodingContext.statementArguments
|
||||
|
||||
Reference in new issue
Block a user