DittoScopedWriteTransaction
@objc
public class DittoScopedWriteTransaction : NSObject
DittoScopedWriteTransaction
exposes functionality that allows you to perform multiple operations on the store
within a single write transaction.
-
The name of the collection that the scoped write transaction is scoped to.
Declaration
Swift
@objc public let collectionName: String
-
Insert a document into the scoped collection.
Throws
DittoKitError
Declaration
Swift
@discardableResult public func insert(_ document: [String : Any?], isDefault: Bool = false) throws -> String
Parameters
document
The document to insert.
isDefault
Represents whether or not the data being inserted should be treated as default data or not.
Return Value
The ID of the inserted document.
-
Insert a document into the scoped collection.
Throws
DittoKitError
Declaration
Swift
@discardableResult public func insert<T>(_ document: T, isDefault: Bool = false) throws -> String where T : Decodable, T : Encodable
Parameters
document
The document to insert.
isDefault
Represents whether or not the data being inserted should be treated as default data or not.
Return Value
The ID of the inserted document.
-
Generates a
DittoWriteTransactionPendingIDSpecificOperation
with the provided document ID that can be used to update, remove, or evict the document.Throws
DittoKitError
.Declaration
Swift
@objc public func findByID(_ _id: String) -> DittoWriteTransactionPendingIDSpecificOperation
Parameters
_id
The _id of the document.
Return Value
A
DittoWriteTransactionPendingIDSpecificOperation
that you can chain function calls to update, remove, or evict the document. -
Generates a
DittoWriteTransactionPendingCursorOperation
with the provided query that can be used to update, remove, or evict documents.Throws
DittoKitError
.Declaration
Swift
@objc public func find(query: String) -> DittoWriteTransactionPendingCursorOperation
Parameters
query
The query to run against the collection.
Return Value
A
DittoPendingCursorOperation
that you can use to chain further query-related function calls to update, remove, or evict the documents. -
Generates a
DittoWriteTransactionPendingCursorOperation
that can be used to update, remove or evict documents.Throws
DittoKitError
Declaration
Swift
@objc public func findAll() -> DittoWriteTransactionPendingCursorOperation
Return Value
A
DittoPendingCursorOperation
that you can use to chain further query-related function calls to update, remove, or evict the documents.