Give CommonTableExpression a key, for joins

This commit is contained in:
Gwendal Roué committed 2020-11-29 18:23:41 +01:00
1 parent 00a7eb53e8
commit e1d3c1d7dc
7 files changed
+112 -40

No files matched your search

@@ -337,13 +337,8 @@ extension QueryInterfaceRequest {
}
#warning("TODO: doc")
public func with<T>(_ cte: QueryInterfaceRequest<T>, aliased alias: TableAlias) -> Self {
map(\.query) { $0.mapInto(\.ctes) { $0[alias] = .query(cte.query) } }
}
#warning("TODO: doc")
public func with<T>(_ cte: SQLRequest<T>, aliased alias: TableAlias) -> Self {
map(\.query) { $0.mapInto(\.ctes) { $0[alias] = .literal(cte.sqlLiteral) } }
public func with(_ cte: CommonTableExpression) -> Self {
map(\.query) { $0.with(\.ctes[cte.key], cte) }
}
/// Creates a request bound to type RowDecoder.