(ctx context.Context, keyword string, driver string, scope int, target string, page int, pageSize int, filters []string, order ...string)
| 115 | } |
| 116 | |
| 117 | func (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 | |
| 143 | func (i *imlStrategyService) Get(ctx context.Context, id string) (*Strategy, error) { |
| 144 | info, err := i.store.GetByUUID(ctx, id) |
nothing calls this directly
no test coverage detected