EntrepriseDao.swift 20 lignes · 718 octets
import Foundation

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

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

    /// SELECT * FROM entreprises WHERE localId = :localId
    func getByLocalId(_ localId: Int64) async throws -> EntrepriseEntity?

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

    /// SELECT * FROM entreprises
    func listAll() async throws -> [EntrepriseEntity]
}