Add handling for root ids
This commit is contained in:
parent
1eed7e5050
commit
a7a54bcc8b
@ -1,13 +1,13 @@
|
|||||||
package objecttree
|
package objecttree
|
||||||
|
|
||||||
type DescriptionParser interface {
|
type DescriptionParser interface {
|
||||||
ParseChange(*Change) ([]string, error)
|
ParseChange(ch *Change, isRoot bool) ([]string, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
var NoOpDescriptionParser = noopDescriptionParser{}
|
var NoOpDescriptionParser = noopDescriptionParser{}
|
||||||
|
|
||||||
type noopDescriptionParser struct{}
|
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
|
return []string{"DOC"}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@ func (t *Tree) Graph(parser DescriptionParser) (data string, err error) {
|
|||||||
if ord == "" {
|
if ord == "" {
|
||||||
ord = "miss"
|
ord = "miss"
|
||||||
}
|
}
|
||||||
chSymbs, err := parser.ParseChange(c)
|
chSymbs, err := parser.ParseChange(c, c.Id == t.RootId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user