-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: global filter support * tests: for filters * fix: remove reference to group * fix: remove reference to group * fix: remove op references * fix: remove OpType * test: add more tests * fix: golangci-lint run
- Loading branch information
Showing
8 changed files
with
234 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Filter | ||
|
||
The filter package is designed to allow you to define filters, primarily by yaml to be able to filter resources. This is | ||
used in the `nuke` package to filter resources based on a set of criteria. | ||
|
||
Filter's can be optionally added to a `group` filters within a `group` are combined with an `AND` operation. Filters in | ||
different `group` are combined with an `OR` operation. | ||
|
||
There is also the concept of a `global` filter that is applied to all resources. | ||
|
||
## Types | ||
|
||
There are multiple filter types that can be used to filter the resources. These types are used to match against the | ||
property. | ||
|
||
- empty | ||
- exact | ||
- glob | ||
- regex | ||
- contains | ||
- dateOlderThan | ||
- suffix | ||
- prefix | ||
|
||
## Global | ||
|
||
You can define a global filter that will be applied to all resources. This is useful for defining a set of filters that | ||
should be applied to all resources. | ||
|
||
It has a special key called `__global__`. | ||
|
||
This only works when you are defining it as a resource type as part of the `Filters` `map[string][]Filter` type. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
pkg/filter/testdata/filters.yaml → pkg/filter/testdata/global.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
filters: | ||
__global__: | ||
- name: prop3 | ||
- property: prop3 | ||
type: exact | ||
value: value3 | ||
Resource1: | ||
- name: prop1 | ||
- property: prop1 | ||
type: exact | ||
value: value1 | ||
Resource2: | ||
- name: prop2 | ||
- property: prop2 | ||
type: exact | ||
value: value2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.