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)Content copied to clipboard
Sync Worker Implementation
when (entity.syncAction) {
SyncAction.UPSERT -> remoteDataSource.upsert(entity.toRemote())
SyncAction.DELETE -> remoteDataSource.delete(entity.id)
SyncAction.NONE -> {} // Already synced, skip
}Content copied to clipboard
Entries
Properties
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.