parent
f4394a7059
commit
c819890a43
@ -0,0 +1,22 @@ |
||||
package io.legado.app.data.dao |
||||
|
||||
import androidx.lifecycle.LiveData |
||||
import androidx.room.Dao |
||||
import androidx.room.Insert |
||||
import androidx.room.OnConflictStrategy |
||||
import androidx.room.Query |
||||
import io.legado.app.data.entities.SourceSub |
||||
|
||||
@Dao |
||||
interface SourceSubDao { |
||||
|
||||
@get:Query("select * from sourceSubs") |
||||
val all: List<SourceSub> |
||||
|
||||
@Query("select * from sourceSubs") |
||||
fun observeAll(): LiveData<List<SourceSub>> |
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE) |
||||
fun insert(vararg sourceSub: SourceSub) |
||||
|
||||
} |
@ -0,0 +1,12 @@ |
||||
package io.legado.app.data.entities |
||||
|
||||
import androidx.room.Entity |
||||
import androidx.room.PrimaryKey |
||||
|
||||
@Entity(tableName = "sourceSubs") |
||||
data class SourceSub( |
||||
@PrimaryKey |
||||
val id: Long = System.currentTimeMillis(), |
||||
val name: String, |
||||
val url: String, |
||||
) |
Loading…
Reference in new issue