package com.keyboard.bubble.skin.keyboard.db

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.keyboard.bubble.skin.keyboard.bean.ChildBean

@Dao
interface MyDao {
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    suspend fun insertData(data: ChildBean): Long

    @Query("select * from ChildBean where `like` = :isLike")
     fun queryAllLike(isLike: Boolean = true): LiveData<List<ChildBean?>?>

    @Query("select * from ChildBean where `download` = :idDownload")
     fun queryAllDownload(idDownload: Boolean = true): LiveData<List<ChildBean?>?>

    @Query("select * from ChildBean  where titleName = :title And  `like` = :isLike")
    suspend fun queryIsLike(title: String, isLike: Boolean = true): ChildBean?


    @Delete
    suspend fun delete(data: ChildBean)

    @Update
    suspend fun updateLike(data: ChildBean)
}