Finish DatabaseLookupTable — well, except for testing and seeing if it actually works.
This commit is contained in:
parent
dccc44c920
commit
54cfaefd81
|
@ -75,6 +75,8 @@ public final class DatabaseLookupTable {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private extension DatabaseLookupTable {
|
||||
|
||||
// MARK: Removing
|
||||
|
@ -187,6 +189,10 @@ private extension DatabaseLookupTable {
|
|||
|
||||
func saveLookups(for objectID: String, _ relatedObjectIDs: Set<String>, _ database: FMDatabase) {
|
||||
|
||||
for relatedObjectID in relatedObjectIDs {
|
||||
let d: [NSObject: Any] = [(objectIDKey as NSString): objectID, (relatedObjectIDKey as NSString): relatedObjectID]
|
||||
let _ = database.rs_insertRow(with: d, insertType: .orIgnore, tableName: name)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Attaching
|
||||
|
@ -269,6 +275,8 @@ private extension DatabaseLookupTable {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
||||
private struct LookupTable {
|
||||
|
||||
private let dictionary: [String: Set<String>] // objectID: Set<relatedObjectID>
|
||||
|
|
Loading…
Reference in New Issue