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

feat(base_model): add findManyBy method #1010

Merged
merged 3 commits into from
Mar 13, 2024
Merged

feat(base_model): add findManyBy method #1010

merged 3 commits into from
Mar 13, 2024

Conversation

RomainLanz
Copy link
Member

Hey there! 👋🏻

This PR adds a findManyBy method to the ORM.
Since we already have helpful static methods for most use cases, we were missing one that could fetch multiple records with a condition.

The method findManyBy can be used in two ways:

// Using an object 
User.findManyBy({ status: 'active'})

// Using two arguments
User.findManyBy('status', 'active')

If this PR is accepted, I will create another one to add the object syntax override to the findBy method.

@thetutlage
Copy link
Member

Looks fine to me. Let's open another PR for the docs as well and then we can merge it.

@RomainLanz
Copy link
Member Author

Should be good!

@RomainLanz
Copy link
Member Author

About the lint issue, Prettier formatted it like that when saving. Also, neither npm run lint -- --fix or npm run format changed the format again. So probably a CI issue.

@Julien-R44
Copy link
Member

( fixed the lint issue with npm run lint -- --fix. probably an issue with your setup 👮 )

@thetutlage thetutlage merged commit 4427c8d into develop Mar 13, 2024
32 checks passed
@thetutlage thetutlage deleted the feat/findMany branch March 13, 2024 10:20
@avonian
Copy link

avonian commented Mar 24, 2024

it's worth pointing out that while findByMany supports a clause, findBy only supports key/value, if its not a terrible ask it would be nice to update findBy as well so that it can also do clauses... this way it's more useful, as well as consistent :)

@RomainLanz
Copy link
Member Author

Yes, as said in the last sentence, it is going to be added too!

@avonian
Copy link

avonian commented Mar 24, 2024

oh whoops my mistake, i dont know how i missed that, sorry! 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants