diff --git a/changes.go b/changes.go index 79c18a5..8405e42 100644 --- a/changes.go +++ b/changes.go @@ -289,6 +289,7 @@ func (i *Item) ToMap() map[string]any { "attributes": i.Attributes.AttrStruct.Fields, } } + func (id *ItemDiff) ToMap() map[string]any { result := map[string]any{ "status": id.Status.String(), @@ -305,6 +306,18 @@ func (id *ItemDiff) ToMap() map[string]any { return result } +func (id *ItemDiff) GloballyUniqueName() string { + if id.Item != nil { + return id.Item.GloballyUniqueName() + } else if id.Before != nil { + return id.Before.GloballyUniqueName() + } else if id.After != nil { + return id.After.GloballyUniqueName() + } else { + return "empty item diff" + } +} + func (cp *ChangeProperties) ToMap() map[string]any { affectedApps := make([]string, len(cp.AffectedAppsUUID)) for i, u := range cp.AffectedAppsUUID { diff --git a/go.sum b/go.sum index 2d1f2be..731b32b 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,6 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=