-
Notifications
You must be signed in to change notification settings - Fork 213
Open
Labels
Description
I'm creating a ddd store for Entity and ValueObject.
ValueObject will use it's hashcode as key in the store (and I'll manage collisions storing a list instead of a single value object)
My current approach use something like this:
trait ValueObject[R]:
def schema: Schema[R]
extension (valueObject: R)
def isSameValueObjectAs(other: R): Boolean =
schema.diff(valueObject, other).isIdentical
def valueHashCode: Long =
schema.toDynamic(valueObject).hashCodeThis way I can do something like store.getValueObject[T: ValueObject](valueObject: T).filter(found => found.isSameValueObjectAs(valueObject).runHead
However in my tests I observe the hashCode generated using DynamicValue changes, making my code fail.
Reactions are currently unavailable