egobrain/equery
70.2
Strong · 2 October 2026
2.7k
lines of production code
Erlang
primary language
2
measurements over time
What this system is
This system is a composable, type-aware DSL library for building PostgreSQL queries in Erlang. It provides a comprehensive set of builders for complex SQL operations, including joins, CTEs, locking, and JSON/JSONB manipulation, while handling SQL generation and expression logic. The project also includes a release automation script for versioning and changelog management.
Features
Automated release script for versioning and changelog management
A new \scripts/release.sh\ utility has been added to automate the release process. This script accepts a bump type (major, minor, or patch) to automatically calculate the new version number, update the \CHANGELOG.md\ by renaming the 'Unreleased' section to the new version with the current date, and create a fresh 'Unreleased' placeholder. It then commits these changes and creates an annotated git tag. The script includes safety checks to ensure the working tree is clean and the changelog is not empty, but it does not push to remote repositories or publish packages, leaving those steps manual.
scripts · high confidence
Initial release of equery PostgreSQL query builder
This change introduces the equery library, a composable, type-aware DSL for building PostgreSQL queries in Erlang. It adds extensive SQL expression support including HAVING clauses, LATERAL joins, NULLS FIRST/LAST ordering, and FETCH FIRST n ROWS (with ties). The release includes a wide range of scalar, aggregate, string, numeric, date/time, array, and JSON/JSONB functions, alongside schema-qualified table name support. Existing behavior is adjusted so that atom-to-binary conversions now use UTF-8 instead of latin1, and the \pg\_sql:value()\ type is renamed to \pg\_sql:expr()\ to avoid ambiguity with AST nodes.
(repo-wide) · high confidence
Behavioural changes
Expanded query record structure with new SQL clause support
The internal query record has been significantly expanded to support advanced SQL features. New fields have been added to the query structure to handle WITH clauses (CTEs), DISTINCT and DISTINCT ON operations, GROUP BY and HAVING clauses, ORDER BY, LIMIT with tie-breaking modes, OFFSET, row locking levels and wait policies, and ON CONFLICT actions. Additionally, the record now explicitly supports JOIN types and stores custom metadata in a set field, while the schema field is now typed. A new header file equery.hrl introduces a parse transform, and cth.hrl provides a test helper for map-to-list conversion.
include · high confidence
Major rewrite of the query DSL and SQL generation engine
The library has been refactored to support a more composable and expressive query building experience. The core \q\ module now exposes a comprehensive set of builders including \from\, \using\, \with\, \recursive\, \join\, \lateral\_join\, \where\, \select\, \set\, \data\, \group\_by\, \having\, \on\_conflict\, \order\_by\, \limit\, \first\, \offset\, \distinct\, \distinct\_on\, \lock\, and \for\_update\. SQL expression logic has been moved to a dedicated \pg\_sql\ module, which provides explicit functions for operators, scalar functions, aggregates, and type casts, while JSON-specific operations are handled by the new \qjson\ module. A new parse transform (\equery\_pt\) allows native Erlang operators inside DSL closures to be automatically rewritten into SQL calls, and runtime transformation is supported for interactive shell usage. The internal AST representation (\qast\) has been updated to support richer metadata and type inference, and the application structure has been simplified by removing the \equery\_app\ and \equery\_sup\ modules, shifting to a library-only distribution model.
src · high confidence
Test coverage
Added comprehensive EUnit test suite for query builder and JSON operations
This change introduces a new set of EUnit tests covering core library components. The \q\_tests\ module was significantly expanded to verify SQL generation for complex queries, including joins, ordering, row locking (\FOR UPDATE\), and schema-qualified table references. New test files were added to validate utility functions (\equery\_utils\_tests\), SQL type string formatting (\pg\_sql\_tests\), and AST manipulation (\qast\_tests\). Additionally, \qjson\_tests\ provides coverage for JSON/JSONB operators (such as \-\>\, \\#\>\, \@\>\) and builder functions (like \jsonb\_build\_object\ and \jsonb\_set\), ensuring correct SQL output and argument binding for these operations.
test · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 70 → 70 (+0.2)
- Rubric changed (rubric-2026.09.12 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 97 → 97 (+0.0)
- Architecture 100 → 100 (+0.0)
- Maturity 55 → 55 (+0.4)
- Readiness 68 → 68 (+0.0)
- Security 100 → 100 (+0.0)
Resolved (4)
- Coverage not measured — no coverage collector is wired up
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Hotspot: src/pg_sql.erl (src/pg_sql.erl)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
egobrain/equery was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 2 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 0752150a7f04a81f793ef487d36a42440d7c6534 — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-e569280dd5e2.