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
Kubernetes Submit Queue 2017-01-30 17:14:57 -08:00 committed by GitHub
commit 1bbd9dfa11
1 changed files with 5 additions and 0 deletions

View File

@ -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)
}