jatcwang / difflicious

Scala library for readable diffs of values
Apache License 2.0
74 stars 4 forks source link

Custom record (object) differ #16

Open jatcwang opened 2 years ago

jatcwang commented 2 years ago

Sometimes we have a record-like class which we'll want to compare a subset of fields.

e.g.

class MyError(field1: String, field2: List[String], cause: Throwable) extends Exception we may only want to compare msg since cause isn't something we can/want to compare.

Ideally we can have have an easy way to create custom record differs, maybe something like:

val differ = Differ.customObj(_.msg, _.field2)

where customObj is overloaded to accept any number of params.