Breeze / breeze-client

Breeze for JavaScript clients
MIT License
38 stars 16 forks source link

Predicate.extendBinaryPredicateFn missing in latest breeze-client #64

Open tschettler opened 2 years ago

tschettler commented 2 years ago

In 1.x versions of breeze-client, there was a Predicate.extendBinaryPredicateFn method. This has been commented out in the latest version of breeze-client (src/predicate.ts#L201):

  // TODO: determine if/where this is used.
  // static extendBinaryPredicateFn(opMap: IOpMap, visitorFn: any) {

This method was added to breeze.js in version 1.5 (https://github.com/Breeze/breeze.js/commit/89c3e10dec7ab4dac5cfa7db33699c7e83c7d620) by @jtraband.

I was using this method to extend upon the built-in binary predicate operators in breeze. Can this method be restored?

Thanks!

Travis

steveschmitt commented 1 year ago

Yes! Can you give me an example of how you use it? We have no tests for this right now.

tschettler commented 1 year ago

Sure! I would use it to allow breeze to recognize binary functions available in OData 4. This example would allow the add operator:

Predicate.extendBinaryPredicateFn({'add': { aliases: ['+', 'plus']}});

Which would allow queries like this: http://host/service/Products?$filter=Price add 2.45 eq 5.00

steveschmitt commented 1 year ago

I see. Then how would you compose the predicate (where clause)?