mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Merge associations: including wins over joining
This commit is contained in:
1 parent
33b40637a8
commit
37a9999b35
2 files changed
+147
-1
No files matched your search
@@ -178,9 +178,17 @@ extension AssociationQuery {
|
||||
mergedJoins.append(value: join, forKey: key)
|
||||
}
|
||||
|
||||
// There is a possible conflict when both selections are not empty.
|
||||
let mergedSelection: [SQLSelectable]
|
||||
if selection.isEmpty {
|
||||
mergedSelection = other.selection
|
||||
} else {
|
||||
mergedSelection = selection
|
||||
}
|
||||
|
||||
return AssociationQuery(
|
||||
source: mergedSource,
|
||||
selection: other.selection, // possible conflict with self.selection here.
|
||||
selection: mergedSelection,
|
||||
filterPromise: mergedFilterPromise,
|
||||
ordering: other.ordering, // reorder
|
||||
joins: mergedJoins)
|
||||
|
||||
Reference in new issue
Block a user