package io.nexilis.service.data.daos

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import io.nexilis.service.data.entities.*

@Dao
interface PullDao {

    @Query("select * from Pull")
    fun getAll(): LiveData<List<Pull>>

    @Query("select * from Pull where pull_key = :key")
    fun get(key: String): LiveData<List<Pull>>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(entity: Pull)

    @Query("delete from Pull")
    suspend fun deleteAll()

}