DocumentStorageWithPayload

Defines a generic interface for document storage systems, supporting storing, retrieving, updating, and deleting documents. Each document can be associated with metadata or additional payload.

Parameters

Document

The type representing the document being stored.

Payload

The type representing additional metadata or payload associated with the document.

Inheritors

Functions

Link copied to clipboard
abstract fun allDocuments(): Flow<Document>

Iterates over the documents

Link copied to clipboard

Iterates through documents and their corresponding payloads

Link copied to clipboard
abstract suspend fun delete(documentId: String): Boolean

Deletes the document with the specified ID from the storage.

Link copied to clipboard
abstract suspend fun getPayload(documentId: String): Payload?

Retrieves the payload associated with the document identified by the given document ID.

Link copied to clipboard
abstract suspend fun read(documentId: String): Document?

Reads a document associated with the given document ID and returns it.

Link copied to clipboard
abstract suspend fun readWithPayload(documentId: String): DocumentWithPayload<Document, Payload>?

Reads a document along with its associated payload based on the given document ID.

Link copied to clipboard
abstract suspend fun store(document: Document, data: Payload): String

Stores a document and its associated payload in the storage.