KuyoDynamics / SILCServer

API for SILC/Village Banking Applications written in nodejs
MIT License
2 stars 1 forks source link

Metadata: Add Object Filter API For All Queries #15

Open chaiwa-berian opened 5 years ago

chaiwa-berian commented 5 years ago

To filter the metadata there are several filter operations that can be applied to the returned list of metadata. The format of the filter itself should be straight-forward and should follow the pattern property:operator:value, where property is the property on the metadata you want to filter on, operator is the comparison operator you want to perform and value is the value to check against (not all operators require value). Please see the schema documentation for each type of obejct to discover which properties are available. Recursive filtering, ie. filtering on associated objects or collection of objects, should be supported as well.

chaiwa-berian commented 5 years ago
Operator Types Value required Description
eq string | boolean | integer | float | enum | collection (checks for size) | date true Equality
!eq string | boolean | integer | float | enum | collection (checks for size) | date true Inequality
ne string | boolean | integer | float | enum | collection (checks for size) | date true Inequality
like string true Case sensitive string, match anywhere
!like string true Case sensitive string, not match anywhere
^like string true Case sensitive string, match start
!^like string true Case sensitive string, not match start
$like string true Case sensitive string, match end
!$like string true Case sensitive string, not match end
ilike string true Case insensitive string, match anywhere
!ilike string true Case insensitive string, not match anywhere
^ilike string true Case insensitive string, match start
!^ilike string true Case insensitive string, not match start
$ilike string true Case insensitive string, match end
!$ilike string true Case insensitive string, not match end
gt string | boolean | integer | float | collection (checks for size) | date true Greater than
ge string | boolean | integer | float | collection (checks for size) | date true Greater than or equal
lt string | boolean | integer | float | collection (checks for size) | date true Less than
le string | boolean | integer | float | collection (checks for size) | date true Less than or equal
null all false Property is null
!null all false Property is not null
empty collection false Collection is empty
in string | boolean | integer | float | date true Find objects matching 1 or more values
!in string | boolean | integer | float | date true Find objects not matching 1 or more values

Operators will be applied as logical AND query,for OR query, we can have a look at the IN filter or we can implement the OR operator. The filtering mechanism should allow for recursion