package com.framework.mvvm.model.db.dao

import androidx.room.*
import com.framework.mvvm.model.db.entity.PipeConfigEntity
import com.framework.mvvm.model.db.entity.PipeEntity

/**
 * 管道表 Dao
 */
@Dao
interface PipeDao {
    @Query("select * from pipe")
    suspend fun getPipes(): List<PipeEntity>

    @Query("select * from pipe where id = :id")
    suspend fun getPipeById(id: String): PipeEntity

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insPipe(vararg pipe: PipeEntity)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insPipes(configs: List<PipeEntity>)

    @Update
    suspend fun upPipe(pipe: PipeEntity)

    @Delete
    suspend fun delConfig(config: PipeConfigEntity)
}