FromInterface fills ms from an 'any' value obtained from LoadModule.
(matcherSets any)
| 439 | |
| 440 | // FromInterface fills ms from an 'any' value obtained from LoadModule. |
| 441 | func (ms *MatcherSets) FromInterface(matcherSets any) error { |
| 442 | for _, matcherSetIfaces := range matcherSets.([]map[string]any) { |
| 443 | var matcherSet MatcherSet |
| 444 | for _, matcher := range matcherSetIfaces { |
| 445 | if m, ok := matcher.(RequestMatcherWithError); ok { |
| 446 | matcherSet = append(matcherSet, m) |
| 447 | continue |
| 448 | } |
| 449 | if m, ok := matcher.(RequestMatcher); ok { |
| 450 | matcherSet = append(matcherSet, m) |
| 451 | continue |
| 452 | } |
| 453 | return fmt.Errorf("decoded module is not a RequestMatcher or RequestMatcherWithError: %#v", matcher) |
| 454 | } |
| 455 | *ms = append(*ms, matcherSet) |
| 456 | } |
| 457 | return nil |
| 458 | } |
| 459 | |
| 460 | // TODO: Is this used? |
| 461 | func (ms MatcherSets) String() string { |
no outgoing calls
no test coverage detected