https://github.com/gabriel-schneider/pyqurl
Simple filtering, sorting and pagination from query strings
https://github.com/gabriel-schneider/pyqurl
flask library ponyorm python quart query-string
Last synced: 8 months ago
JSON representation
Simple filtering, sorting and pagination from query strings
- Host: GitHub
- URL: https://github.com/gabriel-schneider/pyqurl
- Owner: gabriel-schneider
- License: mit
- Created: 2022-09-21T20:34:07.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-09-27T13:54:48.000Z (about 1 year ago)
- Last Synced: 2025-02-01T03:22:15.396Z (9 months ago)
- Topics: flask, library, ponyorm, python, quart, query-string
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Simple query string parser for LHS filtering, sorting and pagination. This project is directly based on Qurl by Hector Carballo (https://github.com/hector-co/Qurl).
# Installing
```
$ pip install pyqurl
```
# Usage
```python
from pyqurl import create_query_from_string
# Name contains "john"
create_query_from_string("name[ct]=john")
# Price is greater than 20
create_query_from_string("price[gt]=20")
# Disabled_at is not null
create_query_from_string("disabled_at[nn]=true")
# Year is between 2020 and 2022
create_query_from_string("year[rng]=2020,2022")
# Color is equal to yellow
create_query_from_string("color[eq]=yellow")
# Same result if the operator is not present
create_query_from_string("color=yellow")
# Category is drama, romance or comecy
create_query_from_string("category[in]=drama,romance,comedy")
# Category is not horror or action
create_query_from_string("category[nin]=horror,action")
```