Skip to content

Contains filter @> #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
elrhomariyounes opened this issue Dec 7, 2020 · 1 comment
Closed

Contains filter @> #18

elrhomariyounes opened this issue Dec 7, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@elrhomariyounes
Copy link
Contributor

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

ARRAY[1,4,3] @> ARRAY[3,1,3]
int4range(2,4) @> int4range(2,3)
circle '<(0,0),2>' @> point '(1,1)'
'{"a":1, "b":2}'::jsonb @> '{"b":2}'::jsonb

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 ☺️

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

  • Get a filtered response all the users with age range in the criteria

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
Copy link
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant