ditto-lib / live.ditto / DittoSingleDocumentLiveQueryEvent

DittoSingleDocumentLiveQueryEvent

class DittoSingleDocumentLiveQueryEvent<T : Any>

Represents a change to a document by providing a value representing the document's old state and a value representing the document's new state. If it is the first time that one of these events is delivered for a DittoSingleDocumentLiveQuery then the isInitial value will be true and the newDocument value will be populated, if there existed a document with the relevant ID. If there is no matching document found then both oldDocument and newDocument will be nil. If the document exists and is removed at a later date then an event will be delivered where oldDocument will be the most recent version of the document and newDocument will be nil. Similarly, if there was no document with the relevant ID and a document with the ID is later added then an event will be delivered where oldDocument is nil and newDocument will be the document as it was just inserted.

Constructors

<init>

DittoSingleDocumentLiveQueryEvent(isInitial: Boolean, oldDocument: DittoDocument<T>?, newDocument: DittoDocument<T>?)

Represents a change to a document by providing a value representing the document's old state and a value representing the document's new state. If it is the first time that one of these events is delivered for a DittoSingleDocumentLiveQuery then the isInitial value will be true and the newDocument value will be populated, if there existed a document with the relevant ID. If there is no matching document found then both oldDocument and newDocument will be nil. If the document exists and is removed at a later date then an event will be delivered where oldDocument will be the most recent version of the document and newDocument will be nil. Similarly, if there was no document with the relevant ID and a document with the ID is later added then an event will be delivered where oldDocument is nil and newDocument will be the document as it was just inserted.

Properties

isInitial

val isInitial: Boolean

indicates whether or not this is the first event to be delivered for this document as part of its corresponding DittoSingleDocumentLiveQuery.

newDocument

val newDocument: DittoDocument<T>?

the representation of the document now, after the latest update.

oldDocument

val oldDocument: DittoDocument<T>?

the representation of the document before the latest update.