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 public BuildCondition method for associations #7008

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

greencoda
Copy link

@greencoda greencoda commented May 8, 2024

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

This PR proposes to add a public variant of the buildCondition() method, as it would allow dynamic query creation, for cases when the user would like do additional filtering, ordering or limiting before calling Find() or Count() on the transaction statement.

User Case Description

I'm creating a connector between GORM and GraphQL, where associated fields on a model are returned as the result of a pagination function, which allows the user to apply ORDER, LIMIT and WHERE conditions before returning a page of associated records.

As the association struct does not allow for setting these before calling the Find() and Count() methods, having access to this private buildCondition() method is the next best way to be able to construct this query.

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.

None yet

1 participant