-
Notifications
You must be signed in to change notification settings - Fork 26
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
Can't use "Contains" collection method to filter tables #78
Comments
Can you try this instead? var test = await _client
.From<TestTable>()
.Filter(u => u.fieldOfTypeInt, Operator.ContainedIn, listOfInts)
.Get(); |
What I really want could be achieved, in your example, by an operator like "NotContainedIn". Is there anything like that? |
Apologies on the delay getting back to you. Getting back to the swing of things after thanksgiving. This var test = await _client
.From<TestTable>()
.Not(nameof(TestTable.fieldOfTypeInt), Operator.ContainedIn, listOfInts)
.Get(); |
Thanks for the feedback. I tried your code, but it gives me this error:
It seems I can't fit my list of |
Oooookay - this should be fixed in v3.3.0! |
Hello, @acupofjose I don't know that this issue is fixed. I defined the list of ints that were to be passed, downcasting them from longs. I got the same result with both I tried the suggested query and I am getting the following exception:
When I try to using a cast to
|
Can you give the code you’re using for the call so I can debug please? |
I can give you snippets (it's not a public/open source project). I have reproduced this with several different types of // Model class
[Table("example_model")]
public class ExampleModel: Postgrest.Models.BaseModel
{
[PrimaryKey("id")]
public Guid Id { get; set; }
[Column("search_id")]
public Guid SearchId { get; set; }
[Column("ref_id")]
public Guid RefId { get; set; }
[Column("created_at", ignoreOnInsert: true)]
public DateTime? CreatedAt { get; set; }
[Column("updated_at", ignoreOnInsert: true)]
public DateTime? UpdatedAt { get; set; }
[Column("deleted")]
public bool Deleted { get; set; } = false;
}
// Search code example:
var searchList = new List<string>() { Guid.NewGuid().ToString() };
var growerUsers = await _client.From<ExampleModel>()
.Filter("id", Constants.Operator.ContainedIn, searchList())
.Get();
// Also tried casting to List<object> Not sure if that helps enough, sorry. |
Ah - I think I see the problem. You're correct, my fix wasn't complete 🤷♂️ ! |
If you could try on var searchList = new List<string>() { Guid.NewGuid().ToString() };
var growerUsers = await _client.From<ExampleModel>()
.Filter(x => x.Id, Operator.In, searchList)
.Get(); |
Sorry, I will give that go and confirm for you! |
I'm trying to filter a database with a method like this:
However, this give me an error like this:
If i try a filter method that does not use the
Contains
collection method, there is no problem. Like:(this works)
The text was updated successfully, but these errors were encountered: