| 27 | } |
| 28 | |
| 29 | func (c *customValueDiffer) Diff(dt diff.DiffType, df diff.DiffFunc, cl *diff.Changelog, path []string, a, b reflect.Value, parent interface{}) error { |
| 30 | sa := a.Interface().(Item) |
| 31 | sb := b.Interface().(Item) |
| 32 | |
| 33 | if err := c.DiffFunc(append(path, "id"), reflect.ValueOf(sa.ID()), reflect.ValueOf(sb.ID()), parent); err != nil { |
| 34 | return err |
| 35 | } |
| 36 | if err := c.DiffFunc(append(path, "name"), reflect.ValueOf(sa.Name()), reflect.ValueOf(sb.Name()), parent); err != nil { |
| 37 | return err |
| 38 | } |
| 39 | if err := c.DiffFunc(append(path, "metadata"), reflect.ValueOf(sa.Metadata()), reflect.ValueOf(sb.Metadata()), parent); err != nil { |
| 40 | return err |
| 41 | } |
| 42 | |
| 43 | return nil |
| 44 | } |
| 45 | |
| 46 | func (c *customValueDiffer) InsertParentDiffer(dfunc func(path []string, a, b reflect.Value, p interface{}) error) { |
| 47 | c.DiffFunc = dfunc |