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

Method FilterGlobalRemote

controller/strategy/iml.go:46–72  ·  view source on GitHub ↗
(ctx *gin.Context, name string)

Source from the content-addressed store, hash-verified

44}
45
46func (i *imlStrategyController) FilterGlobalRemote(ctx *gin.Context, name string) ([]*strategy_dto.Title, []any, int64, string, string, error) {
47 f, has := strategy_filter.RemoteFilter(name)
48 if !has {
49 return nil, nil, 0, "", "", fmt.Errorf("filter not found: %s", name)
50 }
51 scopeAllow := false
52 for _, s := range f.Scopes() {
53 if s == strategy_filter.ScopeGlobal {
54 scopeAllow = true
55 break
56 }
57 }
58 if !scopeAllow {
59 return nil, nil, 0, "", "", fmt.Errorf("scope not allowed: %s", name)
60 }
61
62 list, total, err := f.RemoteList(ctx, "", nil, -1, -1)
63 if err != nil {
64 return nil, nil, 0, "", "", err
65 }
66 return utils.SliceToSlice(f.Titles(), func(l strategy_filter.OptionTitle) *strategy_dto.Title {
67 return &strategy_dto.Title{
68 Field: l.Field,
69 Title: l.Title,
70 }
71 }), list, total, f.Key(), f.Key(), nil
72}
73
74func (i *imlStrategyController) FilterServiceRemote(ctx *gin.Context, serviceId string, name string) ([]*strategy_dto.Title, []any, int64, string, string, error) {
75 f, has := strategy_filter.RemoteFilter(name)

Callers

nothing calls this directly

Calls 5

RemoteFilterMethod · 0.65
ScopesMethod · 0.65
RemoteListMethod · 0.65
TitlesMethod · 0.65
KeyMethod · 0.65

Tested by

no test coverage detected