New SQL interpolation "... \(tableOf: record) ..." (addresses #524)

This commit is contained in:
Gwendal Roué committed 2019-05-22 08:53:50 +02:00
1 parent 7461342089
commit 21d2df9ade
4 files changed
+36 -10

No files matched your search

@@ -9,6 +9,15 @@ extension SQLInterpolation {
sql += table.databaseTableName.quotedDatabaseIdentifier
}
/// Appends the table name of the record.
///
/// // INSERT INTO player ...
/// let player: Player = ...
/// let request: SQLRequest<Player> = "INSERT INTO \(tableOf: player) ..."
public mutating func appendInterpolation<T: TableRecord>(tableOf record: T) {
sql += type(of: record).databaseTableName.quotedDatabaseIdentifier
}
/// Appends the selectable SQL.
///
/// // SELECT * FROM player