DittoCollection

class DittoCollection

A reference to a collection in a DittoStore.

Functions

Link copied to clipboard
fun fetchAttachment(token: DittoAttachmentToken, onFetchEvent: (DittoAttachmentFetchEvent) -> Unit): DittoAttachmentFetcher
fun fetchAttachment(token: DittoAttachmentToken, fetchEventHandler: DittoAttachmentFetchEventHandler): DittoAttachmentFetcher

Trigger an attachment to be downloaded locally to the device and observe its progress as it does so.

Link copied to clipboard
fun find(query: String): DittoPendingCursorOperation
fun find(query: String, queryArgs: Map<String, Any?>): DittoPendingCursorOperation

Generates a DittoPendingCursorOperation with the provided query that can be used to find the documents matching the query at a point in time or you can chain a call to observe, observeLocal, or subscribe if you want to get updates about documents matching the query as they occur.

Link copied to clipboard
fun findAll(): DittoPendingCursorOperation

Generates a DittoPendingCursorOperation that can be used to find all documents in the collection at a point in time or you can chain a call to observe, observeLocal, or subscribe if you want to get updates about documents in the collection over time.

Link copied to clipboard
fun findByID(id: Any): DittoPendingIDSpecificOperation
fun findByID(id: DittoDocumentID): DittoPendingIDSpecificOperation

Generates a DittoPendingIDSpecificOperation with the provided document ID that can be used to find the document at a point in time or you can chain a call to observe, observeLocal, or subscribe if you want to get updates about the document over time.

Link copied to clipboard
fun newAttachment(inputStream: InputStream, metadata: Map<String, String> = emptyMap()): DittoAttachment?
fun newAttachment(path: String, metadata: Map<String, String> = emptyMap()): DittoAttachment?

Creates a new attachment, which can then be inserted into a document.

Link copied to clipboard
fun <T : Any> upsert(value: T, writeStrategy: DittoWriteStrategy = DittoWriteStrategy.Merge): DittoDocumentID

Inserts a new document into the collection and returns its ID. If the document already exists, the behavior is determined by the given writeStrategy.

Properties

Link copied to clipboard
val name: String

the name of the collection.