This commit is contained in:
Biarity 2018-04-20 19:27:15 +10:00
commit fb8a812282

View File

@ -134,13 +134,14 @@ More formally:
* `sorts` is a comma-delimited ordered list of property names to sort by. Adding a `-` before the name switches to sorting descendingly. * `sorts` is a comma-delimited ordered list of property names to sort by. Adding a `-` before the name switches to sorting descendingly.
* `filters` is a comma-delimited list of `{Name}{Operator}{Value}` where * `filters` is a comma-delimited list of `{Name}{Operator}{Value}` where
* `{Name}` is the name of a property with the Sieve attribute or the name of a custom filter method for TEntity * `{Name}` is the name of a property with the Sieve attribute or the name of a custom filter method for TEntity
* You can also have multiple names (for OR logic) by enclosing them in brackets and using a pipe delimiter, eg. `(LikeCount|CommentCount)>10` asks if `LikeCount` or `CommentCount` is `>10`
* `{Operator}` is one of the [Operators](#operators) * `{Operator}` is one of the [Operators](#operators)
* `{Value}` is the value to use for filtering * `{Value}` is the value to use for filtering
* `page` is the number of page to return * `page` is the number of page to return
* `pageSize` is the number of items returned per page * `pageSize` is the number of items returned per page
Notes: Notes:
* Don't forget to remove commas from any `{Value}` fields * Don't forget to **remove commas (`,`), brackets (`(`, `)`), and pipes (`|`) from any `{Value}` fields**
* You can have spaces anywhere except *within* `{Name}` or `{Operator}` fields * You can have spaces anywhere except *within* `{Name}` or `{Operator}` fields
* Here's a [good example on how to work with enumerables](https://github.com/Biarity/Sieve/issues/2) * Here's a [good example on how to work with enumerables](https://github.com/Biarity/Sieve/issues/2)
* Another example on [how to do OR logic](https://github.com/Biarity/Sieve/issues/8) * Another example on [how to do OR logic](https://github.com/Biarity/Sieve/issues/8)
@ -178,5 +179,16 @@ It is recommended that you write exception-handling middleware to globally handl
### Example project ### Example project
You can find an example project incorporating most Sieve concepts in [SieveTests](https://github.com/Biarity/Sieve/tree/master/SieveTests). You can find an example project incorporating most Sieve concepts in [SieveTests](https://github.com/Biarity/Sieve/tree/master/SieveTests).
## Upgrading from v1.* to v2.*
* Changes to the `SieveProcessor` API:
* `ApplyAll` is now `Apply`
* `ApplyFiltering`, `ApplySorting`, and `ApplyPagination` are now depricated - instead you can use optional arguments on `Apply` to achieve the same
* Instead of just removing commas from `{Value}`s, [you'll also need to remove brackets and pipes](#send-a-request)
## License & Contributing ## License & Contributing
Sieve is licensed under Apache 2.0. Any contributions highly appreciated! Sieve is licensed under Apache 2.0. Any contributions highly appreciated!