SqlDelightTaskRepository
SQLDelight-backed implementation of TaskRepository.
All DB operations are dispatched to Dispatchers.IO to avoid blocking the main thread.
The Tasks data class is generated by SQLDelight in the same package (io.neuralheads.kmpworker.persistence), not in the .db sub-package.
Parameters
database
The SQLDelight generated database instance.
Functions
Link copied to clipboard
Returns all persisted tasks.
Link copied to clipboard
Returns a single task by ID, or null if not found.
Link copied to clipboard
Returns tasks with status PENDING or RUNNING. Use this on app restart to recover and re-enqueue interrupted tasks.
Link copied to clipboard
Persists a new TaskRequest with status PENDING. No-ops if a task with the same ID already exists.
Link copied to clipboard
Updates the status and retry count for a task.