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

Missing take? #411

Closed
tpow opened this issue Mar 8, 2021 · 0 comments · Fixed by #413
Closed

Missing take? #411

tpow opened this issue Mar 8, 2021 · 0 comments · Fixed by #413
Labels
bug An existing feature is not working as intended

Comments

@tpow
Copy link

tpow commented Mar 8, 2021

In Orator ORM you can use code like this:

logins = user.logins().skip(10).take(5).get()

It looks like take is missing in masoniteorm or at least doesn't work the same way. Take is equivalent to limit in Orator. I wasn't sure if this was an intentional omission, oversight, or change in masoniteorm. Take is somewhat nicer to read in some contexts, so it would be nice to have.

When I try what I think is equivalent in masoniteorm:

logins = user.related("logins").skip(10).take(5).get()

I get the error: AttributeError: 'QueryBuilder' object has no attribute 'take'. Using limit instead of take works and generates the expected SQL with OFFSET 10 and LIMIT 5.

If take was intentionally removed, this is something that should be documented in the Orator to Masonite ORM migration documentation.

@tpow tpow added the bug An existing feature is not working as intended label Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An existing feature is not working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant