mirror of https://github.com/k3s-io/k3s
Merge pull request #39810 from enj/enj/f/and_selectors
Automatic merge from submit-queue (batch tested with PRs 40703, 40093, 40618, 40659, 39810)
Add AndSelectors helper function
I needed a simple way to logically `AND` two `Selectors` in https://github.com/openshift/origin/pull/11909 for [this](7259bf7596/pkg/oauth/registry/oauthclientauthorization/etcd/etcd.go (L95-L114)
).
This seems like the cleanest way to express that intent.
Signed-off-by: Monis Khan <mkhan@redhat.com>
pull/6/head
commit
1bbd9dfa11
|
@ -406,3 +406,8 @@ func parseSelector(selector string, fn TransformFunc) (Selector, error) {
|
|||
func OneTermEqualSelector(k, v string) Selector {
|
||||
return &hasTerm{field: k, value: v}
|
||||
}
|
||||
|
||||
// AndSelectors creates a selector that is the logical AND of all the given selectors
|
||||
func AndSelectors(selectors ...Selector) Selector {
|
||||
return andTerm(selectors)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue