@@ -22,21 +22,21 @@ abstract class DepictsDao {
22
22
private val maxItemsAllowed = 10
23
23
24
24
@Insert(onConflict = OnConflictStrategy .REPLACE )
25
- abstract fun insert (depictedItem : Depicts )
25
+ abstract suspend fun insert (depictedItem : Depicts )
26
26
27
27
@Query(" Select * From depicts_table order by lastUsed DESC" )
28
- abstract fun getAllDepicts (): List <Depicts >
28
+ abstract suspend fun getAllDepicts (): List <Depicts >
29
29
30
30
@Query(" Select * From depicts_table order by lastUsed DESC LIMIT :n OFFSET 10" )
31
- abstract fun getDepictsForDeletion (n : Int ): List <Depicts >
31
+ abstract suspend fun getDepictsForDeletion (n : Int ): List <Depicts >
32
32
33
33
@Delete
34
- abstract fun delete (depicts : Depicts )
34
+ abstract suspend fun delete (depicts : Depicts )
35
35
36
36
/* *
37
37
* Gets all Depicts objects from the database, ordered by lastUsed in descending order.
38
38
*
39
- * @return A list of Depicts objects.
39
+ * @return Deferred list of Depicts objects.
40
40
*/
41
41
fun depictsList (): Deferred <List <Depicts >> =
42
42
CoroutineScope (Dispatchers .IO ).async {
@@ -48,7 +48,7 @@ abstract class DepictsDao {
48
48
*
49
49
* @param depictedItem The Depicts object to insert.
50
50
*/
51
- private fun insertDepict (depictedItem : Depicts ) =
51
+ fun insertDepict (depictedItem : Depicts ) =
52
52
CoroutineScope (Dispatchers .IO ).launch {
53
53
insert(depictedItem)
54
54
}
@@ -59,7 +59,7 @@ abstract class DepictsDao {
59
59
* @param n The number of depicts to delete.
60
60
* @return A list of Depicts objects to delete.
61
61
*/
62
- private suspend fun depictsForDeletion (n : Int ): Deferred <List <Depicts >> =
62
+ fun depictsForDeletion (n : Int ): Deferred <List <Depicts >> =
63
63
CoroutineScope (Dispatchers .IO ).async {
64
64
getDepictsForDeletion(n)
65
65
}
@@ -69,7 +69,7 @@ abstract class DepictsDao {
69
69
*
70
70
* @param depicts The Depicts object to delete.
71
71
*/
72
- private suspend fun deleteDepicts (depicts : Depicts ) =
72
+ fun deleteDepicts (depicts : Depicts ) =
73
73
CoroutineScope (Dispatchers .IO ).launch {
74
74
delete(depicts)
75
75
}
0 commit comments