I've come across the github.com/r3labs/diff library for Go language to compare two structs of the same type.
Library is working quite well, except for one use-case which is the following: I am using the Date struct to represent a date:
type Date struct {
Year int
Month int
Day int
}
Now, there are some other more complex structs that make use of the Date struct let's say for example:
type Student struct {
DateOfBirth Date
}
If I am about the compare two students, like
diff.Diff(
Student{DateOfBirth: Date{2021, 11, 13}},
Student{DateOfBirth: Date{2021, 10, 9}},
)
what I would get as a result is a changelog with 2 items, one for the DateOfBirth > Month and the other for the DateOfBirth > Day.
My desired result would be a changelog with a single item (DateOfBirth) and the value of 2021-10-09.
Is that possible somehow with the library?