MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / treeItems

Function treeItems

module/catalogue/iml.go:657–674  ·  view source on GitHub ↗

treeItems 获取子树

(parentId string, parentMap map[string][]*catalogue.Catalogue)

Source from the content-addressed store, hash-verified

655
656// treeItems 获取子树
657func treeItems(parentId string, parentMap map[string][]*catalogue.Catalogue) []*catalogue_dto.Item {
658 items := make([]*catalogue_dto.Item, 0)
659 if _, ok := parentMap[parentId]; ok {
660 for _, v := range parentMap[parentId] {
661 childItems := treeItems(v.Id, parentMap)
662 items = append(items, &catalogue_dto.Item{
663 Id: v.Id,
664 Name: v.Name,
665 Children: childItems,
666 Sort: v.Sort,
667 })
668 }
669 }
670 sort.Slice(items, func(i, j int) bool {
671 return items[i].Sort < items[j].Sort
672 })
673 return items
674}

Callers 1

SearchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected