Releases: ricktap/Qriteria
Let's get rid of Input!
Let's add choices!
Added a second Filter Implementation to point out how easy it is to create your own filters. Unfortunately this needs to be a mandatory option for me to support, as the json api specification is not clear about how the filter request parameter should look like. As of right now, the Qriteria Package supports a nested string filter and an array field filter or anything you can think of yourself:
NestedString:
?filter=name:=:Bob,(age:<:25|age:>:50)
This is the filter to go with, if you need a lot of control over your queries. The above would translate to:
WHERE name = 'Bob' AND (age < 25 OR age > 50)
In the example the , means AND, the | means or. Everything between parentheses will be grouped. The operations = and < will be expanded by keywords like eq and lt in a future version. The new syntax would then look like:
?filter=name:eq:Bob,(age:lt:25|age:gt:50)
ArrayField
?filter[name]=Bob&filter[age]=25
This Version does not support operations like less than or like, but only does plain old equals. There is also no support for grouping and telling the filters to perform an or. Since there is no or, there was no reason for me to include an option to have the same field twice. On multiple definition of filter[field], the last occurrence would take precedence over the others. The example would perform the following query:
WHERE name = 'Bob' and age = 25
Let's filter!
The advanced filtering has been implemented. Please be aware, that no extensive testing is in place as of right now, but it's in the pipeline. Also the implementation does not check on user errors right now, it depends on you knowing what you are doing when using the code. The implementation checks will be my highest priority for next release. Stay tuned...
Let's begin!
0.3.0 fix links