github.com/thanos-io/thanos@v0.32.5/pkg/api/query/querypb/store_matchers.go (about) 1 // Copyright (c) The Thanos Authors. 2 // Licensed under the Apache License 2.0. 3 4 package querypb 5 6 import ( 7 "github.com/prometheus/prometheus/model/labels" 8 "github.com/thanos-io/thanos/pkg/store/storepb" 9 ) 10 11 func StoreMatchersToLabelMatchers(matchers []StoreMatchers) ([][]*labels.Matcher, error) { 12 if len(matchers) == 0 { 13 return nil, nil 14 } 15 16 labelMatchers := make([][]*labels.Matcher, len(matchers)) 17 for i, storeMatcher := range matchers { 18 storeMatchers, err := storepb.MatchersToPromMatchers(storeMatcher.LabelMatchers...) 19 if err != nil { 20 return nil, err 21 } 22 labelMatchers[i] = storeMatchers 23 } 24 25 return labelMatchers, nil 26 }