MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / SearchByDriver

Method SearchByDriver

service/strategy/iml.go:117–141  ·  view source on GitHub ↗
(ctx context.Context, keyword string, driver string, scope int, target string, page int, pageSize int, filters []string, order ...string)

Source from the content-addressed store, hash-verified

115}
116
117func (i *imlStrategyService) SearchByDriver(ctx context.Context, keyword string, driver string, scope int, target string, page int, pageSize int, filters []string, order ...string) ([]*Strategy, int64, error) {
118 w := map[string]interface{}{
119 "scope": scope,
120 "driver": driver,
121 }
122 if target != "" {
123 w["target"] = target
124 }
125 for _, f := range filters {
126 switch f {
127 case "enable":
128 w["enable"] = true
129 case "disable":
130 w["enable"] = false
131 }
132 }
133 if len(order) < 1 {
134 order = []string{"update_at desc"}
135 }
136 list, total, err := i.store.SearchByPage(ctx, keyword, w, page, pageSize, order...)
137 if err != nil {
138 return nil, 0, err
139 }
140 return utils.SliceToSlice(list, FromEntity), total, nil
141}
142
143func (i *imlStrategyService) Get(ctx context.Context, id string) (*Strategy, error) {
144 info, err := i.store.GetByUUID(ctx, id)

Callers

nothing calls this directly

Calls 1

SearchByPageMethod · 0.65

Tested by

no test coverage detected