AchievementsDao

interface AchievementsDao

Data Access Layer that defines the CRUD operations for AchievementsTuple I want all reads and writes to be one-shot, so suspend functions are used

  • https://developer.android.com/training/data-storage/room/async-queries#options

"Room uses its own dispatcher to run queries on a background thread. Your code should not use withContext(Dispatchers.IO) to call suspending room queries. It will complicate the code and make your queries run slower." says an Engineer from Google (even though it's not in the docs ...)

  • https://medium.com/androiddevelopers/coroutines-on-android-part-iii-real-work-2ba8a2ec2f45

Functions

Link copied to clipboard
abstract suspend fun get(objectName: String): AchievementsTuple?
Link copied to clipboard
abstract suspend fun getAllOrderedByCompletionAndName(limit: Short = Short.MAX_VALUE): List<AchievementsTuple>

Gets all AchievementsTuple ordered by completion status and then by name

Link copied to clipboard
abstract suspend fun getAllOrderedByName(limit: Short = Short.MAX_VALUE): List<AchievementsTuple>

Gets all AchievementsTuple ordered by name

Link copied to clipboard
abstract suspend fun getAllUnreachedAchievements(limit: Short = Short.MAX_VALUE): List<AchievementsTuple>
Link copied to clipboard
abstract suspend fun insert(item: AchievementsTuple)
Link copied to clipboard
abstract suspend fun insertAll(items: List<AchievementsTuple>)
Link copied to clipboard
abstract suspend fun resetAll()