Support typed errors. Misc formatting

This commit is contained in:
John Estropia
2024-09-10 11:14:39 +09:00
parent c9e091a6a4
commit 5dcf29011a
74 changed files with 3987 additions and 1441 deletions

View File

@@ -37,7 +37,9 @@ extension UnsafeDataTransaction {
- parameter object: the `DynamicObject` to observe changes from
- returns: an `ObjectMonitor` that monitors changes to `object`
*/
public func monitorObject<O: DynamicObject>(_ object: O) -> ObjectMonitor<O> {
public func monitorObject<O: DynamicObject>(
_ object: O
) -> ObjectMonitor<O> {
return .init(objectID: object.cs_id(), context: self.unsafeContext())
}
@@ -49,8 +51,11 @@ extension UnsafeDataTransaction {
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
public func monitorList<O>(_ from: From<O>, _ fetchClauses: FetchClause...) -> ListMonitor<O> {
public func monitorList<O>(
_ from: From<O>,
_ fetchClauses: FetchClause...
) -> ListMonitor<O> {
return self.monitorList(from, fetchClauses)
}
@@ -61,8 +66,11 @@ extension UnsafeDataTransaction {
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
public func monitorList<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) -> ListMonitor<O> {
public func monitorList<O>(
_ from: From<O>,
_ fetchClauses: [FetchClause]
) -> ListMonitor<O> {
Internals.assert(
fetchClauses.filter { $0 is OrderBy<O> }.count > 0,
"A ListMonitor requires an OrderBy clause."
@@ -96,8 +104,10 @@ extension UnsafeDataTransaction {
- parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses
- returns: a `ListMonitor` for a list of `DynamicObject`s that satisfy the specified `FetchChainableBuilderType`
*/
public func monitorList<B: FetchChainableBuilderType>(_ clauseChain: B) -> ListMonitor<B.ObjectType> {
public func monitorList<B: FetchChainableBuilderType>(
_ clauseChain: B
) -> ListMonitor<B.ObjectType> {
return self.monitorList(clauseChain.from, clauseChain.fetchClauses)
}
@@ -108,8 +118,12 @@ extension UnsafeDataTransaction {
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ fetchClauses: FetchClause...) {
public func monitorList<O>(
createAsynchronously: @escaping (ListMonitor<O>) -> Void,
_ from: From<O>,
_ fetchClauses: FetchClause...
) {
self.monitorList(createAsynchronously: createAsynchronously, from, fetchClauses)
}
@@ -120,8 +134,12 @@ extension UnsafeDataTransaction {
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ fetchClauses: [FetchClause]) {
public func monitorList<O>(
createAsynchronously: @escaping (ListMonitor<O>) -> Void,
_ from: From<O>,
_ fetchClauses: [FetchClause]
) {
Internals.assert(
fetchClauses.filter { $0 is OrderBy<O> }.count > 0,
"A ListMonitor requires an OrderBy clause."
@@ -155,8 +173,11 @@ extension UnsafeDataTransaction {
- parameter createAsynchronously: the closure that receives the created `ListMonitor` instance
- parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses
*/
public func monitorList<B: FetchChainableBuilderType>(createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void, _ clauseChain: B) {
public func monitorList<B: FetchChainableBuilderType>(
createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void,
_ clauseChain: B
) {
self.monitorList(
createAsynchronously: createAsynchronously,
clauseChain.from,
@@ -172,8 +193,12 @@ extension UnsafeDataTransaction {
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
public func monitorSectionedList<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: FetchClause...) -> ListMonitor<O> {
public func monitorSectionedList<O>(
_ from: From<O>,
_ sectionBy: SectionBy<O>,
_ fetchClauses: FetchClause...
) -> ListMonitor<O> {
return self.monitorSectionedList(from, sectionBy, fetchClauses)
}
@@ -185,8 +210,12 @@ extension UnsafeDataTransaction {
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
public func monitorSectionedList<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: [FetchClause]) -> ListMonitor<O> {
public func monitorSectionedList<O>(
_ from: From<O>,
_ sectionBy: SectionBy<O>,
_ fetchClauses: [FetchClause]
) -> ListMonitor<O> {
Internals.assert(
fetchClauses.filter { $0 is OrderBy<O> }.count > 0,
"A ListMonitor requires an OrderBy clause."
@@ -216,8 +245,10 @@ extension UnsafeDataTransaction {
- parameter clauseChain: a `SectionMonitorBuilderType` built from a chain of clauses
- returns: a `ListMonitor` for a list of `DynamicObject`s that satisfy the specified `SectionMonitorBuilderType`
*/
public func monitorSectionedList<B: SectionMonitorBuilderType>(_ clauseChain: B) -> ListMonitor<B.ObjectType> {
public func monitorSectionedList<B: SectionMonitorBuilderType>(
_ clauseChain: B
) -> ListMonitor<B.ObjectType> {
return self.monitorSectionedList(
clauseChain.from,
clauseChain.sectionBy,
@@ -233,8 +264,13 @@ extension UnsafeDataTransaction {
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorSectionedList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: FetchClause...) {
public func monitorSectionedList<O>(
createAsynchronously: @escaping (ListMonitor<O>) -> Void,
_ from: From<O>,
_ sectionBy: SectionBy<O>,
_ fetchClauses: FetchClause...
) {
self.monitorSectionedList(createAsynchronously: createAsynchronously, from, sectionBy, fetchClauses)
}
@@ -246,7 +282,12 @@ extension UnsafeDataTransaction {
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorSectionedList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: [FetchClause]) {
public func monitorSectionedList<O>(
createAsynchronously: @escaping (ListMonitor<O>) -> Void,
_ from: From<O>,
_ sectionBy: SectionBy<O>,
_ fetchClauses: [FetchClause]
) {
Internals.assert(
fetchClauses.filter { $0 is OrderBy<O> }.count > 0,
@@ -281,7 +322,10 @@ extension UnsafeDataTransaction {
- parameter createAsynchronously: the closure that receives the created `ListMonitor` instance
- parameter clauseChain: a `SectionMonitorBuilderType` built from a chain of clauses
*/
public func monitorSectionedList<B: SectionMonitorBuilderType>(createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void, _ clauseChain: B) {
public func monitorSectionedList<B: SectionMonitorBuilderType>(
createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void,
_ clauseChain: B
) {
self.monitorSectionedList(
createAsynchronously: createAsynchronously,