Skip to content

Conversation

@jsdt
Copy link
Contributor

@jsdt jsdt commented Nov 11, 2025

Description of Changes

This introduces a query builder for typescript modules. It is available as ReducerCtx.queryBuilder, but it might make more sense to rename that to schema. There are some examples of how to build queries in query.test-d.ts and query.test.ts.

There is more type-safety to be added (ensuring eq is used on comparable types, and only allowing semijoins to use indexed columns), but those changes should only require changing some type parameters.

API and ABI breaking changes

This is adding a new query builder API on the module side, which won't actually be useful until we can use them in views.

Expected complexity level and risk

1.5.

Testing

There are tests of the emitted sql in query.test.ts, but at some point we should add end-to-end tests to make sure that we can parse those queries in the query engine.

@jsdt jsdt requested a review from cloutiertyler November 11, 2025 05:02
Comment on lines 76 to 80
firstQuery.semijoinTo(
ctx.queryBuilder.order,
p => p.age,
o => o.item_name
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we decided on

.semijoin(ctx.queryBuilder.order, (p, o) => eq(p.age, o.item_name));

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.

3 participants