SyncAction

Defines the type of synchronization action to perform on an entity.

This enum is used to track what operation needs to be performed during the next sync operation with a remote data source. It enables fine-grained control over sync behavior and supports conflict resolution strategies.

Usage

Set the appropriate action when modifying entities:

// After creating or updating
entity.copy(syncAction = SyncAction.UPSERT, needsSync = true)

// After soft deleting
entity.copy(syncAction = SyncAction.DELETE, needsSync = true, deleted = true)

// After successful sync
entity.copy(syncAction = SyncAction.NONE, needsSync = false)

Sync Worker Implementation

when (entity.syncAction) {
SyncAction.UPSERT -> remoteDataSource.upsert(entity.toRemote())
SyncAction.DELETE -> remoteDataSource.delete(entity.id)
SyncAction.NONE -> {} // Already synced, skip
}

Entries

Link copied to clipboard

No synchronization action needed.

Link copied to clipboard

Insert or update this entity on the remote data source.

Link copied to clipboard

Delete this entity from the remote data source.

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.