DittoWriteTransactionPendingIDSpecificOperation

public class DittoWriteTransactionPendingIDSpecificOperation

These objects are returned when using findByID functionality on DittoScopedWriteTransactions. You can use them to perform updates on a document and remove or evict a document.

  • Remove the document with the matching ID.

    Declaration

    Swift

    @discardableResult
    public func remove() -> Bool

    Return Value

    true if the document was found and removed. false if the document wasn’t found and therefore wasn’t removed.

  • Evict the document with the matching ID.

    Declaration

    Swift

    @discardableResult
    public func evict() -> Bool

    Return Value

    true if the document was found and evicted. false if the document wasn’t found and therefore wasn’t evicted.

  • Execute the find operation to return the document with the matching ID.

    Declaration

    Swift

    public func exec() -> DittoDocument?

    Return Value

    The DittoDocument with the ID provided in the findByID call or nil if the document was not found.

  • Update the document with the matching ID.

    Declaration

    Swift

    @discardableResult
    public func update(
        _ closure: @escaping (DittoMutableDocument?) -> Void
    ) -> [DittoUpdateResult]

    Parameters

    closure

    A closure that gets called with the document matching the ID. If found, the document is a DittoMutableDocument, so you can call update-related functions on it. If the document is not found then the value provided to the closure will be nil.

    Return Value

    A list of DittoUpdateResults that describes the updates that were performed on the document.

  • Update the document with the matching ID.

    Throws

    DittoSwiftError.

    Declaration

    Swift

    public func update<T>(using newValue: T) throws where T : Decodable, T : Encodable

    Parameters

    using

    An object representing the desired new state of the document’s value.