Add count queries#40
Open
dmythro wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds count query functionality to the GraphQL schema by introducing new count resolvers for each table. The implementation provides basic count queries and count queries with filtering capabilities across all database adapters (SQLite, PostgreSQL, and MySQL).
- Adds
executeCountQueryutility function in common.ts with fallback support for different database implementations - Implements
generateSelectCountfunction in each database adapter to create count resolvers - Adds comprehensive test coverage for count queries across all database adapters
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/builders/common.ts | Adds executeCountQuery utility function with modern $count API and fallback to manual count queries |
| src/util/builders/sqlite.ts | Implements generateSelectCount function and integrates count queries into SQLite schema generation |
| src/util/builders/pg.ts | Implements generateSelectCount function and integrates count queries into PostgreSQL schema generation |
| src/util/builders/mysql.ts | Implements generateSelectCount function and integrates count queries into MySQL schema generation |
| tests/sqlite.test.ts | Adds test cases for basic count, filtered count, and posts count queries for SQLite |
| tests/sqlite-custom.test.ts | Adds test cases for custom count queries in SQLite custom schema |
| tests/pg.test.ts | Adds test cases for basic count, filtered count, and posts count queries for PostgreSQL |
| tests/pg-custom.test.ts | Adds test cases for custom count queries in PostgreSQL custom schema |
| tests/mysql.test.ts | Adds test cases for basic count, filtered count, and posts count queries for MySQL |
| tests/mysql-custom.test.ts | Adds test cases for custom count queries in MySQL custom schema |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In order to not introduce breaking changes on list responses, Count queries are added on the same level where
<table>Singleis generated as<table>Count. They use the samewherefilters as list, but return item count number only.