Move fetchObjectsWithIDs from AttachmentsTable to default protocol implementation since AuthorsTable needs the exact same thing.

This commit is contained in:
Brent Simmons
2017-09-12 21:47:04 -07:00
parent 9341515926
commit 8f12df8f5b
6 changed files with 87 additions and 49 deletions

View File

@@ -0,0 +1,33 @@
//
// DatabaseObjectCache.swift
// RSDatabase
//
// Created by Brent Simmons on 9/12/17.
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
//
import Foundation
public final class DatabaseObjectCache {
private var d = [String: DatabaseObject]()
public init() {
//
}
public func add(_ databaseObjects: [DatabaseObject]) {
for databaseObject in databaseObjects {
self[databaseObject.databaseID] = databaseObject
}
}
public subscript(_ databaseID: String) -> DatabaseObject? {
get {
return d[databaseID]
}
set {
d[databaseID] = newValue
}
}
}