Skip to content

docs: demonstrate everyday reads in the sample and quickstart - #34

Merged
omer-cengel merged 2 commits into
masterfrom
chore/sample-search-count-page-and-left-join
Sep 25, 2026
Merged

omer-cengel merged 2 commits into
masterfrom
chore/sample-search-count-page-and-left-join

Conversation

@omer-cengel

Copy link
Copy Markdown
Member

Summary

The external Maven/PostgreSQL sample and the quickstart now demonstrate the everyday read operations sqlcj supports. A case-insensitive text search, a scalar count, a paged list, and a narrow left-join projection sit beside the existing optional lookup, all as methods of the single generated AuthorRepository. This lets new users see those queries compiled, generated, and run end to end against PostgreSQL.

Changes

  • The sample schema adds a books table whose author_id references authors (id).
  • The sample queries add:
    • SearchAuthors (name ILIKE $1), generating searchAuthors(String name);
    • CountAuthors (COUNT(*) AS total), returning CountAuthorsResult with a non-null Long total;
    • ListAuthorPage (LIMIT $1 OFFSET $2), generating listAuthorPage(Integer limit, Integer offset);
    • CreateBook, an :exec insert;
    • ListAuthorBooks, a LEFT JOIN returning ListAuthorBooksResult.
  • The sample application checks each new step:
    • the search matches only the searched author;
    • the count is 2;
    • the page returns only the second author;
    • the insert affects one row;
    • the left join reads a null title for the author without a book.
  • Release verification resets both tables, so it can be rerun against an existing database, and checks the five new generated methods.
  • The quickstart's schema and query listings, application listing, expected output, and contract bullets match the sample. Its invalid-query example diagnostic now reports the correct line.

Scope and non-goals

  • The compiler, generator, runtime, and sqlcj.yaml are unchanged. The sample still generates one repository from one query group.
  • Range predicates (BETWEEN) and IS NULL filters are supported but are not demonstrated in the sample.
  • The reference documentation for queries and PostgreSQL support is not changed.

The external sample gains a books table and five queries, and its
application checks a case-insensitive search, a scalar count, a page, a
book insert, and a left join that reads a null title for an unmatched
author. Release verification now resets both tables and checks the five
new generated repository methods.
@omer-cengel
omer-cengel merged commit da50266 into master Sep 25, 2026
6 checks passed
@omer-cengel
omer-cengel deleted the chore/sample-search-count-page-and-left-join branch September 25, 2026 18:24
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