-
Undocumented
Declaration
Swift
func delete(_ query: SelectExpression) -> Result<Void, RelationError>
-
asyncAdd(_:)Extension methodUndocumented
Declaration
Swift
func asyncAdd(_ row: Row) -
asyncDelete(_:)Extension methodUndocumented
Declaration
Swift
func asyncDelete(_ query: SelectExpression)
-
Perform a cascading delete on the relation. The
queryis used for the initial deletion run. For every deleted row,cascadeis called to get further deletions to perform. When nothing remains to be deleted,completionCallbackis called.Declaration
Swift
public func cascadingDelete( _ query: SelectExpression, affectedRelations: [MutableRelation], cascade: @escaping (MutableRelation, Row) -> [(MutableRelation, SelectExpression)], update: @escaping (MutableRelation, Row) -> [CascadingUpdate] = { _, _ in [] }, completionCallback: @escaping (Result<Void, RelationError>) -> Void = { _ in })Parameters
queryThe initial query for rows to delete on this relation.
affectedRelationsAn array of all relations that this operation will affect. This array must include all relations that will be updated or deleted, otherwise notifications won’t work right. It is acceptable to pass in more than will actually be changed. This will generate spurious but harmless change notifications.
cascadeCalled for each deleted row to get cascades. Must return an array of
(MutableRelation, SelectExpression)pairs indicating what to delete next. The same relation can be specified to perform a cascading delete within the relation, or a different one can be specified to do cross-relation cascades.updateCalled for each deleted row to get updates. Must return an array of CascadingUpdate instances indicating what updates to apply on the basis of the deleted row.
completionCallbackCalled when the cascading delete completes.
-
Do a tree deletion in the relation. This will delete all rows matching the query, as well as all rows whose childAttribute matches the value in the parentAttribute of a deleted row. This proceeds recursively until the whole tree is deleted, or an error occurs.
Declaration
Swift
public func treeDelete( _ query: SelectExpression, parentAttribute: Attribute, childAttribute: Attribute, update: @escaping (MutableRelation, Row) -> [CascadingUpdate] = { _, _ in [] }, completionCallback: @escaping (Result<Void, RelationError>) -> Void = { _ in })
MutableRelation Protocol Reference