diff --git a/Frameworks/RSDatabase/RSDatabase.xcodeproj/project.pbxproj b/Frameworks/RSDatabase/RSDatabase.xcodeproj/project.pbxproj index b8968615b..a28818ebc 100755 --- a/Frameworks/RSDatabase/RSDatabase.xcodeproj/project.pbxproj +++ b/Frameworks/RSDatabase/RSDatabase.xcodeproj/project.pbxproj @@ -35,8 +35,8 @@ 84419B061B5ABFF700C26BB2 /* FMResultSet+RSExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 84419B041B5ABFF700C26BB2 /* FMResultSet+RSExtras.m */; }; 844ECFB91F5B17F9005E405A /* DatabaseRelatedObjectsTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844ECFB81F5B17F9005E405A /* DatabaseRelatedObjectsTable.swift */; }; 848E22541F6652990031D7C5 /* DatabaseRelatedObjectsTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 844ECFB81F5B17F9005E405A /* DatabaseRelatedObjectsTable.swift */; }; - 848E22561F6652C70031D7C5 /* RelatedObjectsLookupTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848E22551F6652C70031D7C5 /* RelatedObjectsLookupTable.swift */; }; - 848E22581F6653960031D7C5 /* RelatedObjectIDsLookupTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848E22571F6653960031D7C5 /* RelatedObjectIDsLookupTable.swift */; }; + 848E22561F6652C70031D7C5 /* RelatedObjectsMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848E22551F6652C70031D7C5 /* RelatedObjectsMap.swift */; }; + 848E22581F6653960031D7C5 /* RelatedObjectIDsMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848E22571F6653960031D7C5 /* RelatedObjectIDsMap.swift */; }; 849BF8C61C94FB8E0071D1DA /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 849BF8C51C94FB8E0071D1DA /* libsqlite3.tbd */; }; 84ABC1D11F364B07000DCC55 /* DatabaseLookupTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84ABC1D01F364B07000DCC55 /* DatabaseLookupTable.swift */; }; 84ABC1D21F364B07000DCC55 /* DatabaseLookupTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84ABC1D01F364B07000DCC55 /* DatabaseLookupTable.swift */; }; @@ -76,8 +76,8 @@ 84419B031B5ABFF700C26BB2 /* FMResultSet+RSExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "FMResultSet+RSExtras.h"; path = "RSDatabase/FMResultSet+RSExtras.h"; sourceTree = ""; }; 84419B041B5ABFF700C26BB2 /* FMResultSet+RSExtras.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "FMResultSet+RSExtras.m"; path = "RSDatabase/FMResultSet+RSExtras.m"; sourceTree = ""; }; 844ECFB81F5B17F9005E405A /* DatabaseRelatedObjectsTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseRelatedObjectsTable.swift; sourceTree = ""; }; - 848E22551F6652C70031D7C5 /* RelatedObjectsLookupTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelatedObjectsLookupTable.swift; sourceTree = ""; }; - 848E22571F6653960031D7C5 /* RelatedObjectIDsLookupTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelatedObjectIDsLookupTable.swift; sourceTree = ""; }; + 848E22551F6652C70031D7C5 /* RelatedObjectsMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelatedObjectsMap.swift; sourceTree = ""; }; + 848E22571F6653960031D7C5 /* RelatedObjectIDsMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelatedObjectIDsMap.swift; sourceTree = ""; }; 849BF8C51C94FB8E0071D1DA /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; 84ABC1D01F364B07000DCC55 /* DatabaseLookupTable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseLookupTable.swift; sourceTree = ""; }; 84C6DD001F395C13009AFB47 /* DatabaseObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DatabaseObject.swift; path = RSDatabase/DatabaseObject.swift; sourceTree = ""; }; @@ -143,8 +143,8 @@ isa = PBXGroup; children = ( 84ABC1D01F364B07000DCC55 /* DatabaseLookupTable.swift */, - 848E22551F6652C70031D7C5 /* RelatedObjectsLookupTable.swift */, - 848E22571F6653960031D7C5 /* RelatedObjectIDsLookupTable.swift */, + 848E22551F6652C70031D7C5 /* RelatedObjectsMap.swift */, + 848E22571F6653960031D7C5 /* RelatedObjectIDsMap.swift */, 844ECFB81F5B17F9005E405A /* DatabaseRelatedObjectsTable.swift */, ); path = "Related Objects"; @@ -398,8 +398,8 @@ 844ECFB91F5B17F9005E405A /* DatabaseRelatedObjectsTable.swift in Sources */, 84419B061B5ABFF700C26BB2 /* FMResultSet+RSExtras.m in Sources */, 84DDF1991C94FC45005E6CF5 /* FMDatabaseAdditions.m in Sources */, - 848E22581F6653960031D7C5 /* RelatedObjectIDsLookupTable.swift in Sources */, - 848E22561F6652C70031D7C5 /* RelatedObjectsLookupTable.swift in Sources */, + 848E22581F6653960031D7C5 /* RelatedObjectIDsMap.swift in Sources */, + 848E22561F6652C70031D7C5 /* RelatedObjectsMap.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Frameworks/RSDatabase/Related Objects/DatabaseLookupTable.swift b/Frameworks/RSDatabase/Related Objects/DatabaseLookupTable.swift index 2ff2883fc..88bc9c2e1 100644 --- a/Frameworks/RSDatabase/Related Objects/DatabaseLookupTable.swift +++ b/Frameworks/RSDatabase/Related Objects/DatabaseLookupTable.swift @@ -32,7 +32,7 @@ public final class DatabaseLookupTable { self.cache = DatabaseLookupTableCache(relationshipName) } - public func fetchRelatedObjects(for objectIDs: Set, in database: FMDatabase) -> RelatedObjectsLookupTable? { + public func fetchRelatedObjects(for objectIDs: Set, in database: FMDatabase) -> RelatedObjectsMap? { let objectIDsThatMayHaveRelatedObjects = objectIDs.subtracting(objectIDsWithNoRelatedObjects) if objectIDsThatMayHaveRelatedObjects.isEmpty { diff --git a/Frameworks/RSDatabase/Related Objects/DatabaseRelatedObjectsTable.swift b/Frameworks/RSDatabase/Related Objects/DatabaseRelatedObjectsTable.swift index 8ae203bb0..43155db2a 100644 --- a/Frameworks/RSDatabase/Related Objects/DatabaseRelatedObjectsTable.swift +++ b/Frameworks/RSDatabase/Related Objects/DatabaseRelatedObjectsTable.swift @@ -8,6 +8,8 @@ import Foundation +// Protocol for a database table for related objects — authors, tags, and attachments in Evergreen, for instance. + public protocol DatabaseRelatedObjectsTable: DatabaseTable { var databaseIDKey: String { get} diff --git a/Frameworks/RSDatabase/Related Objects/RelatedObjectIDsLookupTable.swift b/Frameworks/RSDatabase/Related Objects/RelatedObjectIDsMap.swift similarity index 93% rename from Frameworks/RSDatabase/Related Objects/RelatedObjectIDsLookupTable.swift rename to Frameworks/RSDatabase/Related Objects/RelatedObjectIDsMap.swift index e8cf4a76f..ea034af53 100644 --- a/Frameworks/RSDatabase/Related Objects/RelatedObjectIDsLookupTable.swift +++ b/Frameworks/RSDatabase/Related Objects/RelatedObjectIDsMap.swift @@ -1,5 +1,5 @@ // -// RelatedObjectIDsLookupTable.swift +// RelatedObjectIDsMap.swift // RSDatabase // // Created by Brent Simmons on 9/10/17. @@ -10,7 +10,7 @@ import Foundation // Maps objectIDs to Set where the Strings are relatedObjectIDs. -struct RelatedObjectIDsLookupTable { +struct RelatedObjectIDsMap { private let dictionary: [String: Set] // objectID: Set diff --git a/Frameworks/RSDatabase/Related Objects/RelatedObjectsLookupTable.swift b/Frameworks/RSDatabase/Related Objects/RelatedObjectsMap.swift similarity index 88% rename from Frameworks/RSDatabase/Related Objects/RelatedObjectsLookupTable.swift rename to Frameworks/RSDatabase/Related Objects/RelatedObjectsMap.swift index 6f9137772..bcbbb6f5b 100644 --- a/Frameworks/RSDatabase/Related Objects/RelatedObjectsLookupTable.swift +++ b/Frameworks/RSDatabase/Related Objects/RelatedObjectsMap.swift @@ -1,5 +1,5 @@ // -// RelatedObjectsLookupTable.swift +// RelatedObjectsMap.swift // RSDatabase // // Created by Brent Simmons on 9/10/17. @@ -8,7 +8,9 @@ import Foundation -public struct RelatedObjectsLookupTable { +// Map objectID to [DatabaseObject] (related objects). + +public struct RelatedObjectsMap { private let dictionary: [String: [DatabaseObject]] // objectID: relatedObjects