Skip to content
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

Using object in where #205

Closed
WildEgo opened this issue Jun 18, 2021 · 3 comments
Closed

Using object in where #205

WildEgo opened this issue Jun 18, 2021 · 3 comments
Labels
enhancement New feature or request released

Comments

@WildEgo
Copy link

WildEgo commented Jun 18, 2021

Hey guys from what it seems I can't really use

Model.where({
    type: this.search.type,
    team: this.search.team
});

I think it would be useful to avoid overwriting a lot of stuff and just basically passing a query to the current Model.

Kind Regards,
Luis Bizarro

@JoaoPedroAS51
Copy link
Collaborator

Hi @WildEgo! Yeah, this is not supported yet, but I really liked the idea! 😃
It seems easy to implement. What do you think @Peter-Krebs?

@Peter-Krebs Peter-Krebs added the enhancement New feature or request label Jul 19, 2021
@Peter-Krebs
Copy link
Collaborator

Peter-Krebs commented Jul 19, 2021

When queries are simple this approach is very nice to use, yes.
It gets complicated if you want to pass the object around or modify the where query.

We should also add the possibility to edit the where() statement, with a getter and setter for the object. Otherwise it is not possible to edit the where conditions. For example, you could have a base class with default where options that get modified by child classes.
It is not a use-case for me but I can imagine people want to build upon this behavior once it exists.

String parameters to where() with strings should be internally converted to an object in general? Isn't that what we do already?

@github-actions
Copy link

github-actions bot commented Jul 5, 2022

🎉 This issue has been resolved in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

3 participants