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

Method Delete

module/catalogue/iml.go:630–654  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

628}
629
630func (i *imlCatalogueModule) Delete(ctx context.Context, id string) error {
631 if id == "" {
632 return nil
633 }
634 list, err := i.catalogueService.Search(ctx, "", map[string]interface{}{
635 "parent": id,
636 })
637 if err != nil {
638 return err
639 }
640 if len(list) > 0 {
641 return fmt.Errorf("该目录下存在子目录")
642 }
643 err = i.catalogueService.Delete(ctx, id)
644 if err != nil {
645 return err
646 }
647 // 重新初始化
648 catalogues, err := i.catalogueService.List(ctx)
649 if err != nil {
650 return err
651 }
652 i.root = NewRoot(catalogues)
653 return nil
654}
655
656// treeItems 获取子树
657func treeItems(parentId string, parentMap map[string][]*catalogue.Catalogue) []*catalogue_dto.Item {

Callers

nothing calls this directly

Calls 4

NewRootFunction · 0.85
SearchMethod · 0.65
DeleteMethod · 0.65
ListMethod · 0.65

Tested by

no test coverage detected