AttachmentContextImpl

open class AttachmentContextImpl(val db: PowerSyncDatabase, val table: String, logger: Logger, maxArchivedCount: Long) : AttachmentContext

Default implementation of AttachmentContext.

This class provides the standard logic for managing attachments in a SQLite table. Users can override this class if they need custom logic for handling columns or other database operations related to attachments.

Constructors

Link copied to clipboard
constructor(db: PowerSyncDatabase, table: String, logger: Logger, maxArchivedCount: Long)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open suspend override fun clearQueue()

Helper function to clear the attachment queue Currently only used for testing purposes.

Link copied to clipboard
open suspend override fun deleteArchivedAttachments(callback: suspend (attachments: List<Attachment>) -> Unit): Boolean

Delete attachments which have been archived

Link copied to clipboard
open suspend override fun deleteAttachment(id: String)

Delete the attachment from the attachment queue.

Link copied to clipboard
open suspend override fun getActiveAttachments(): List<Attachment>

Gets all the active attachments which require an operation to be performed.

Link copied to clipboard
open suspend override fun getAttachment(id: String): Attachment?

Get the attachment from the attachment queue using an ID.

Link copied to clipboard
open suspend override fun getAttachmentIds(): List<String>

Get all the ID's of attachments in the attachment queue.

Link copied to clipboard
open suspend override fun getAttachments(): List<Attachment>

Get all Attachment records present in the database.

Link copied to clipboard
open suspend override fun ignoreAttachment(id: String)

Set the state of the attachment to ignore.

Link copied to clipboard
open suspend override fun saveAttachment(attachment: Attachment): Attachment

Save the attachment to the attachment queue.

Link copied to clipboard
open suspend override fun saveAttachments(attachments: List<Attachment>)

Save the attachments to the attachment queue.

Link copied to clipboard
open override fun upsertAttachment(attachment: Attachment, context: ConnectionContext): Attachment

Upserts an attachment record synchronously given a database connection context.