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

Add pick functionality #5

Merged
merged 15 commits into from
Oct 6, 2022
Merged

Add pick functionality #5

merged 15 commits into from
Oct 6, 2022

Conversation

jclarkkoala
Copy link
Collaborator

@jclarkkoala jclarkkoala commented Aug 13, 2022

What

Adds the ability to limit which fields are picked in a query

Why

There is a demand to limit the overhead or large models and/or large lists of search results where most of the data is not needed.

How

Adds a new query parameter to limit which fields are requested from a resource.
Ex: GET /users?pick=id,username,occupation will limit the amount of data fetched and returned to just three fields.

@jclarkkoala jclarkkoala changed the title Add pick and omit Add pick functionality Aug 13, 2022
Copy link
Member

@walterbm walterbm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing job! The flexibility of pick is really powerful. Excited to see it in action!

src/Middleware/RepositoryMiddleware.php Outdated Show resolved Hide resolved
src/EloquentQueryModifier.php Show resolved Hide resolved
tests/EloquentRepositoryTest.php Outdated Show resolved Hide resolved
@jclarkkoala jclarkkoala merged commit 70564c4 into main Oct 6, 2022
@delete-merged-branch delete-merged-branch bot deleted the Add_pick_and_omit branch October 6, 2022 14:31
Copy link
Member

@ericjohnf ericjohnf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for adding this!

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

Successfully merging this pull request may close these issues.

3 participants