pull/49/head
parent
94ec767e31
commit
973579c9e5
@ -0,0 +1,24 @@ |
||||
package io.legado.app.data.dao |
||||
|
||||
import androidx.lifecycle.LiveData |
||||
import androidx.room.* |
||||
import io.legado.app.data.entities.RssStar |
||||
|
||||
@Dao |
||||
interface RssStarDao { |
||||
|
||||
@Query("select * from rssStars where origin = :origin and link = :link") |
||||
fun get(origin: String, link: String): RssStar? |
||||
|
||||
@Query("select * from rssStars order by starTime desc") |
||||
fun liveAll(): LiveData<List<RssStar>> |
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE) |
||||
fun insert(vararg rssStar: RssStar) |
||||
|
||||
@Update |
||||
fun update(vararg rssStar: RssStar) |
||||
|
||||
@Query("delete from rssStars where origin = :origin") |
||||
fun delete(origin: String) |
||||
} |
@ -0,0 +1,20 @@ |
||||
package io.legado.app.data.entities |
||||
|
||||
import androidx.room.Entity |
||||
|
||||
|
||||
@Entity( |
||||
tableName = "rssStars", |
||||
primaryKeys = ["origin", "link"] |
||||
) |
||||
data class RssStar( |
||||
var origin: String = "", |
||||
var title: String = "", |
||||
var starTime: Long = 0, |
||||
var link: String = "", |
||||
var pubDate: String? = null, |
||||
var description: String? = null, |
||||
var content: String? = null, |
||||
var image: String? = null, |
||||
var read: Boolean = false |
||||
) |
Loading…
Reference in new issue