Skip to content

Commit

Permalink
publicize SQLiteRow properties (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 authored Dec 13, 2019
1 parent af6ae76 commit 1bf9748
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Sources/SQLiteNIO/SQLiteRow.swift
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
struct SQLiteColumns {
let storage: [String: Int]
public struct SQLiteColumns {
public let offsets: [String: Int]
}

public struct SQLiteRow: CustomStringConvertible {
internal let columns: SQLiteColumns
internal let data: [SQLiteData]
public let columns: SQLiteColumns
public let data: [SQLiteData]

public var description: String {
return self.columns.storage
return self.columns.offsets
.mapValues { self.data[$0] }
.description
}

public func column(_ name: String) -> SQLiteData? {
guard let offset = self.columns.storage[name] else {
guard let offset = self.columns.offsets[name] else {
return nil
}
return self.data[offset]
Expand Down
2 changes: 1 addition & 1 deletion Sources/SQLiteNIO/SQLiteStatement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal struct SQLiteStatement {
try columns[self.column(at: i)] = numericCast(i)
}

return .init(storage: columns)
return .init(offsets: columns)
}

internal func nextRow(for columns: SQLiteColumns) throws -> SQLiteRow? {
Expand Down

0 comments on commit 1bf9748

Please sign in to comment.