SQLRequestExpressible is a sub protocol of SQLSpecificExpressible

This commit is contained in:
Gwendal Roué committed 2020-04-29 23:40:37 +02:00
1 parent 69641ff7d6
commit be249bc697
5 files changed
+23 -103

No files matched your search

@@ -154,20 +154,7 @@ extension SQLInterpolation {
/// let request: SQLRequest<Player> = """
/// SELECT * FROM player WHERE score = (\(subQuery))
/// """
public mutating func appendInterpolation<RowDecoder>(_ request: SQLRequest<RowDecoder>) {
elements.append(.custom(request.sqlLiteral.sql))
}
/// Appends the request SQL (not wrapped inside parentheses).
///
/// // SELECT name FROM player WHERE score = (SELECT MAX(score) FROM player)
/// let subQuery: SQLRequest<Int> = "SELECT MAX(score) FROM player"
/// let request: SQLRequest<Player> = """
/// SELECT * FROM player WHERE score = (\(subQuery))
/// """
public mutating func appendInterpolation<RowDecoder>(_ request: QueryInterfaceRequest<RowDecoder>) {
elements.append(.custom { context in
try SQLQueryGenerator(query: request.query).sql(context)
})
public mutating func appendInterpolation(_ request: SQLRequestExpressible) {
elements.append(.custom(request.requestSQL))
}
}