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

Filters #10

Open
miki725 opened this issue Sep 14, 2015 · 3 comments
Open

Filters #10

miki725 opened this issue Sep 14, 2015 · 3 comments

Comments

@miki725
Copy link
Contributor

miki725 commented Sep 14, 2015

Sometimes filters are desired:

path.to.node.<lookup>

the lookup will not be executed if node lookup will fail (e.g. not present). simplepath should provided a filter which will execute no matter if any intermediate nodes blow up. possible syntax:

path.to.node|<lookup>
@miki725
Copy link
Contributor Author

miki725 commented Sep 14, 2015

another alternative is allow to do conditional filters. syntax is inspired by javascript:

path.to.node?<success>:<failure>

so success lookup will execute when all previous lookups succeed or failure will execute if something blew up

@miki725
Copy link
Contributor Author

miki725 commented Sep 14, 2015

actually this is partially possible currently in simplepath:

Expression('path.to.node.<yesno:success,failure>', default='failure')

@ashishgore
Copy link

Conditional filters can be extended. In addition to lookups, if we can provide a way to find key(s) in an order and return back with the first match found, that would solve a use case for label customization. Example:

path.to.node1 or path.to.node2 or path.to.node3

The 'or' operator will behave like a if..else condition going from left to right. The first non-null value should be returned back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants