Adding and Editing Data
-
See moreDittoWriteTransaction
exposes functionality that allows you to perform multiple operations on the store within a single write transaction. You must use thescoped
function to get collection-scoped access to the write transaction object, which will then allow you to perform insert, update, remove or evict operations using the write transaction.Declaration
Swift
public class DittoWriteTransaction
-
Defines the various strategies available when inserting a document into a collection.
See moreDeclaration
Swift
public enum DittoWriteStrategy
-
See moreDittoScopedWriteTransaction
exposes functionality that allows you to perform multiple operations on the store within a single write transaction.Declaration
Swift
public class DittoScopedWriteTransaction
-
These objects are returned when using
See morefind
andfindAll
functionality onDittoScopedWriteTransaction
s. You can use them to perform updates on documents and remove or evict documents.Declaration
Swift
public class DittoWriteTransactionPendingCursorOperation
-
These objects are returned when using
See morefindByID
functionality onDittoScopedWriteTransaction
s. You can use them to perform updates on a document and remove or evict a document.Declaration
Swift
public class DittoWriteTransactionPendingIDSpecificOperation
-
These objects are returned when calling
collections()
onDittoStore
.They allow chaining of further collections-related functions. You can either call
exec
on the object to get an array ofDittoCollection
s as an immediate return value, or you can establish either a live query or a subscription, which both work over time.A live query, established by calling
observeLocal
, will notify you every time there’s a change in the collections that the device knows about.A subscription, established by calling
subscribe
, will act as a signal to other peers that the device connects to that you would like to receive updates from them about the collections that they know about.Typically, an app would set up a
subscribe
in some part of the application which is long-lived to ensure the device receives updates from the mesh. These updates will be automatically received and written into the local store. Elsewhere, where you need to use this data, anobserveLocal
can be used to notify you of the data, and all subsequent changes to the data.If you want to observe changes in such a way that you can signal when you’re ready for the live query to deliver a new update then you can call
See moreobserveWithNextSignal
orobserveLocalWithNextSignal
.Declaration
Swift
public class DittoPendingCollectionsOperation
-
Describes the result of an update operation performed on a
DittoMutableDocument
.- set: Describes the
set
update that was performed. - removed: Describes the
remove
update that was performed. - incremented: Describes the
increment
update that was performed. - pushed: Describes the
push
update that was performed. - popped: Describes the
pop
update that was performed. - inserted: Describes the
insert
update that was performed.
Declaration
Swift
public enum DittoUpdateResult
- set: Describes the
-
Describes one part of the result of a write transaction.
- inserted: Describes a document that has been inserted, referencing its ID and the collection it was inserted into.
- updated: Describes a document that has been updated, referencing its ID and the collection it belongs to.
- evicted: Describes a document that has been evicted, referencing its ID and the collection it belonged to.
- removed: Describes a document that has been removed, referencing its ID and the collection it belonged to.
Declaration
Swift
public enum DittoWriteTransactionResult