Rework storage structs, link preview

This commit is contained in:
Christoph Hagen
2025-01-08 14:59:04 +01:00
parent b99c064d10
commit a7197b9628
75 changed files with 1365 additions and 1454 deletions

View File

@ -0,0 +1,33 @@
struct LocalizedItemId {
let language: ContentLanguage
let itemType: ItemReference
}
extension LocalizedItemId: Equatable {
static func == (lhs: LocalizedItemId, rhs: LocalizedItemId) -> Bool {
lhs.language == rhs.language &&
lhs.itemType == rhs.itemType
}
}
extension LocalizedItemId: Hashable {
func hash(into hasher: inout Hasher) {
hasher.combine(language)
hasher.combine(itemType.id)
}
}
extension LocalizedItemId: Comparable {
static func < (lhs: LocalizedItemId, rhs: LocalizedItemId) -> Bool {
guard lhs.itemType == rhs.itemType else {
return lhs.itemType < rhs.itemType
}
return lhs.language < rhs.language
}
}