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

any() and all() to take a list as a condition #38

Merged
merged 5 commits into from
Nov 4, 2014
Merged

any() and all() to take a list as a condition #38

merged 5 commits into from
Nov 4, 2014

Conversation

wearp
Copy link
Contributor

@wearp wearp commented Nov 1, 2014

Modified queries.py for any() and all() to take a list as condition. They still function along the lines of python's all() and any(). Inspired by mongodb's $all.

Examples:

where('followers').any(['don', 'jon'])
where('followers').all([{'name': 'john'}, {'age': 17}])

Tests are for free!

@eugene-eeo
Copy link
Contributor

I think using callable instead of isinstance would be better since we can pass in sequences (tuples, sets, lists) as well.

@wearp
Copy link
Contributor Author

wearp commented Nov 2, 2014

Thanks - makes sense to me.

@msiemens
Copy link
Owner

msiemens commented Nov 3, 2014

Thanks, @wearp! Could you also update the docs (docs/usage.rst in particular) accordingly? If not, I'll do it.

@wearp
Copy link
Contributor Author

wearp commented Nov 4, 2014

No problem @msiemens! That's done.

msiemens added a commit that referenced this pull request Nov 4, 2014
any() and all() to take a list as a condition
@msiemens msiemens merged commit 9af9f95 into msiemens:master Nov 4, 2014
@msiemens
Copy link
Owner

msiemens commented Nov 4, 2014

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants