DittoScopedWriteTransaction
public class DittoScopedWriteTransaction
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
public var collectionName: String { get } -
Insert a document into the scoped collection.
Throws
DittoSwiftErrorDeclaration
Swift
@discardableResult public func insert( _ content: [String: Any?], withID id: String? = nil, isDefault: Bool = false ) throws -> StringParameters
documentThe document to insert.
idThe ID to use for the document. If null then Ditto will automatically assign an ID.
isDefaultRepresents whether or not the data being inserted should be treated as default data or not. Set this to
trueif you want to set a default value that you expect to be overwritten by other devices in the network. The default value isfalse.Return Value
The ID of the inserted document.
-
Insert a document into the scoped collection.
Throws
DittoSwiftErrorDeclaration
Swift
@discardableResult public func insert<T: Codable>( _ content: T, withID id: String? = nil, isDefault: Bool = false ) throws -> StringParameters
documentThe document to insert.
idThe ID to use for the document. If null then Ditto will automatically assign an ID.
isDefaultRepresents whether or not the data being inserted should be treated as default data or not. Set this to
trueif you want to set a default value that you expect to be overwritten by other devices in the network. The default value isfalse.Return Value
The ID of the inserted document.
-
Generates a
DittoWriteTransactionPendingIDSpecificOperationwith the provided document ID that can be used to update, remove, or evict the document.Throws
DittoSwiftError.Declaration
Swift
public func findByID(_ id: String) -> DittoWriteTransactionPendingIDSpecificOperationParameters
idThe ID of the document.
Return Value
A
DittoWriteTransactionPendingIDSpecificOperationthat you can chain function calls to update, remove, or evict the document. -
Generates a
DittoWriteTransactionPendingCursorOperationwith the provided query that can be used to update, remove, or evict documents.Declaration
Swift
public func find(query: String) -> DittoWriteTransactionPendingCursorOperationParameters
queryThe query to run against the collection.
Return Value
A
DittoWriteTransactionPendingCursorOperationthat you can use to chain further query-related function calls to update, remove, or evict the documents. -
Generates a
DittoWriteTransactionPendingCursorOperationthat can be used to update, remove or evict documents.Declaration
Swift
public func findAll() -> DittoWriteTransactionPendingCursorOperationReturn Value
A
DittoWriteTransactionPendingCursorOperationthat you can use to chain further query-related function calls to update, remove, or evict the documents.
DittoScopedWriteTransaction Class Reference