mirror of https://github.com/readrops/Readrops.git
Rename DAO files
This commit is contained in:
parent
26eaebf442
commit
476ce8a7dc
|
@ -18,7 +18,7 @@ import org.junit.Test
|
|||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class NewFeedDaoTest {
|
||||
class FeedDaoTest {
|
||||
|
||||
private lateinit var database: Database
|
||||
private lateinit var account: Account
|
|
@ -18,7 +18,7 @@ import org.junit.Test
|
|||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class NewFolderDaoTest {
|
||||
class FolderDaoTest {
|
||||
|
||||
private lateinit var database: Database
|
||||
private lateinit var account: Account
|
|
@ -6,12 +6,12 @@ import androidx.room.RoomDatabase
|
|||
import androidx.room.TypeConverters
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import com.readrops.db.dao.newdao.NewAccountDao
|
||||
import com.readrops.db.dao.newdao.NewFeedDao
|
||||
import com.readrops.db.dao.newdao.NewFolderDao
|
||||
import com.readrops.db.dao.newdao.NewItemDao
|
||||
import com.readrops.db.dao.newdao.NewItemStateChangeDao
|
||||
import com.readrops.db.dao.newdao.NewItemStateDao
|
||||
import com.readrops.db.dao.AccountDao
|
||||
import com.readrops.db.dao.FeedDao
|
||||
import com.readrops.db.dao.FolderDao
|
||||
import com.readrops.db.dao.ItemDao
|
||||
import com.readrops.db.dao.ItemStateChangeDao
|
||||
import com.readrops.db.dao.ItemStateDao
|
||||
import com.readrops.db.entities.Feed
|
||||
import com.readrops.db.entities.Folder
|
||||
import com.readrops.db.entities.Item
|
||||
|
@ -30,17 +30,17 @@ import com.readrops.db.entities.account.Account
|
|||
abstract class Database : RoomDatabase() {
|
||||
// new dao
|
||||
|
||||
abstract fun newFeedDao(): NewFeedDao
|
||||
abstract fun newFeedDao(): FeedDao
|
||||
|
||||
abstract fun newItemDao(): NewItemDao
|
||||
abstract fun newItemDao(): ItemDao
|
||||
|
||||
abstract fun newAccountDao(): NewAccountDao
|
||||
abstract fun newAccountDao(): AccountDao
|
||||
|
||||
abstract fun newFolderDao(): NewFolderDao
|
||||
abstract fun newFolderDao(): FolderDao
|
||||
|
||||
abstract fun newItemStateDao(): NewItemStateDao
|
||||
abstract fun newItemStateDao(): ItemStateDao
|
||||
|
||||
abstract fun newItemStateChangeDao(): NewItemStateChangeDao
|
||||
abstract fun newItemStateChangeDao(): ItemStateChangeDao
|
||||
}
|
||||
|
||||
object MigrationFrom1To2 : Migration(1, 2) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.readrops.db.dao.newdao
|
||||
package com.readrops.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
|
@ -6,7 +6,7 @@ import com.readrops.db.entities.account.Account
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface NewAccountDao : NewBaseDao<Account> {
|
||||
interface AccountDao : BaseDao<Account> {
|
||||
|
||||
@Query("Select * From Account")
|
||||
fun selectAllAccounts(): Flow<List<Account>>
|
|
@ -1,10 +1,10 @@
|
|||
package com.readrops.db.dao.newdao
|
||||
package com.readrops.db.dao
|
||||
|
||||
import androidx.room.Delete
|
||||
import androidx.room.Insert
|
||||
import androidx.room.Update
|
||||
|
||||
interface NewBaseDao<T> {
|
||||
interface BaseDao<T> {
|
||||
|
||||
@Insert
|
||||
suspend fun insert(entity: T): Long
|
|
@ -1,4 +1,4 @@
|
|||
package com.readrops.db.dao.newdao
|
||||
package com.readrops.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
|
@ -13,7 +13,7 @@ import com.readrops.db.pojo.FeedWithFolder2
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
abstract class NewFeedDao : NewBaseDao<Feed> {
|
||||
abstract class FeedDao : BaseDao<Feed> {
|
||||
|
||||
@Query("Select * From Feed Where id = :feedId")
|
||||
abstract suspend fun selectFeed(feedId: Int): Feed
|
|
@ -1,4 +1,4 @@
|
|||
package com.readrops.db.dao.newdao
|
||||
package com.readrops.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
|
@ -9,7 +9,7 @@ import com.readrops.db.pojo.FolderWithFeed
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface NewFolderDao : NewBaseDao<Folder> {
|
||||
interface FolderDao : BaseDao<Folder> {
|
||||
|
||||
@Query("""
|
||||
Select Feed.id As feedId, Feed.name As feedName, Feed.icon_url As feedIcon, Feed.url As feedUrl,
|
|
@ -1,4 +1,4 @@
|
|||
package com.readrops.db.dao.newdao
|
||||
package com.readrops.db.dao
|
||||
|
||||
import androidx.paging.PagingSource
|
||||
import androidx.room.Dao
|
||||
|
@ -14,7 +14,7 @@ import com.readrops.db.pojo.ItemWithFeed
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
abstract class NewItemDao : NewBaseDao<Item> {
|
||||
abstract class ItemDao : BaseDao<Item> {
|
||||
|
||||
@RawQuery(observedEntities = [Item::class, Feed::class, Folder::class, ItemState::class])
|
||||
abstract fun selectAll(query: SupportSQLiteQuery): PagingSource<Int, ItemWithFeed>
|
|
@ -1,4 +1,4 @@
|
|||
package com.readrops.db.dao.newdao
|
||||
package com.readrops.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
|
@ -7,7 +7,7 @@ import com.readrops.db.entities.ItemStateChange
|
|||
import com.readrops.db.pojo.ItemReadStarState
|
||||
|
||||
@Dao
|
||||
interface NewItemStateChangeDao: NewBaseDao<ItemStateChange> {
|
||||
interface ItemStateChangeDao: BaseDao<ItemStateChange> {
|
||||
|
||||
@Query("Delete From ItemStateChange Where account_id = :accountId")
|
||||
suspend fun resetStateChanges(accountId: Int)
|
|
@ -1,11 +1,11 @@
|
|||
package com.readrops.db.dao.newdao
|
||||
package com.readrops.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
import com.readrops.db.entities.ItemState
|
||||
|
||||
@Dao
|
||||
interface NewItemStateDao : NewBaseDao<ItemState> {
|
||||
interface ItemStateDao : BaseDao<ItemState> {
|
||||
|
||||
@Query("Delete From ItemState Where account_id = :accountId")
|
||||
suspend fun deleteItemStates(accountId: Int)
|
Loading…
Reference in New Issue