IndisponibiliteDao.swift 20 lignes · 818 octets
import Foundation

/// Port of the Room `IndisponibiliteDao`.
protocol IndisponibiliteDao {
    /// INSERT OR REPLACE INTO indisponibilites; returns the row id.
    @discardableResult
    func upsert(_ entity: IndisponibiliteEntity) async throws -> Int64

    /// SELECT * FROM indisponibilites WHERE serverId = :serverId
    func getByServerId(_ serverId: String) async throws -> IndisponibiliteEntity?

    /// DELETE FROM indisponibilites WHERE serverId = :serverId
    func deleteByServerId(_ serverId: String) async throws

    /// SELECT * FROM indisponibilites WHERE cibleType = :cibleType AND cibleId = :cibleId
    func listByCible(cibleType: String, cibleId: String) async throws -> [IndisponibiliteEntity]

    /// SELECT * FROM indisponibilites
    func listAll() async throws -> [IndisponibiliteEntity]
}