tylerhubert / rsql-criteria-typescript

RSQL Criteria Builder for Typescript
MIT License
13 stars 5 forks source link

Add support for custom operators #9

Closed galves closed 5 years ago

galves commented 5 years ago

The idea here is to support custom RSQL operators, so we can express predicates like 'where location within "Ontario"'.

It has been achieved by casting the string operator to type Operator, which is less than ideal so please feel free to re-implement as you see fit. A more correct solution would be to make Operator into a class, but I wanted to avoid too much refactoring.

Thanks for the great library!

coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 31


Totals Coverage Status
Change from base Build 30: 0.0%
Covered Lines: 266
Relevant Lines: 266

💛 - Coveralls
tylerhubert commented 5 years ago

Please check out this other Pull Request I just put up. https://github.com/tylerhubert/rsql-criteria-typescript/pull/10

I'm not so good at github, so not sure how to do the links. I built on top of what you have here and have provided an interface to create your own custom operators. This way you can create a single class that will have the operation string in it and not need to define a constant or the same string all over the place.

Please let me know if this will work!

galves commented 5 years ago

Perfect thanks!

tylerhubert commented 5 years ago

FYI, Version 2.1.0 is now available on NPM and has this change in it.

Thank you very much for the contribution!