BEAD
Bead is a generic query dsl library that's built on top of knex.js, that you could use in your REST API.
Reason
I got frustrated looking everywhere on the internet for a generic query dsl module, so I decided to build one myself.
Synstax
Simple Examples:
- EQ : .../someResource?q=(EQ id 1)
- GT : .../someResource?q=(GT id 1)
- LT : .../someResource?q=(LT id 1)
- IN : .../someResource?q=(IN id 1 2 3)
- BETWEEN : .../someResource?q=(BETWEEN id 1 99)
Complex examples with nested queries:
- .../someResource?q=(AND (EQ id 1) (EQ foo 2))
- .../someResource?q=(OR (EQ id 1) (EQ id 5))
- .../someResource?q=(AND (OR (EQ id 1) (EQ id 5)) (GT bar 3))
- .../someResource?q=(AND (IN id 1 2 3) (GT bar 3))
Things that are not supported ... yet:
- Querying Postgres' JSONB and JSON datatype are currently not supported.