supabase-community / postgrest-csharp

A C# Client library for Postgrest
https://supabase-community.github.io/postgrest-csharp/api/Postgrest.html
MIT License
114 stars 22 forks source link

Contains filter @> #18

Closed elrhomariyounes closed 3 years ago

elrhomariyounes commented 3 years ago

Bug report

Describe the bug

Hello, as @acupofjose mentioned in #16 postgrest seems to not recognize the operator. I went to read the docs and I found out that this operator is used in this cases

So I give a first try with ranges. I I encountered several issues.

  1. An exceptionthrown in the QueryFilter constructor because not allowing a range criteria and contains filter operator, I solved it by adding the operator to the switch case
  2. After solving 1. a request exception by Postgrest the url was not formed correctly after debugging the range criteria was not added by the PrepareFilter method in Table class. I fixed by correctly formatting the url if a range criteria is the case please check PR :relaxed:

I would love to check the others cases.

To Reproduce

var filteredResponse = await client.Table<User>().Filter("age_range", Operator.Contains, new Range(1,2)).Get(); 

Expected behavior

System information

-OS: [Windows 10 Pro 1909] -.Net core 3.1.x -Visual Studio 16.8 -Version of supabase-postgrest-csharp: master branch of current repo

elrhomariyounes commented 3 years ago

@acupofjose we can close this issue and open another one for contains and contained operators.

Range criteria is solved in #19 and #21. Still to solve array and json types.