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

Method recurseUpdateSort

module/catalogue/iml.go:514–533  ·  view source on GitHub ↗
(ctx context.Context, parent string, sorts []*catalogue_dto.SortItem)

Source from the content-addressed store, hash-verified

512}
513
514func (i *imlCatalogueModule) recurseUpdateSort(ctx context.Context, parent string, sorts []*catalogue_dto.SortItem) error {
515 for index, item := range sorts {
516 s := index
517 err := i.catalogueService.Save(ctx, item.Id, &catalogue.EditCatalogue{
518 Parent: &parent,
519 Sort: &s,
520 })
521 if err != nil {
522 return err
523 }
524 if len(item.Children) < 1 {
525 continue
526 }
527 err = i.recurseUpdateSort(ctx, item.Id, item.Children)
528 if err != nil {
529 return err
530 }
531 }
532 return nil
533}
534
535func (i *imlCatalogueModule) Sort(ctx context.Context, sorts []*catalogue_dto.SortItem) error {
536 return i.transaction.Transaction(ctx, func(ctx context.Context) error {

Callers 1

SortMethod · 0.95

Calls 1

SaveMethod · 0.65

Tested by

no test coverage detected