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

Association Aggregates #423

Merged
merged 69 commits into from
Oct 8, 2018
Merged

Association Aggregates #423

merged 69 commits into from
Oct 8, 2018

Conversation

groue
Copy link
Owner

@groue groue commented Oct 1, 2018

This pull request builds on top of #422 and brings Association Aggregates, inspired by Django ORM.

For example:

// Authors with the number of books they wrote
let request = Author.annotated(with: Author.books.count)

// Authors with their minimum and maximum book year
let request = Author.annotated(with:
    Author.books.min(Column("year")),
    Author.books.max(Column("year")))

// Authors who did not write any book
let request = Author.having(Author.books.isEmpty)

// Authors who wrote more books that they did paintings
let request = Author.having(Author.books.count > Author.paintings.count)

@groue groue merged commit 1c5cecf into development Oct 8, 2018
@groue groue added this to the GRDB 3.4.0 milestone Oct 8, 2018
@groue groue deleted the feature/annotation branch October 8, 2018 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant