Internal API experiment: KeyPathRefining

This commit is contained in:
Gwendal Roué committed 2020-01-21 19:37:19 +01:00
1 parent 66bce33a36
commit 349e34b1c1
12 files changed
+162 -171

No files matched your search

@@ -574,13 +574,14 @@ private struct SQLQualifiedRelation {
/// Removes all selections from joins
func selectOnly(_ selection: [SQLSelectable]) -> SQLQualifiedRelation {
var relation = self
relation.sourceSelection = selection.map { $0.qualifiedSelectable(with: sourceAlias) }
relation.joins = relation.joins.mapValues { $0.selectOnly([]) }
return relation
return self
.with(\.sourceSelection, selection.map { $0.qualifiedSelectable(with: sourceAlias) })
.map(\.joins, { $0.mapValues { $0.selectOnly([]) } })
}
}
extension SQLQualifiedRelation: KeyPathRefining { }
/// A "qualified" source, where all tables are identified with a table alias.
private enum SQLQualifiedSource {
case table(tableName: String, alias: TableAlias)