优化结构
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user