Add handling for root ids

This commit is contained in:
mcrakhman 2023-01-11 19:18:04 +01:00 committed by Mikhail Iudin
parent 0317a4fbe2
commit 957ed31ded
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
2 changed files with 3 additions and 3 deletions

View File

@ -1,13 +1,13 @@
package objecttree
type DescriptionParser interface {
ParseChange(*Change) ([]string, error)
ParseChange(ch *Change, isRoot bool) ([]string, error)
}
var NoOpDescriptionParser = noopDescriptionParser{}
type noopDescriptionParser struct{}
func (n noopDescriptionParser) ParseChange(change *Change) ([]string, error) {
func (n noopDescriptionParser) ParseChange(ch *Change, isRoot bool) ([]string, error) {
return []string{"DOC"}, nil
}

View File

@ -50,7 +50,7 @@ func (t *Tree) Graph(parser DescriptionParser) (data string, err error) {
if ord == "" {
ord = "miss"
}
chSymbs, err := parser.ParseChange(c)
chSymbs, err := parser.ParseChange(c, c.Id == t.RootId())
if err != nil {
return err
}