MCPcopy Create free account
hub / github.com/netdata/netdata / parseSelectorList

Function parseSelectorList

src/go/pkg/selectorcore/expr.go:37–57  ·  view source on GitHub ↗
(items []string, fallback Selector)

Source from the content-addressed store, hash-verified

35}
36
37func parseSelectorList(items []string, fallback Selector) (Selector, error) {
38 srs := make([]Selector, 0, len(items))
39 for _, item := range items {
40 sr, err := Parse(item)
41 if err != nil {
42 return nil, fmt.Errorf("parse selector %q: %w", item, err)
43 }
44 if sr == nil {
45 continue
46 }
47 srs = append(srs, sr)
48 }
49 switch len(srs) {
50 case 0:
51 return fallback, nil
52 case 1:
53 return srs[0], nil
54 default:
55 return Or(srs[0], srs[1], srs[2:]...), nil
56 }
57}

Callers 1

ParseMethod · 0.85

Calls 3

ParseFunction · 0.70
OrFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…