diff --git a/CoreStoreTests/BaseTests/BaseTestCase.swift b/CoreStoreTests/BaseTests/BaseTestCase.swift index cebbb28..b7be0a5 100644 --- a/CoreStoreTests/BaseTests/BaseTestCase.swift +++ b/CoreStoreTests/BaseTests/BaseTestCase.swift @@ -81,6 +81,33 @@ class BaseTestCase: XCTestCase { CoreStore.logger = TestLogger(expectations) } + + @nonobjc + func expectError(code: CoreStoreErrorCode, closure: () throws -> T) { + + CoreStore.logger = TestLogger(self.prepareLoggerExpectations([.logError])) + defer { + + self.checkExpectationsImmediately() + CoreStore.logger = TestLogger([:]) + } + do { + + _ = try closure() + } + catch let error as CoreStoreError { + + if error.errorCode == code.rawValue { + + return + } + XCTFail("Expected error code \(code) different from actual error: \((error as NSError).coreStoreDumpString)") + } + catch { + + XCTFail("Error not wrapped as \(cs_typeName(CoreStoreError.self)): \((error as NSError).coreStoreDumpString)") + } + } @nonobjc func prepareLoggerExpectations(_ expectations: [TestLogger.Expectation]) -> [TestLogger.Expectation: XCTestExpectation] { diff --git a/CoreStoreTests/FetchTests.swift b/CoreStoreTests/FetchTests.swift index 8d7f76e..a1676a4 100644 --- a/CoreStoreTests/FetchTests.swift +++ b/CoreStoreTests/FetchTests.swift @@ -376,17 +376,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K > %@", #keyPath(TestEntity1.testNumber), 1), OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ] - let object = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchOne(from, fetchClauses) } - XCTAssertNil(object as Any?) - - let objectID = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchObjectID(from, fetchClauses) } - XCTAssertNil(objectID as Any?) } do { @@ -394,17 +391,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K < %@", #keyPath(TestEntity1.testNumber), 4), OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let object = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchOne(from, fetchClauses) } - XCTAssertNil(object as Any?) - - let objectID = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchObjectID(from, fetchClauses) } - XCTAssertNil(objectID as Any?) } } } @@ -559,17 +553,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K > %@", #keyPath(TestEntity1.testNumber), 1), OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ] - let object = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchOne(from, fetchClauses) } - XCTAssertNil(object as Any?) - - let objectID = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchObjectID(from, fetchClauses) } - XCTAssertNil(objectID as Any?) } do { @@ -577,17 +568,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K < %@", #keyPath(TestEntity1.testNumber), 4), OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let object = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchOne(from, fetchClauses) } - XCTAssertNil(object as Any?) - - let objectID = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchObjectID(from, fetchClauses) } - XCTAssertNil(objectID as Any?) } } } @@ -881,17 +869,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K < %@", #keyPath(TestEntity1.testNumber), 4), OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } do { @@ -899,17 +884,14 @@ final class FetchTests: BaseTestDataTestCase { Where(#keyPath(TestEntity1.testNumber), isEqualTo: 0), OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } do { @@ -917,17 +899,14 @@ final class FetchTests: BaseTestDataTestCase { Where(#keyPath(TestEntity1.testNumber), isEqualTo: nil), OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } } } @@ -1119,34 +1098,28 @@ final class FetchTests: BaseTestDataTestCase { let fetchClauses: [FetchClause] = [ OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } do { let fetchClauses: [FetchClause] = [ OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try stack.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } } } @@ -1411,8 +1384,8 @@ final class FetchTests: BaseTestDataTestCase { let from = From("Config1") do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try stack.fetchCount( from, @@ -1420,11 +1393,10 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try stack.fetchCount( from, @@ -1432,11 +1404,10 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try stack.fetchCount( from, @@ -1444,7 +1415,6 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } } } @@ -1561,8 +1531,8 @@ final class FetchTests: BaseTestDataTestCase { let from = From("Config2") do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try stack.fetchCount( from, @@ -1570,11 +1540,10 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try stack.fetchCount( from, @@ -1582,11 +1551,10 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try stack.fetchCount( from, @@ -1594,7 +1562,6 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } } } @@ -1821,17 +1788,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K > %@", #keyPath(TestEntity1.testNumber), 1), OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ] - let object = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchOne(from, fetchClauses) } - XCTAssertNil(object as Any?) - - let objectID = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchObjectID(from, fetchClauses) } - XCTAssertNil(objectID as Any?) } do { @@ -1839,17 +1803,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K < %@", #keyPath(TestEntity1.testNumber), 4), OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let object = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchOne(from, fetchClauses) } - XCTAssertNil(object as Any?) - - let objectID = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchObjectID(from, fetchClauses) } - XCTAssertNil(objectID as Any?) } try transaction.cancel() } @@ -2015,17 +1976,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K > %@", #keyPath(TestEntity1.testNumber), 1), OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ] - let object = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchOne(from, fetchClauses) } - XCTAssertNil(object as Any?) - - let objectID = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchObjectID(from, fetchClauses) } - XCTAssertNil(objectID as Any?) } do { @@ -2033,17 +1991,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K < %@", #keyPath(TestEntity1.testNumber), 4), OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let object = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchOne(from, fetchClauses) } - XCTAssertNil(object as Any?) - - let objectID = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchObjectID(from, fetchClauses) } - XCTAssertNil(objectID as Any?) } try transaction.cancel() } @@ -2353,17 +2308,14 @@ final class FetchTests: BaseTestDataTestCase { Where("%K < %@", #keyPath(TestEntity1.testNumber), 4), OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } do { @@ -2371,17 +2323,14 @@ final class FetchTests: BaseTestDataTestCase { Where(#keyPath(TestEntity1.testNumber), isEqualTo: 0), OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } do { @@ -2389,17 +2338,14 @@ final class FetchTests: BaseTestDataTestCase { Where(#keyPath(TestEntity1.testNumber), isEqualTo: nil), OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } try transaction.cancel() } @@ -2614,34 +2560,28 @@ final class FetchTests: BaseTestDataTestCase { let fetchClauses: [FetchClause] = [ OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } do { let fetchClauses: [FetchClause] = [ OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ] - let objects = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchAll(from, fetchClauses) } - XCTAssertNil(objects) - - let objectIDs = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchObjectIDs(from, fetchClauses) } - XCTAssertNil(objectIDs) } try transaction.cancel() } @@ -2940,8 +2880,8 @@ final class FetchTests: BaseTestDataTestCase { let from = From("Config1") do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchCount( from, @@ -2949,11 +2889,10 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchCount( from, @@ -2961,11 +2900,10 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchCount( from, @@ -2973,7 +2911,6 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } try transaction.cancel() } @@ -3101,8 +3038,8 @@ final class FetchTests: BaseTestDataTestCase { let from = From("Config2") do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchCount( from, @@ -3110,11 +3047,10 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.ascending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchCount( from, @@ -3122,11 +3058,10 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } do { - - let count = try? self.expectLogger([.logError]) { + + self.expectError(code: .persistentStoreNotFound) { try transaction.fetchCount( from, @@ -3134,7 +3069,6 @@ final class FetchTests: BaseTestDataTestCase { OrderBy(.descending(#keyPath(TestEntity1.testEntityID))) ) } - XCTAssertNil(count) } try transaction.cancel() } diff --git a/CoreStoreTests/FromTests.swift b/CoreStoreTests/FromTests.swift index 2be6e4a..854fdf2 100644 --- a/CoreStoreTests/FromTests.swift +++ b/CoreStoreTests/FromTests.swift @@ -89,11 +89,10 @@ final class FromTests: BaseTestCase { let from = From("Config1") let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) @@ -145,11 +144,10 @@ final class FromTests: BaseTestCase { let from = From("Config2") let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) @@ -163,11 +161,10 @@ final class FromTests: BaseTestCase { let from = From() let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) @@ -181,11 +178,10 @@ final class FromTests: BaseTestCase { let from = From("Config1") let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) @@ -199,11 +195,10 @@ final class FromTests: BaseTestCase { let from = From("Config2") let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) @@ -255,11 +250,10 @@ final class FromTests: BaseTestCase { let from = From("Config2") let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) @@ -288,11 +282,10 @@ final class FromTests: BaseTestCase { let from = From("Config1") let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) @@ -306,11 +299,10 @@ final class FromTests: BaseTestCase { let from = From("Config2") let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) @@ -362,11 +354,10 @@ final class FromTests: BaseTestCase { let from = From("Config2") let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) @@ -395,11 +386,10 @@ final class FromTests: BaseTestCase { let from = From("Config1") let request = CoreStoreFetchRequest() - let storesFound: Void? = try? self.expectLogger([.logError]) { + self.expectError(code: .persistentStoreNotFound) { try from.applyToFetchRequest(request, context: dataStack.mainContext) } - XCTAssertNil(storesFound) XCTAssertNotNil(request.entity) XCTAssertNotNil(request.safeAffectedStores) diff --git a/Sources/BaseDataTransaction+Querying.swift b/Sources/BaseDataTransaction+Querying.swift index a3be030..178b8bb 100644 --- a/Sources/BaseDataTransaction+Querying.swift +++ b/Sources/BaseDataTransaction+Querying.swift @@ -137,7 +137,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the first `DynamicObject` instance that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchOne(_ from: From, _ fetchClauses: FetchClause...) throws -> D? { @@ -154,7 +154,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the first `DynamicObject` instance that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchOne(_ from: From, _ fetchClauses: [FetchClause]) throws -> D? { @@ -176,7 +176,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the first `DynamicObject` instance that satisfies the specified `FetchChainableBuilderType`, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchOne(_ clauseChain: B) throws -> B.ObjectType? { @@ -193,7 +193,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: all `DynamicObject` instances that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchAll(_ from: From, _ fetchClauses: FetchClause...) throws -> [D] { @@ -210,7 +210,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: all `DynamicObject` instances that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchAll(_ from: From, _ fetchClauses: [FetchClause]) throws -> [D] { @@ -232,7 +232,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: all `DynamicObject` instances that satisfy the specified `FetchChainableBuilderType`, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchAll(_ clauseChain: B) throws -> [B.ObjectType] { @@ -249,7 +249,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the number of `DynamicObject`s that satisfy the specified `FetchClause`s - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchCount(_ from: From, _ fetchClauses: FetchClause...) throws -> Int { @@ -266,7 +266,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the number of `DynamicObject`s that satisfy the specified `FetchClause`s - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchCount(_ from: From, _ fetchClauses: [FetchClause]) throws -> Int { @@ -288,7 +288,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the number of `DynamicObject`s that satisfy the specified `FetchChainableBuilderType` - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchCount(_ clauseChain: B) throws -> Int { @@ -305,7 +305,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectID(_ from: From, _ fetchClauses: FetchClause...) throws -> NSManagedObjectID? { @@ -322,7 +322,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectID(_ from: From, _ fetchClauses: [FetchClause]) throws -> NSManagedObjectID? { @@ -344,7 +344,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchChainableBuilderType`, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectID(_ clauseChain: B) throws -> NSManagedObjectID? { @@ -361,7 +361,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectIDs(_ from: From, _ fetchClauses: FetchClause...) throws -> [NSManagedObjectID] { @@ -378,7 +378,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectIDs(_ from: From, _ fetchClauses: [FetchClause]) throws -> [NSManagedObjectID] { @@ -400,7 +400,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchChainableBuilderType`, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectIDs(_ clauseChain: B) throws -> [NSManagedObjectID] { @@ -423,7 +423,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query, or `nil` if no match was found. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryValue(_ from: From, _ selectClause: Select, _ queryClauses: QueryClause...) throws -> U? { @@ -443,7 +443,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query, or `nil` if no match was found. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryValue(_ from: From, _ selectClause: Select, _ queryClauses: [QueryClause]) throws -> U? { @@ -467,7 +467,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `QueryChainableBuilderType` indicating the property/aggregate to fetch and the series of queries for the request. - returns: the result of the the query as specified by the `QueryChainableBuilderType`, or `nil` if no match was found. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryValue(_ clauseChain: B) throws -> B.ResultType? where B.ResultType: QueryableAttributeType { @@ -487,7 +487,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryAttributes(_ from: From, _ selectClause: Select, _ queryClauses: QueryClause...) throws -> [[String: Any]] { @@ -507,7 +507,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryAttributes(_ from: From, _ selectClause: Select, _ queryClauses: [QueryClause]) throws -> [[String: Any]] { @@ -540,7 +540,7 @@ extension BaseDataTransaction: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `QueryChainableBuilderType` indicating the properties to fetch and the series of queries for the request. - returns: the result of the the query as specified by the `QueryChainableBuilderType` - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryAttributes(_ clauseChain: B) throws -> [[String: Any]] where B.ResultType == NSDictionary { diff --git a/Sources/CoreStore+Querying.swift b/Sources/CoreStore+Querying.swift index 1687b9f..10983f6 100644 --- a/Sources/CoreStore+Querying.swift +++ b/Sources/CoreStore+Querying.swift @@ -81,7 +81,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the first `DynamicObject` instance that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchOne(_ from: From, _ fetchClauses: FetchClause...) throws -> D? { @@ -94,7 +94,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the first `DynamicObject` instance that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchOne(_ from: From, _ fetchClauses: [FetchClause]) throws -> D? { @@ -112,7 +112,7 @@ public extension CoreStore { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the first `DynamicObject` instance that satisfies the specified `FetchChainableBuilderType`, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchOne(_ clauseChain: B) throws -> B.ObjectType? { @@ -125,7 +125,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: all `DynamicObject` instances that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchAll(_ from: From, _ fetchClauses: FetchClause...) throws -> [D] { @@ -138,7 +138,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: all `DynamicObject` instances that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchAll(_ from: From, _ fetchClauses: [FetchClause]) throws -> [D] { @@ -156,7 +156,7 @@ public extension CoreStore { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: all `DynamicObject` instances that satisfy the specified `FetchChainableBuilderType`, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchAll(_ clauseChain: B) throws -> [B.ObjectType] { @@ -169,7 +169,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the number of `DynamicObject`s that satisfy the specified `FetchClause`s - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchCount(_ from: From, _ fetchClauses: FetchClause...) throws -> Int { @@ -182,7 +182,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the number of `DynamicObject`s that satisfy the specified `FetchClause`s - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchCount(_ from: From, _ fetchClauses: [FetchClause]) throws -> Int { @@ -200,7 +200,7 @@ public extension CoreStore { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the number of `DynamicObject`s that satisfy the specified `FetchChainableBuilderType` - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchCount(_ clauseChain: B) throws -> Int { @@ -213,7 +213,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchObjectID(_ from: From, _ fetchClauses: FetchClause...) throws -> NSManagedObjectID? { @@ -226,7 +226,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchObjectID(_ from: From, _ fetchClauses: [FetchClause]) throws -> NSManagedObjectID? { @@ -244,7 +244,7 @@ public extension CoreStore { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchChainableBuilderType`, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchObjectID(_ clauseChain: B) throws -> NSManagedObjectID? { @@ -257,7 +257,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchObjectIDs(_ from: From, _ fetchClauses: FetchClause...) throws -> [NSManagedObjectID] { @@ -270,7 +270,7 @@ public extension CoreStore { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchObjectIDs(_ from: From, _ fetchClauses: [FetchClause]) throws -> [NSManagedObjectID] { @@ -288,7 +288,7 @@ public extension CoreStore { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchChainableBuilderType`, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func fetchObjectIDs(_ clauseChain: B) throws -> [NSManagedObjectID] { @@ -304,7 +304,7 @@ public extension CoreStore { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query, or `nil` if no match was found. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func queryValue(_ from: From, _ selectClause: Select, _ queryClauses: QueryClause...) throws -> U? { @@ -320,7 +320,7 @@ public extension CoreStore { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query, or `nil` if no match was found. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func queryValue(_ from: From, _ selectClause: Select, _ queryClauses: [QueryClause]) throws -> U? { @@ -340,7 +340,7 @@ public extension CoreStore { ``` - parameter clauseChain: a `QueryChainableBuilderType` indicating the property/aggregate to fetch and the series of queries for the request. - returns: the result of the the query as specified by the `QueryChainableBuilderType`, or `nil` if no match was found. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func queryValue(_ clauseChain: B) throws -> B.ResultType? where B.ResultType: QueryableAttributeType { @@ -356,7 +356,7 @@ public extension CoreStore { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func queryAttributes(_ from: From, _ selectClause: Select, _ queryClauses: QueryClause...) throws -> [[String: Any]] { @@ -372,7 +372,7 @@ public extension CoreStore { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func queryAttributes(_ from: From, _ selectClause: Select, _ queryClauses: [QueryClause]) throws -> [[String: Any]] { @@ -401,7 +401,7 @@ public extension CoreStore { ``` - parameter clauseChain: a `QueryChainableBuilderType` indicating the properties to fetch and the series of queries for the request. - returns: the result of the the query as specified by the `QueryChainableBuilderType` - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public static func queryAttributes(_ clauseChain: B) throws -> [[String: Any]] where B.ResultType == NSDictionary { diff --git a/Sources/DataStack+Querying.swift b/Sources/DataStack+Querying.swift index 31495c3..a2ceb35 100644 --- a/Sources/DataStack+Querying.swift +++ b/Sources/DataStack+Querying.swift @@ -83,7 +83,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the first `DynamicObject` instance that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchOne(_ from: From, _ fetchClauses: FetchClause...) throws -> D? { @@ -100,7 +100,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the first `DynamicObject` instance that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchOne(_ from: From, _ fetchClauses: [FetchClause]) throws -> D? { @@ -122,7 +122,7 @@ extension DataStack: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the first `DynamicObject` instance that satisfies the specified `FetchChainableBuilderType`, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchOne(_ clauseChain: B) throws -> B.ObjectType? { @@ -139,7 +139,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: all `DynamicObject` instances that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchAll(_ from: From, _ fetchClauses: FetchClause...) throws -> [D] { @@ -156,7 +156,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: all `DynamicObject` instances that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchAll(_ from: From, _ fetchClauses: [FetchClause]) throws -> [D] { @@ -178,7 +178,7 @@ extension DataStack: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: all `DynamicObject` instances that satisfy the specified `FetchChainableBuilderType`, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchAll(_ clauseChain: B) throws -> [B.ObjectType] { @@ -195,7 +195,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the number of `DynamicObject`s that satisfy the specified `FetchClause`s - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchCount(_ from: From, _ fetchClauses: FetchClause...) throws -> Int { @@ -212,7 +212,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the number of `DynamicObject`s that satisfy the specified `FetchClause`s - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchCount(_ from: From, _ fetchClauses: [FetchClause]) throws -> Int { @@ -234,7 +234,7 @@ extension DataStack: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the number of `DynamicObject`s that satisfy the specified `FetchChainableBuilderType` - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchCount(_ clauseChain: B) throws -> Int { @@ -251,7 +251,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectID(_ from: From, _ fetchClauses: FetchClause...) throws -> NSManagedObjectID? { @@ -268,7 +268,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectID(_ from: From, _ fetchClauses: [FetchClause]) throws -> NSManagedObjectID? { @@ -290,7 +290,7 @@ extension DataStack: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchChainableBuilderType`, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectID(_ clauseChain: B) throws -> NSManagedObjectID? { @@ -307,7 +307,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectIDs(_ from: From, _ fetchClauses: FetchClause...) throws -> [NSManagedObjectID] { @@ -324,7 +324,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectIDs(_ from: From, _ fetchClauses: [FetchClause]) throws -> [NSManagedObjectID] { @@ -346,7 +346,7 @@ extension DataStack: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchChainableBuilderType`, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func fetchObjectIDs(_ clauseChain: B) throws -> [NSManagedObjectID] { @@ -369,7 +369,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query, or `nil` if no match was found. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryValue(_ from: From, _ selectClause: Select, _ queryClauses: QueryClause...) throws -> U? { @@ -389,7 +389,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query, or `nil` if no match was found. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryValue(_ from: From, _ selectClause: Select, _ queryClauses: [QueryClause]) throws -> U? { @@ -413,7 +413,7 @@ extension DataStack: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `QueryChainableBuilderType` indicating the property/aggregate to fetch and the series of queries for the request. - returns: the result of the the query as specified by the `QueryChainableBuilderType`, or `nil` if no match was found. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryValue(_ clauseChain: B) throws -> B.ResultType? where B.ResultType: QueryableAttributeType { @@ -433,7 +433,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryAttributes(_ from: From, _ selectClause: Select, _ queryClauses: QueryClause...) throws -> [[String: Any]] { @@ -453,7 +453,7 @@ extension DataStack: FetchableSource, QueryableSource { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryAttributes(_ from: From, _ selectClause: Select, _ queryClauses: [QueryClause]) throws -> [[String: Any]] { @@ -486,7 +486,7 @@ extension DataStack: FetchableSource, QueryableSource { ``` - parameter clauseChain: a `QueryChainableBuilderType` indicating the properties to fetch and the series of queries for the request. - returns: the result of the the query as specified by the `QueryChainableBuilderType` - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ public func queryAttributes(_ clauseChain: B) throws -> [[String: Any]] where B.ResultType == NSDictionary { diff --git a/Sources/FetchableSource.swift b/Sources/FetchableSource.swift index 1a24b66..e7688aa 100644 --- a/Sources/FetchableSource.swift +++ b/Sources/FetchableSource.swift @@ -72,7 +72,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the first `DynamicObject` instance that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchOne(_ from: From, _ fetchClauses: FetchClause...) throws -> D? @@ -82,7 +82,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the first `DynamicObject` instance that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchOne(_ from: From, _ fetchClauses: [FetchClause]) throws -> D? @@ -97,7 +97,7 @@ public protocol FetchableSource: class { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the first `DynamicObject` instance that satisfies the specified `FetchChainableBuilderType`, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchOne(_ clauseChain: B) throws -> B.ObjectType? @@ -107,7 +107,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: all `DynamicObject` instances that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchAll(_ from: From, _ fetchClauses: FetchClause...) throws -> [D] @@ -117,7 +117,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: all `DynamicObject` instances that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchAll(_ from: From, _ fetchClauses: [FetchClause]) throws -> [D] @@ -132,7 +132,7 @@ public protocol FetchableSource: class { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: all `DynamicObject` instances that satisfy the specified `FetchChainableBuilderType`, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchAll(_ clauseChain: B) throws -> [B.ObjectType] @@ -142,7 +142,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the number of `DynamicObject`s that satisfy the specified `FetchClause`s - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchCount(_ from: From, _ fetchClauses: FetchClause...) throws -> Int @@ -152,7 +152,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the number of `DynamicObject`s that satisfy the specified `FetchClause`s - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchCount(_ from: From, _ fetchClauses: [FetchClause]) throws -> Int @@ -167,7 +167,7 @@ public protocol FetchableSource: class { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the number of `DynamicObject`s that satisfy the specified `FetchChainableBuilderType` - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchCount(_ clauseChain: B) throws -> Int @@ -177,7 +177,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchObjectID(_ from: From, _ fetchClauses: FetchClause...) throws -> NSManagedObjectID? @@ -187,7 +187,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchClause`s, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchObjectID(_ from: From, _ fetchClauses: [FetchClause]) throws -> NSManagedObjectID? @@ -202,7 +202,7 @@ public protocol FetchableSource: class { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the `NSManagedObjectID` for the first `DynamicObject` that satisfies the specified `FetchChainableBuilderType`, or `nil` if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchObjectID(_ clauseChain: B) throws -> NSManagedObjectID? @@ -212,7 +212,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchObjectIDs(_ from: From, _ fetchClauses: FetchClause...) throws -> [NSManagedObjectID] @@ -222,7 +222,7 @@ public protocol FetchableSource: class { - parameter from: a `From` clause indicating the entity type - parameter fetchClauses: a series of `FetchClause` instances for the fetch request. Accepts `Where`, `OrderBy`, and `Tweak` clauses. - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchClause`s, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchObjectIDs(_ from: From, _ fetchClauses: [FetchClause]) throws -> [NSManagedObjectID] @@ -237,7 +237,7 @@ public protocol FetchableSource: class { ``` - parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses - returns: the `NSManagedObjectID` for all `DynamicObject`s that satisfy the specified `FetchChainableBuilderType`, or an empty array if no match was found - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func fetchObjectIDs(_ clauseChain: B) throws -> [NSManagedObjectID] diff --git a/Sources/QueryableSource.swift b/Sources/QueryableSource.swift index 42b2293..d7e00ed 100644 --- a/Sources/QueryableSource.swift +++ b/Sources/QueryableSource.swift @@ -43,7 +43,7 @@ public protocol QueryableSource: class { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query, or `nil` if no match was found. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func queryValue(_ from: From, _ selectClause: Select, _ queryClauses: QueryClause...) throws -> U? @@ -56,7 +56,7 @@ public protocol QueryableSource: class { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query, or `nil` if no match was found. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func queryValue(_ from: From, _ selectClause: Select, _ queryClauses: [QueryClause]) throws -> U? @@ -73,7 +73,7 @@ public protocol QueryableSource: class { ``` - parameter clauseChain: a `QueryChainableBuilderType` indicating the property/aggregate to fetch and the series of queries for the request. - returns: the result of the the query as specified by the `QueryChainableBuilderType`, or `nil` if no match was found. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func queryValue(_ clauseChain: B) throws -> B.ResultType? where B.ResultType: QueryableAttributeType @@ -86,7 +86,7 @@ public protocol QueryableSource: class { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func queryAttributes(_ from: From, _ selectClause: Select, _ queryClauses: QueryClause...) throws -> [[String: Any]] @@ -99,7 +99,7 @@ public protocol QueryableSource: class { - parameter selectClause: a `Select` clause indicating the properties to fetch, and with the generic type indicating the return type. - parameter queryClauses: a series of `QueryClause` instances for the query request. Accepts `Where`, `OrderBy`, `GroupBy`, and `Tweak` clauses. - returns: the result of the the query. The type of the return value is specified by the generic type of the `Select` parameter. - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func queryAttributes(_ from: From, _ selectClause: Select, _ queryClauses: [QueryClause]) throws -> [[String: Any]] @@ -125,7 +125,7 @@ public protocol QueryableSource: class { ``` - parameter clauseChain: a `QueryChainableBuilderType` indicating the properties to fetch and the series of queries for the request. - returns: the result of the the query as specified by the `QueryChainableBuilderType` - - throws: a `CoreStoreError` value indicating the failure if the specified entity could not be found in any store's schema. + - throws: `CoreStoreError.persistentStoreNotFound` if the specified entity could not be found in any store's schema. */ func queryAttributes(_ clauseChain: B) throws -> [[String: Any]] where B.ResultType == NSDictionary