Closed lovromazgon closed 4 years ago
Hey @lovromazgon, very sorry for the late review of this. This looks like a great feature. I'm more than happy to merge this.
Only things that would benefit from a change would be exposing changelog.Add
as a public function (as you suggested), as well as expose AreType
to help with implementing the Match function.
@purehyperbole glad to hear you like the feature, I added the changes you requested.
Awesome, thanks for the contribution!
This PR adds support for defining custom diff functions.
The use case is to add custom diff functions for specific types (see test) or to extend support for unsupported types (e.g.
uuid.UUID
is currently not supported, also zero value needs special treatment). It could even be used to override default diff functions with custom ones.Sidenote: The sole purpose of
MutableChangelog
is to expose the internal methodadd
onChangelog
without changing the interface of that type. The code could be a bit simpler if you decide to just exposeChangelog.add
.Let me know if you want me to add an entry in the readme describing this feature.