postgrest-js icon indicating copy to clipboard operation
postgrest-js copied to clipboard

Make `filter` and `not` behave like their per-filter method counterparts

Open soedirgo opened this issue 3 years ago • 0 comments

Feature request

Is your feature request related to a problem? Please describe.

Right now filter and not just takes the operator and value as a string without additional preprocessing. This means e.g. we can't use lists in NOT IN (see https://github.com/supabase/supabase/discussions/2055). It also causes some confusion when it comes to filter methods that use a different name to PostgREST, e.g. cs vs. contains.

Describe the solution you'd like

  • Make not switch on the operator and basically copy the code for each filter methods,
  • make not accept e.g. contains, containedBy, etc.,
  • keep filter as-is, but repurpose it as some sort of escape hatch.

This allows us to make per-filter methods and not cover 99% of the cases, and for the 1% we can use filter.

Question: what do we do about options like foreignTable, textSearch config in not?

Describe alternatives you've considered

None.

Additional context

https://github.com/supabase/supabase/discussions/2055 https://github.com/supabase/postgrest-dart/issues/32

soedirgo avatar Jun 28 '21 03:06 soedirgo