-
Notifications
You must be signed in to change notification settings - Fork 48
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
Empty values operators #258
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's format the messages like the suggestions
Co-authored-by: Jake Barnby <[email protected]>
Co-authored-by: Jake Barnby <[email protected]>
*/ | ||
public static function equal(string $attribute, array $values): self | ||
{ | ||
if (empty($values)) { | ||
throw new Exception('Equal queries require at least one value.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we throw error, or continue without a query?
As Appwrite developer, if I do [Query.equal('userId', ids])
and ids
are empty, it would be annoying to get an error. It would mean I need to do exactly the same check in MANY places - everywhere, where I put array into query.
To keep SDK and HTTP consistent, I would avoid fixing this in SDK. I think this should be fixed here, or in Appwrite repo. I think empty array of values should return everything, instead of throwing error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not realize the SDK fixing.. We can do it with a validator if we want to throw an error
The question is Should we throw errors, or select all? especially now that we removed limits?
@abnegate what do you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should throw an error. In that way, the developer knows the query has an issue. They might not realize it's not doing anything if we just ignore it. Make more sense to do it in the validator though instead of here
Will be taken care of here... |
No description provided.