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>
			
			
This commit is contained in:
		@@ -406,3 +406,8 @@ func parseSelector(selector string, fn TransformFunc) (Selector, error) {
 | 
				
			|||||||
func OneTermEqualSelector(k, v string) Selector {
 | 
					func OneTermEqualSelector(k, v string) Selector {
 | 
				
			||||||
	return &hasTerm{field: k, value: v}
 | 
						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)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user