Skip to content

Conversation

@dmythro
Copy link

@dmythro dmythro commented Sep 4, 2025

In order to not introduce breaking changes on list responses, Count queries are added on the same level where <table>Single is generated as <table>Count. They use the same where filters as list, but return item count number only.

Copilot AI review requested due to automatic review settings September 4, 2025 00:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 executeCountQuery utility function in common.ts with fallback support for different database implementations
  • Implements generateSelectCount function 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.

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.

1 participant