From 2053033b257593519237fe3734e401a2cae58a59 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 24 Jul 2023 13:09:27 -0700 Subject: [PATCH] ndb: make note equatble We need this for the switchover --- nostrdb/NdbNote.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nostrdb/NdbNote.swift b/nostrdb/NdbNote.swift index 097d0034..9ea0899a 100644 --- a/nostrdb/NdbNote.swift +++ b/nostrdb/NdbNote.swift @@ -34,7 +34,7 @@ enum NdbData { } } -class NdbNote { +class NdbNote: Equatable { // we can have owned notes, but we can also have lmdb virtual-memory mapped notes so its optional private let owned: Bool let count: Int @@ -94,6 +94,10 @@ class NdbNote { } } + static func == (lhs: NdbNote, rhs: NdbNote) -> Bool { + return lhs.id == rhs.id + } + static func owned_from_json(json: String, bufsize: Int = 2 << 18) -> NdbNote? { return json.withCString { cstr in return NdbNote.owned_from_json_cstr(