Repository navigation
feat: share one row record per table across full-row queries - #27
Merged
Merged
Conversation
A query whose only projection is a single-source SELECT * or SELECT <source>.*, or whose RETURNING clause is exactly *, now returns the repository's nested <Table>Row record instead of its own <Query>Result. Each table gets one row record, in schema column order, and one positional row mapper, generated after the constructor in first-use order and shared by every such query. Explicit column lists, a wildcard combined with another item, wildcards in joins, and RETURNING column lists keep their query-specific records. A row mapper yields to a query's own mapper name with a numeric suffix, and two tables whose row types are equal ignoring case are rejected before any file is written. Parameter and binding order are unchanged.
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.
Summary
Queries that return one complete table row now return a reusable nested
<Table>Rowrecord in their repository instead of a separate per-query result record. Create, read, and list operations on the same table therefore share one Java type, such asAuthorRepository.AuthorsRow, and application code no longer converts between identical per-query records.Changes
SELECTwith exactly one source whose only projection item is*or<source>.*, and anINSERT,UPDATE, orDELETEwhoseRETURNINGclause is exactly*, return the repository's<Table>Rowrecord. Aliases and table-name spelling in the query do not affect which row type is used.public record <Table>Rowin schema column order, with lower-camel-case components (for examplecreatedAt), and one private positional row mapper. Both are generated once, after the repository constructor, in the order queries first use them.authorsgeneratesAuthorsRowandauthorsRowMapper. A row mapper yields to a query's own mapper with a numeric suffix, so a query namedAuthorskeepsauthorsRowMapperand the row mapper becomesauthorsRowMapper1. Method parameters avoid all row-mapper names.RETURNING *andSELECT *, socreateAuthor,getAuthor, andlistAuthorsall returnAuthorRepository.AuthorsRow. The README, quickstart, query, and configuration documentation describe the rule, naming, and collisions.Scope and non-goals
RETURNINGcolumn lists keep their query-specific<Query>Resultrecords, with unchanged alias naming and selected-column order.RETURNINGaliases, structural deduplication of result records, and configuration options are unchanged.