You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across this project while looking for a simple way to compare two instances of the same struct. I currently define type Delta struct{ old, new interface{} } and then use a map of that where the member name is the key. Obviously can't do deep compares with that, but it works well from a programmatic standpoint.
I'm wondering if you considered any other methods for handling the paths? Would you be interested in having any alternative representations in this project?
The text was updated successfully, but these errors were encountered:
Haven't really given it much thought. What's the benefit of having a struct like that? Are you actually using the diff for something other than just pretty printing it?
Right, I'm using the diff as a way to represent a set of requested changes. I've got code for this, but I need to get approval to share it. In a nutshell though, I've created interface {Old(),New() interface{}}, an interface on top of that that adds addressability (for arrays/slices, as well as maps/structs), and then a MapDeltas struct that will store a set of those. The interfaces also have methods like Equal(), Added/Removed (when something was added or removed from a slice or map) and a few other goodies.
I came across this project while looking for a simple way to compare two instances of the same struct. I currently define
type Delta struct{ old, new interface{} }
and then use a map of that where the member name is the key. Obviously can't do deep compares with that, but it works well from a programmatic standpoint.I'm wondering if you considered any other methods for handling the paths? Would you be interested in having any alternative representations in this project?
The text was updated successfully, but these errors were encountered: