CrmContactDao.swift
44 lignes · 1793 octets
import Foundation /// Port of the Room `CrmContactDao`. SQL semantics of each Kotlin `@Query` are /// documented so the persistence implementation can reproduce them. protocol CrmContactDao { /// INSERT OR REPLACE INTO crm_contacts; returns the row id. @discardableResult func insert(_ entity: CrmContactEntity) async throws -> Int64 /// UPDATE by primary key. func update(_ entity: CrmContactEntity) async throws /// DELETE FROM crm_contacts WHERE id = :id func deleteById(_ id: Int64) async throws /// SELECT * FROM crm_contacts WHERE id = :id func getById(_ id: Int64) async throws -> CrmContactEntity? /// SELECT * FROM crm_contacts WHERE serverId = :serverId func getByServerId(_ serverId: String) async throws -> CrmContactEntity? /// DELETE FROM crm_contacts WHERE serverId = :serverId func deleteByServerId(_ serverId: String) async throws /// Kotlin `observeAll(): Flow<List<CrmContactEntity>>` — manual refresh model. /// SELECT * FROM crm_contacts ORDER BY createdAt DESC func fetchAll() async throws -> [CrmContactEntity] /// SELECT * FROM crm_contacts ORDER BY createdAt DESC func getAll() async throws -> [CrmContactEntity] /// SELECT rowid FROM crm_contacts_fts WHERE crm_contacts_fts MATCH :query func searchIds(_ query: String) async throws -> [Int64] /// INSERT OR IGNORE INTO duplicate_exclusions; returns the row id (-1 when ignored). @discardableResult func insertExclusion(_ ex: DuplicateExclusionEntity) async throws -> Int64 /// SELECT * FROM duplicate_exclusions func getExclusions() async throws -> [DuplicateExclusionEntity] /// DELETE FROM duplicate_exclusions WHERE idA = :id OR idB = :id func deleteExclusionsFor(_ id: Int64) async throws }
GitRust