White space

This commit is contained in:
Gwendal Roué committed 2019-02-02 17:57:01 +01:00
1 parent 27c6390635
commit f42d5f202d
4 files changed
+13 -13

No files matched your search

@@ -307,15 +307,15 @@ extension Association where OriginRowDecoder: MutablePersistableRecord {
func request(from record: OriginRowDecoder) -> QueryInterfaceRequest<RowDecoder> {
// Goal: turn `JOIN association ON association.recordId = record.id`
// into a regular request `SELECT * FROM association WHERE association.recordId = 123`
// We need table aliases to build the joining condition
let associationAlias = TableAlias()
let recordAlias = TableAlias()
// Turn the association query into a query interface request:
// JOIN association -> SELECT FROM association
return QueryInterfaceRequest(query: SQLSelectQuery(relation: relation))
// Turn the JOIN condition into a regular WHERE condition
.filter { db in
// Build a join condition: `association.recordId = record.id`
@@ -323,16 +323,16 @@ extension Association where OriginRowDecoder: MutablePersistableRecord {
guard let joinExpression = try self.joinCondition.sqlExpression(db, leftAlias: recordAlias, rightAlias: associationAlias) else {
fatalError("Can't request from record without join condition")
}
// Serialize record: ["id": 123, ...]
// We do it as late as possible, when request is about to be
// executed, in order to support long-lived reference types.
let container = PersistenceContainer(record)
// Replace `record.id` with 123
return joinExpression.resolvedExpression(inContext: [recordAlias: container])
}
// We just added a condition qualified with associationAlias. Don't
// risk introducing conflicting aliases that would prevent the user
// from setting a custom alias name: force the same alias for the
@@ -64,9 +64,9 @@ public struct BelongsToAssociation<Origin, Destination>: Association {
/// :nodoc:
public typealias RowDecoder = Destination
public var key: String
/// :nodoc:
public /* TODO: make internal when no longer required by Association */ let joinCondition: JoinCondition
@@ -64,9 +64,9 @@ public struct HasManyAssociation<Origin, Destination>: Association {
/// :nodoc:
public typealias RowDecoder = Destination
public var key: String
/// :nodoc:
public /* TODO: make internal when no longer required by Association */ let joinCondition: JoinCondition
@@ -175,7 +175,7 @@ extension HasManyAssociation where Origin: TableRecord, Destination: TableRecord
return aggregate
}
}
/// The sum of the given expression in associated records.
///
/// For example:
@@ -66,9 +66,9 @@ public struct HasOneAssociation<Origin, Destination> : Association {
/// :nodoc:
public typealias RowDecoder = Destination
public var key: String
/// :nodoc:
public /* TODO: make internal when no longer required by Association */ let joinCondition: JoinCondition