From b625bcf97a49fbb88b5962d95e1451aff235335e Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Tue, 11 Jun 2024 13:37:19 +0800 Subject: [PATCH] feat: Add delete for PersistableRecord+RAK --- Sources/GRDB/PersistableRecord+RAK.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/GRDB/PersistableRecord+RAK.swift b/Sources/GRDB/PersistableRecord+RAK.swift index e35611e..c235563 100644 --- a/Sources/GRDB/PersistableRecord+RAK.swift +++ b/Sources/GRDB/PersistableRecord+RAK.swift @@ -23,6 +23,14 @@ extension Extendable where Base: CodableRecord { } } +// MARK: - Delete + +extension Extendable where Base: CodableRecord { + public func delete() throws -> Bool { + try Base.database?.write { try base.delete($0) } ?? false + } +} + // MARK: - Update extension Extendable where Base: CodableRecord {