mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
SelectStatement.SelectionInfo.description
This commit is contained in:
1 parent
1ad00e1102
commit
7bc3582525
1 file changed
+9
-1
@@ -254,7 +254,7 @@ public final class SelectStatement : Statement {
|
||||
}
|
||||
|
||||
/// Information about the table and columns read by a SelectStatement
|
||||
public struct SelectionInfo {
|
||||
public struct SelectionInfo : CustomStringConvertible {
|
||||
mutating func insert(column: String, ofTable table: String) {
|
||||
if selection[table] != nil {
|
||||
selection[table]!.insert(column)
|
||||
@@ -272,6 +272,14 @@ public final class SelectStatement : Statement {
|
||||
}
|
||||
|
||||
private var selection: [String: Set<String>] = [:] // [TableName: Set<ColumnName>]
|
||||
|
||||
/// A textual representation of `self`.
|
||||
public var description: String {
|
||||
return selection
|
||||
.sorted { $0.key < $1.key }
|
||||
.map { (table, columns) in "\(table)(\(columns.sorted().joined(separator: ", ")))" }
|
||||
.joined(separator: ", ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user