mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
SuffixRowAdapter index preconditions
This commit is contained in:
1 parent
09a672561d
commit
2606f7196e
1 file changed
+2
@@ -199,11 +199,13 @@ public struct SuffixRowAdapter : RowAdapter {
|
||||
///
|
||||
/// If index is 0, the adapted row is identical to the original row.
|
||||
public init(fromIndex index: Int) {
|
||||
GRDBPrecondition(index >= 0, "Negative column index is out of range")
|
||||
self.index = index
|
||||
}
|
||||
|
||||
/// Part of the RowAdapter protocol
|
||||
public func concreteRowAdapter(with statement: SelectStatement) throws -> ConcreteRowAdapter {
|
||||
GRDBPrecondition(index <= statement.columnCount, "Column index is out of range")
|
||||
return AdaptedColumnsDescription(columns: statement.columnNames.suffixFrom(index).enumerate().map { ($0 + index, $1) })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user