Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple query combined with versionfilter to csv source #964

Merged
merged 1 commit into from
Nov 6, 2022

Conversation

olblak
Copy link
Member

@olblak olblak commented Nov 5, 2022

Signed-off-by: Olblak me@olblak.com

As discussed on #942 (comment)
I realized that it would be super usefull to be able to do a multiple query combined with versionfilter on the csv resource

This pullrequest allows the following manifest to work

sources:
    name: Test Version filter
    kind: csv 
    spec:
      files: 
        - pkg/plugins/resources/csv/testdata/data.csv
      query: ".[*].firstname"
      versionfilter:
        kind: regex
        pattern: "^Jo"

Example

#############################
# CSV MANIPULATION EXAMPLES #
#############################


SOURCES
=======

versionfilter
-------------
Searching for version matching pattern "^Jo"
✔ Value "John", found in file "/home/olblak/Projects/Updatecli/updatecli/pkg/plugins/resources/csv/testdata/data.csv", for key ".[*].firstname"'

default
-------
✔ Value "John", found in file "/home/olblak/Projects/Updatecli/updatecli/pkg/plugins/resources/csv/testdata/data.csv", for key ".[0].firstname"'

Test

To test this pull request, you can run the following commands:

cp <to_package_directory>
go test

Additional Information

Tradeoff

Similar to the Json approach, I am deprecating the parameter multiple in favor of query

Potential improvement

@olblak olblak added resource-csv enhancement New feature or request labels Nov 5, 2022
@olblak olblak added this to the 0.37.0 milestone Nov 5, 2022
@olblak olblak merged commit 7183941 into updatecli:main Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resource-csv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant