优化结构

This commit is contained in:
Yvan
2026-08-27 22:33:43 +08:00
parent 5052835fcb
commit e407d3ac10
86 changed files with 3151 additions and 726 deletions
+19
View File
@@ -0,0 +1,19 @@
package surface
import (
"strings"
"kra/internal/routecatalog"
"kra/pkg/module"
)
func APIsForPrefix(prefix string, capacity int) []module.API {
items := make([]module.API, 0, capacity)
for _, descriptor := range routecatalog.Descriptors() {
if descriptor.Public || !strings.HasPrefix(descriptor.Path, prefix) || descriptor.Description == "" {
continue
}
items = append(items, module.API{Path: descriptor.Path, Method: descriptor.Method, Group: descriptor.Group, Description: descriptor.Description})
}
return items
}