Equatable vs EncodableRecord for removeDuplicates() #1143
-
In the documentation, there is the advice: I am trying to use the function Is this intended? Should I expect to implement |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
In order to compare values that do not conform to ValueObservation
.tracking { db in try Player.fetchOne(db, id: 42) }
.removeDuplicate { prev, current in
switch (prev, current) {
case (nil, nil):
return true
case (let prev?, let current?):
return prev.databaseEquals(current)
default:
return false
}
} |
Beta Was this translation helpful? Give feedback.
-
Wanted to follow-up on this. Does |
Beta Was this translation helpful? Give feedback.
In order to compare values that do not conform to
Equatable
, you haveremoveDuplicates(by:)
. You can calldatabaseEquals
there: