InteractionDao.swift
30 lignes · 1315 octets
import Foundation /// Port of the Room `InteractionDao`. protocol InteractionDao { /// INSERT OR REPLACE INTO interactions; returns the row id. @discardableResult func upsert(_ entity: InteractionEntity) async throws -> Int64 /// SELECT * FROM interactions WHERE serverId = :serverId func getByServerId(_ serverId: String) async throws -> InteractionEntity? /// SELECT * FROM interactions WHERE localId = :localId func getByLocalId(_ localId: Int64) async throws -> InteractionEntity? /// DELETE FROM interactions WHERE serverId = :serverId func deleteByServerId(_ serverId: String) async throws /// SELECT * FROM interactions WHERE contactServerId = :contactServerId func listByContactServerId(_ contactServerId: String) async throws -> [InteractionEntity] /// Kotlin `observeByContactServerId(...): Flow<List<InteractionEntity>>` — manual refresh model. /// SELECT * FROM interactions WHERE contactServerId = :contactServerId ORDER BY createdAt DESC func fetchByContactServerId(_ contactServerId: String) async throws -> [InteractionEntity] /// DELETE FROM interactions WHERE localId = :localId func deleteByLocalId(_ localId: Int64) async throws /// SELECT * FROM interactions func listAll() async throws -> [InteractionEntity] }
GitRust