desc:视频数据库
parent
65181913f6
commit
5cbe4a2c14
@ -0,0 +1,22 @@
|
|||||||
|
package com.yinuo.safetywatcher.watcher.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Delete
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.Query
|
||||||
|
import com.yinuo.safetywatcher.watcher.db.entity.Video
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface VideoDao {
|
||||||
|
@Query("SELECT * FROM video")
|
||||||
|
suspend fun getAll(): List<Video>
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
suspend fun insert(gas: Video)
|
||||||
|
|
||||||
|
@Insert
|
||||||
|
suspend fun insertAll(types: List<Video>)
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
suspend fun delete(gas: Video)
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.yinuo.safetywatcher.watcher.db.entity
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
data class Video(
|
||||||
|
@ColumnInfo(name = "time") var time: Long,
|
||||||
|
@ColumnInfo(name = "file_name") var name: Long,
|
||||||
|
@ColumnInfo(name = "uploaded") var uploaded: Boolean = false,
|
||||||
|
@PrimaryKey @ColumnInfo(name = "file_path") var path: String
|
||||||
|
)
|
Loading…
Reference in New Issue